react-native: JavaScript not work in webview
When I use the webview in my project,JavaScript not work in the HTML file,Here my code: `` `
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
WebView,
} from 'react-native';
export default class NoteEditor extends Component {
render() {
return (
<WebView
style={styles.container}
source={require('./editor.html')}
injectedJavaScript={'function myfunc() { alert(123) };myfunc();'}
javaScriptEnabled={true}
startInLoadingState={true}
/>
);
}
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
`
-I use RN 0.29.2 -in RN 0.27 is ok what should I do? thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (10 by maintainers)
#16133 hey guys check my answer
it work with RN >=0.54