Skip to content

Added support for onShouldStartLoadWithRequest.#98

Merged
lucasferreira merged 2 commits intolucasferreira:masterfrom
Fanapptic:fanapptic.onshouldstartloadwithrequest
May 10, 2018
Merged

Added support for onShouldStartLoadWithRequest.#98
lucasferreira merged 2 commits intolucasferreira:masterfrom
Fanapptic:fanapptic.onshouldstartloadwithrequest

Conversation

@iamarkdev
Copy link
Copy Markdown
Contributor

@iamarkdev iamarkdev commented May 8, 2018

This adds a solution to react-native-webview-android for onShouldStartLoadWithRequest support.

The approach is fairly straightforward.

For any URL load, shouldOverrideUrlLoading will initially return true - not allowing it to load. It will also dispatch the ShouldOverrideUrlLoadingEvent, triggering _onShouldOverrideUrlLoading in index.android.js. It then gets the result of onShouldStartLoadWithRequest at the react-native level if it's set on RNWebViewAndroid. A view manager command is sent back to the native side, which will take the onShouldStartLoadWithRequest result as shouldOverride included in the command and either allow the original url to load, or not load.

To note, onShouldStartLoadWithRequest only receives an object containing url and navigationState in this initial implementation.

@iamarkdev iamarkdev changed the title Initial support for onShouldStartLoadWithRequest. Added support for onShouldStartLoadWithRequest. May 8, 2018
@iamarkdev
Copy link
Copy Markdown
Contributor Author

Thanks @lucasferreira could you bump the npm version as well and publish it?

@lucasferreira
Copy link
Copy Markdown
Owner

OK @braydo25 thanks for that ;)

Couldn't test at all, but I've merged this believing in your need and already published in npm.

@iamarkdev
Copy link
Copy Markdown
Contributor Author

Great! All should be well - I did extensive testing prior to submitting the PR

@sinhpn92
Copy link
Copy Markdown

Have any solution to solve this issue? I did check latest version but didn't any update for this issue.

@lucasferreira
Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants