Reputation: 1057
How can I pass props in Webview and get the props in my local html page
export default class HomeScreen extends React.Component {
render() {
return (
<View>
<WebView source={require('../Web/index.html')} />
</View>
);
}
}
Upvotes: 1
Views: 3977
Reputation: 2932
You cannot pass any props to html page inside your Webview.
But there is a trick by using injectedJavascript
https://facebook.github.io/react-native/docs/webview.html#injectedjavascript
Here is example: https://www.undefinednull.com/2015/12/27/injecting-custom-javascript-into-react-natives-webview/
Upvotes: 1