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

How to pass the parameters from react-native-webview to the javascript? #26137

Closed
AishuVaid opened this issue Aug 21, 2019 · 8 comments
Closed
Labels
Bug Component: WebView Related to the WebView component. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.

Comments

@AishuVaid
Copy link

Trying to send the parameters from the react-native-WebView to the javascript function.
tried injectedjs which didn't work.Should be able to pass the params from the webview to the javascript function.

<WebView
source={{ uri: 'file:///android_asset/ICFPackage/ICFPackage/index.html' }}
originWhitelist={["*"]}
domStorageEnabled={true}
startInLoadingState={true}
javaScriptEnabled={true}
allowFileAccess={true} />

React Native version:
React Native Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Memory: 317.05 MB / 15.56 GB
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 11.15.0 - /usr/bin/node
npm: 6.7.0 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
Build Tools: 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.1
System Images: android-24 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-webview: 6.9.0

@AishuVaid AishuVaid added the Bug label Aug 21, 2019
@react-native-bot react-native-bot added Component: WebView Related to the WebView component. Platform: Linux Building on Linux. labels Aug 21, 2019
@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.60 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.

@AishuVaid
Copy link
Author

It looks like you are using an older version of React Native. Please update to the latest release, v0.60 and verify if the issue still exists.

No. This is not a version fault. It works for ios but doesn't work for android.

@sunnylqm
Copy link
Contributor

sunnylqm commented Aug 22, 2019

https://github.com/react-native-community/react-native-webview/blob/master/docs/Guide.md#communicating-between-js-and-native
You should go to react-native-webview repo and search their docs and issues first.

@AishuVaid
Copy link
Author

https://github.com/react-native-community/react-native-webview/blob/master/docs/Guide.md#communicating-between-js-and-native
You should go to react-native-web-view repo and search their docs and issues first.

I have already put the html file in the android_assets but how can I send parameters from the react-native-web-view to the JavaScript function?

@sunnylqm
Copy link
Contributor

Why you dont read the link first?

@AishuVaid
Copy link
Author

Why you dont read the link first?

I have already used injectedJs. Whenever it renders to the page,it says document not defined.

@sunnylqm
Copy link
Contributor

injectedjs should be injected as string. It is designed to be running in browser environment where there is a document object.

@dulmandakh
Copy link
Contributor

Please file an issue to react-native-webview.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 4, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: WebView Related to the WebView component. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants