1

How to pass variables using javascript from react native to the webview and use these variables inside html code in the webview?

1 Answer 1

1

You need to add injectedJavascript to your WebView.

Follow this link for official documentation: https://facebook.github.io/react-native/docs/webview.html#injectedjavascript

Here is an example: https://www.undefinednull.com/2015/12/27/injecting-custom-javascript-into-react-natives-webview/

Sign up to request clarification or add additional context in comments.

1 Comment

I tried to do that, but when I call this variable from the code inside the webview it gives me that "the variable is undefined..".. can you please give me a full example? pass variable and then use it in html code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.