我的 WebView 首先加载,然后按下 TouchableOpacity。后台webview改变后不重启webview可以吗?
import React, {Component} from 'react';
import {View,Text} from 'react-native'
export default class TestScreen extends Component {
render() {
return (
<View >
<TouchableOpacity onPress={/*what is the function that changes the background color of the webview after loading it (but without reloading the Webview)*/}>
<WebView>
</TouchableOpacity>
</View>
);
}}
最佳答案
是的。你可以。实际上,您可以通过这样做来更改 webview 的背景颜色。
在 WebView 开始标签中添加样式属性。像这样
<WebView
style={{
backgroundColor: 'green'
}}
/>
这会将 webview 的背景设置为绿色。
https://stackoverflow.com/questions/53748973/