类型错误:无法读取 null 的属性“isFileUploadSupported”

Sau*_*yas 6 webview react-native react-native-webview

我正在尝试使用react-native-webview在我的React-Native应用程序中渲染HTML片段 ,我也尝试了react-native-render-html,但是在这个CSS中并没有那么有效。

这是我的错误堆栈

 ERROR  TypeError: Cannot read property 'isFileUploadSupported' of null, js engine: hermes 
at App (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.dbc&modulesOnly=false&runModule=true:93600:36)
at RCTView
at View
at RCTView
at View
at AppContainer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.dbc&modulesOnly=false&runModule=true:85300:36)
at DBC(RootComponent) (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.dbc&modulesOnly=false&runModule=true:89907:28)
 ERROR  Error: Requiring module "node_modules/react-native-webview/index.js", which threw an exception: TypeError: Cannot read property 'isFileUploadSupported' of null, js engine: hermes 
at App (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.dbc&modulesOnly=false&runModule=true:93600:36)
at RCTView
at View
at RCTView
at View
at AppContainer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.dbc&modulesOnly=false&runModule=true:85300:36)
at DBC(RootComponent) (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.dbc&modulesOnly=false&runModule=true:89907:28)
 ERROR  TypeError: Cannot read property 'WebView' of undefined
This error is located at:
in App
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in DBC(RootComponent), js engine: hermes
Run Code Online (Sandbox Code Playgroud)

这是我的代码

import {SafeAreaView, ScrollView, useWindowDimensions} from 'react-native';
import {WebView} from 'react-native-webview';
import {getTemplate} from './template';

export default class App extends Component {
  render() {
    const template = getTemplate();
    const source = {
      html: template,
    };
    return (
      <SafeAreaView>
        <ScrollView>
          <ScrollView horizontal={true}>
            <WebView
              ref={r => (this.webref = r)}
              originWhitelist={['*']}
              source={source}
            />
          </ScrollView>
        </ScrollView>
      </SafeAreaView>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

che*_*nop 0

如此处所述尝试再次安装react-native-webview

纱:

yarn add react-native-webview
Run Code Online (Sandbox Code Playgroud)

节点管理:

npm i react-native-webview
Run Code Online (Sandbox Code Playgroud)