M
M
Michael2019-06-26 23:18:19
React Native
Michael, 2019-06-26 23:18:19

JavaScript injection in webview in react native?

Hello!
Interested in any information about how to implement their styles and scripts in an application on REACT native , inside WEBVIEW.
Code samples, links, articles, videos, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alexandrovich, 2019-06-27
@mk3mk

here is all the documentation that is on webview
https://github.com/react-native-community/react-na...
as an example, change the style when starting webview

const INJECTED_JAVASCRIPT = `(function() {
    document.body.style.background = color;
})();`;

<WebView
  source={{ uri: 'https://facebook.github.io/react-native' }}
  injectedJavaScript={INJECTED_JAVASCRIPT}
  onMessage={this.onMessage}
/>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question