-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Variables and functions from injectedJavaScript not available on Android #554
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
Comments
Works around issue react-native-webview/react-native-webview#554. Note that with this method the REPL inside the webview works for iOS; on Android it immediately says "shadow-cljs - Connection closed!".
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically |
I have the same problem right now. Did you find a solution or workaround for this? |
@its-wufu I have not further pursued this. I noticed this comment the other day though, it may be the workaround you're looking for (but I didn't try): |
I couldn't make this work unfortunatly. Maybe I show what I did, so someone may find something to add here. I created a Test App and just used Test Credentials from WireCard. This is how my App.js looks like:
The Payment Page is from https://wpp-test.wirecard.com/loader/paymentPage.js and I made a String out of it to insert it into the injectedJavaScript property. Should this not work? Any ideas? Maybe this issue should be opened again... |
I solved this by using the onLoad prop.
I red that you should care about the linebreaks. Using this method I can access variables when calling the injectJavaScript method. |
This is still a problem on version: 9.1.4. I could not try 9.2.0 because of another known build error. Once the fix for 9.2.0 is released I try it as well. But for the moment the workaround that @svdo posted above worked for me! |
Bug description:
On Android, variables and functions declared in
injectedJavaScript
are not available in code run byinjectJavaScript
, whereas on iOS they are. Please note that I'm usingsource={{ html: ... }}
, not loading an external URI. I believe the behaviour on iOS is correct, that on Android is not.To Reproduce:
I created a repo that demonstrates this issue. I was careful to create a descriptive git history, so I hope it is pretty self-explanatory: https://github.com/svdo/VarIssue. This repo contains a complete react native project that you should be able to run yourself (make sure Android emulator is running):
Environment:
react-native info
:Note
injectJavaScript
to declare the variables and function, instead ofinjectedJavaScript
, will cause everything to work as expected. This is demonstrated in commit svdo/VarIssue@72f3fa0.The text was updated successfully, but these errors were encountered: