import { StyleSheet, View } from 'react-native'
import React from 'react'
import WebView from 'react-native-webview'
const App = () => {
const html = `
<html>
<head></head>
<body>
<script>
setTimeout(function () {
window.ReactNativeWebView.postMessage("Hello!")
}, 2000)
</script>
</body>
</html>
`;
return (
<View style={styles.container}>
<WebView
source={{html}}
onMessage={event => {
alert(event.nativeEvent.data);
}}
/>
</View>
);
};
export default App
const styles = StyleSheet.create({
container: {
flex: 1,
},
})
Bug description:
To Reproduce:
Expected behavior:
This code should to show an Alert after 2 seconds. But in iOS does not show it.
Environment: