react-native - React native如何改变WebView的背景色?

我的 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/

相关文章:

node.js - 如何将字符串作为 gzip Nodejs 上传到 s3

python - 使用 Python 插入多个 MySQL 记录。错误 : "Python ' tu

git - 如何通过 GitHub 的 API 进行 cherry-pick

matlab - 根据给定矩阵的对角线和反对角线创建新矩阵

postgresql - . 时如何将密码传递给 pg_dump 10主目录中的 pgpass 不是

python - Pandas - 从索引中提取月份和年份

vue.js - 如何使用 Nuxt.js 在 vuex 状态中获取本地存储数据

google-colaboratory - 在 Google Colab notebook 上安装

macos - 如何在 macOS 上获取 awk 版本?

python - 如何修复-没有这样的表 : main. auth_user__old