小编Sea*_*son的帖子

如何动态设置推送屏幕的方向 - React-Native-Navigation

我想知道如何使用 react-native-navigation 动态更改推送屏幕的方向。

我使用 startSingleScreenApp 和 appStyle oforientation: 'portrait' 强制纵向屏幕。我只想让推送的屏幕之一使用“自动”

我尝试了以下方法:

static navigatorStyle = {
   drawUnderTabBar: true,
   orientation: 'auto'
};
Run Code Online (Sandbox Code Playgroud)

我也试过:

componentWillMount() {
   this.props.navigator.setStyle({
      orientation: 'auto'
   });
};
Run Code Online (Sandbox Code Playgroud)

我什至使用以下方法推送到屏幕上:

...
navigatorStyle: {
  orientation:'auto'
}
...
Run Code Online (Sandbox Code Playgroud)

甚至可以动态更改它吗?

react-native react-native-navigation

1
推荐指数
1
解决办法
3699
查看次数