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

fix: document ready js template #3

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Conversation

a00012025
Copy link

@a00012025 a00012025 commented Oct 11, 2023

Summary

比較 Metamask 用的 reaect native webview 跟 flutter_inappwebview 後,發現主要的差別在 inject 的 script 會被經過不同的處理才丟到 Android 的 evaluateJavascript

原本 flutter_inappwebview 裡的寫法,如果 inject 的當下 document.readyState = 'loading' 的話,script 就完全不會執行。把這個 template 改成 metamask 用的 IIFE 的寫法就會 work 了

主要參考:https://github.com/react-native-webview/react-native-webview/blob/master/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java#L284-L290

@t42ji2ji t42ji2ji merged commit b0225c2 into master Oct 11, 2023
1 of 3 checks passed
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.

2 participants