Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not use injectedJavaScriptBeforeContentLoaded? #4

Open
wbobeirne opened this issue Jan 3, 2023 · 1 comment
Open

Why not use injectedJavaScriptBeforeContentLoaded? #4

wbobeirne opened this issue Jan 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@wbobeirne
Copy link

It looks like the implementation of this library and the README expects you to sort of "manually" inject the JS and uses a heuristic of 75% loaded to pick the right time to do it, but WebView already provides a prop for this: https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#injectedjavascriptbeforecontentloaded

Was there a reason the suggested methodology was chosen?

@hsjoberg hsjoberg added the enhancement New feature or request label Jan 3, 2023
@hsjoberg
Copy link
Owner

hsjoberg commented Jan 3, 2023

If I recall correctly (I worked on this years ago), the reason for not using this prop is because it would only work for the first web page that was loaded. So it won't trigger if you navigate to another page.

But I might be wrong. We could perhaps use injectedJavaScriptBeforeContentLoaded for what we want to do. The "75% loaded" stuff is pretty bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants