I am using react-native-webview in my project and i facing issue while loading the request second times.
Here is the request object
type WebRequest = {
uri: string,
method: string,
body?: any,
headers: any
}
below is the state
const [webRequest, setWebRequest] = useState<WebRequest>();
this is how i implemented web view
<WebView
ref={WEBVIEW_REF => (WebViewRef = WEBVIEW_REF)}
source={webRequest}
onLoadStart={(e) => {
console.log("onLoadStart ", e);
}}
onLoadEnd={(e) => {
console.log("onLoadEnd ", e);
}}
onError={(e) => {
console.log("onLoadEnd ", e);
}}
/>
On click on a button the below code will be executed and will be loaded url request.
const webViewRequest: WebRequest = {
uri: "http://example.com/page”,
method: 'GET',
headers: {
“header1: “aaaaa”,
"header2”: “xxx”
},
}
setWebRequest(webViewRequest)
It is working fine if i click on a button and load the above request but second time webview is not getting loaded.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…