Webview 'injectJavascript' method not responding on iOS.

Re-Posted from github – https://github.com/expo/expo/issues/3628

I will update my status in both places if the issues gets solved.

Environment
Expo CLI 2.6.14 environment info:
System:
OS: macOS 10.14.3
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.1 => 16.8.1
npmGlobalPackages:
expo-cli: 2.6.14

Building for both Android and iOS. But the problem only occurs on iOS.

Steps to Reproduce

Run this snack either in the browser on on an iOS device. If running inside snack, make sure you pick iOS.
Tap the “broken” and “works” button see nothing happens.
Now reload snack / device in android instead and see the buttons working.
Expected Behavior
I was hoping I could get access to globally exposed methods on the webview in both iOS and Android.

Actual Behavior
From my investigation it seems all javascript commands are being ignored on iOS which the snack I linked also shows this behavior. You can change the js to anything and it just doesn’t respond. Android works exactly as expected.

Perhaps I’m doing something wrong, but the fact that it works on Android makes me think it’s a bug in the Webview component itself.

Reproducible Demo

instructions above.

Hey @mackbrowne.prodigy,

As I mentioned on the github issue, with WebView being a RN API if you could test to see if the same behavior occurs in a vanilla RN project that would be helpful as it would confirm that it’s an RN issue rather than an Expo one. (Just posting here for posterity).

Cheers,
Adam

@adamjnav this is now fixed. I’m assuming because of an update.

Here is the version I’m using now where the problem no longer occurs. I was looking into investigating the issue myself, I’m actually a little sad I no longer have to :frowning:

Regardless, it works now!

Expo CLI 2.11.7 environment info:
System:
OS: macOS 10.14.3
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
expo: ^32.0.0 => 32.0.0
react: 16.5.0 => 16.5.0
react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1
npmGlobalPackages:
expo-cli: 2.11.7

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.