React Native + React - Native -router-flux:如何仅将hideNavBar应用于
React Native + react-native-router-flux: How to apply hideNavBar to only one <Scene/>?
在React Native中使用React - Native -router-flux,我有两个<Scene/>
,当我将hideNavBar
应用于第一个Login
时,它也适用于第二个Home
,即使它们处于同一级别。如何将hideNavBar
仅应用于一个<Scene/>
, Login
?
const RouterWithRedux = connect()(Router)
const store = configureStore()
export default class App extends Component {
render() {
return (
<Provider store={store}>
<RouterWithRedux>
<Scene key='root'>
<Scene component={Login} hideNavBar initial={true} key='login' title='Login'/>
<Scene component={Home} key='home' title='Home'/>
</Scene>
</RouterWithRedux>
</Provider>
)
}
}
我不确定原因。可能它在不同的actions/PUSH
之间持久化一些状态参数。作为一种变通方法,你可以试着明确一点:它对我有效。
const RouterWithRedux = connect()(Router)
const store = configureStore()
export default class App extends Component {
render() {
return (
<Provider store={store}>
<RouterWithRedux>
<Scene key='root'>
<Scene component={Login} hideNavBar initial={true} key='login' title='Login'/>
<Scene component={Home} hideNavBar={false} key='home' title='Home'/>
</Scene>
</RouterWithRedux>
</Provider>
)
}
}
从那个路由开始,NavBar是可见的。如果你的Login在整个场景流程中只出现一次,这是合适的。
相关文章:
- React Native通过Navigator将用户输入数据传递到选项卡栏IOS中的组件
- 使用Jest测试React Native应用程序
- 是否存在React Native“;WEB代码安全防护”;
- React Native Listview留有余地
- 如何在React Native中绘制图形
- 在iOS和Android上使用React native时,我还能使用本机第三方lirbraries吗
- 使用createContainer将Meteor数据获取到React Native中时出现问题
- React Native当前是否支持访问用户'的通讯簿
- React Native-What'It’在任何地方都要留下逗号
- React Native DeviceEventEmitter键盘WillShow停止工作
- 与React Native的Chart.js等效
- 如何使用webview在React Native中使用Highcharts
- 如何在React Native的MapView中设置标记
- React Native NavigatorIOS
- 如何获得React Native TextInput以在提交后保持焦点
- 使用react native检测应用程序终止
- 可以在React Native中制作一个自哈希应用程序
- React Native AlertOS api中可能有多个文本字段
- react native中常见的js模块
- 在React Native+Redux中使用Navigator