Skip to content

[IOS ONLY] onShouldStartLoadWithRequest, onLoadStart stoped being called after upgrading RN version to 0.70 #2970

@KonstantinKostianytsia

Description

@KonstantinKostianytsia

Bug description:
I faced the issue after updating the react-native version from 0.67.* to 0.70.9. onShouldStartLoadWithRequest function stopped being called. I tried to update react-native-webview latest version(12.1.0) but it was still there.
I tried to add logs to the RNCWebView ->decidePolicyForNavigationAction where onShouldStartLoadWithRequest is used and these logs also have not appeared. So native method is not called.

I also found from the native code that onLoadStart also called in that method and I was right. onLoadStart also is not called as well as onShouldStartLoadWithRequest.

To Reproduce:
I don't think we have some specific props passed.
How our WebView looks

 <WebView
        onLayout={onLayout}
        originWhitelist={['*']}
        source={{
          html,
          baseUrl: '',
        }}
        startInLoadingState={true}
        onLoadEnd={this.LoadEnd}
        style={styles}
        textZoom={100}
        showsHorizontalScrollIndicator={false}
        onMessage={handleMessages}
        ref={(ref) => {
          this._webView = ref;
        }}
        mixedContentMode="always"
        allowsFullscreenVideo={true}
        allowsInlineMediaPlayback={true}
        domStorageEnabled={true}
        allowFileAccessFromFileURLs={true}
        onShouldStartLoadWithRequest={(request) => {
          return shouldStartLoadWithRequest(request);
        }}
        setSupportMultipleWindows={false}
      />

Expected behavior:
onShouldStartLoadWithRequest, onLoadStart are called

Screenshots/Videos:

Environment:

  • OS: iPhone 14, iOS
  • OS version: 16.4
  • react-native version: 0.70.9
  • react-native-webview version: 11.22.7 (also reproduced on 12.1.0)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions