【发布时间】:2020-05-12 15:19:50
【问题描述】:
我尝试在 webview 中使用 react-native-orientation 以使其成为唯一可以旋转的视图。
import React, {useEffect} from 'react';
import { WebView } from 'react-native-webview';
import Orientation from "react-native-orientation"
export function GameWebViewScreen({navigation}) {
const link = ****
useEffect(() => {
Orientation.unlockAllOrientations();
}, [])
return <WebView source={{uri: link}}/>
}
我收到 TypeError: null in not an object on unlockAllOrientations 调用。有谁知道这是一个问题,因为我没有按照说明here 中的说明配置本机文件,因为我还没有访问权限,或者?
我也尝试过使用类组件并得到了相同的结果。
我也愿意接受有关控制单个视图旋转的库的任何其他建议。
【问题讨论】:
-
对于这个 EXACT 问题,除了简单的 React,有人有答案吗?
标签: typescript react-native rotation screen-rotation