<WebView
source={{
uri: this.state.chosenCityUrl,
"Accept-Language": navigator.language,
"User-Agent": Platform.OS,
}}
javaScriptEnabled={true}
ref={(b) => this._bridge = b}
injectedJavaScript='window.onscroll=function(){alert("Not WORK");}'
//injectedJavaScript='window.addEventListener("scroll", function(e)
// { alert("Not WORK");
// });
/>
<WebView
source={{
uri: this.state.chosenCityUrl,
"Accept-Language": navigator.language,
"User-Agent": Platform.OS,
}}
javaScriptEnabled={true}
ref={(b) => this._bridge = b}
style={styles.webView}
onError={(error) => {
console.log("error", error);
return NetInfo.isConnected.fetch().done(isConnected => this.setState({isConnected}))
}}
onLoadEnd={(e) => this.onLoadEnd(e)}
renderError={() => this.renderError()}
onNavigationStateChange={this._onNavigationStateChange.bind(this)}
onMessage={event => this.onMessage(event)}
injectedJavaScript="setTimeout(() => {document.addEventListener('scroll', function (event) {window.ReactNativeWebView.postMessage(JSON.stringify(document.getElementsByClassName('topconteiner')[0].scrollTop));},true);}, 300);true;"
/>