Added support for onShouldStartLoadWithRequest.#98
Merged
lucasferreira merged 2 commits intolucasferreira:masterfrom May 10, 2018
Merged
Conversation
This was referenced May 8, 2018
Contributor
Author
|
Thanks @lucasferreira could you bump the npm version as well and publish it? |
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. |
Contributor
Author
|
Great! All should be well - I did extensive testing prior to submitting the PR |
|
Have any solution to solve this issue? I did check latest version but didn't any update for this issue. |
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
urlandnavigationStatein this initial implementation.