问题描述
以下代码生成一个应用 js 脚本的 WebView,然后它消失,就像 WebView 在更新时重新加载一样。所以你看到蓝色的闪光然后页面回到初始状态。有人遇到过类似的问题吗?
export default class NewComponent extends Component {
constructor(props) {
super(props)
this.webView = createRef()
}
componentDidMount() {
this.webView.current.injectJavaScript(
`document.body.style.backgroundColor = 'blue';
true;`
)
}
render() {
return (
<View>
<WebView
ref={this.webView}
source={{uri: this.props.mapUrl.url}}
originWhitelist={['*']}
javaScriptEnabled={true}
scrollEnabled={false}
bounces={false}
/>
</View>
)
}
}
我正在物理 android 设备上进行测试。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)