我在我的本机应用程序上使用NavigatorIOS.我想在导航回上一个路线时传递一些属性.
一个示例案例:我在表单页面中.提交数据后,我想回到之前的路线并根据提交的数据做一些事情
我该怎么办?
我已经使用Facebook SDK创建了“登录”按钮。用户登录后,该应用程序导航到第二个屏幕(NavigatorIOS)。用户可以从第二个屏幕使用导航(返回按钮)返回登录屏幕。
如果用户已经登录,如何防止他返回登录屏幕?
index.ios.js
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
NavigatorIOS
} from 'react-native'
import LoginView from './src/login-view'
class MyApp extends Component {
render() {
return (
<Provider store={store}>
<NavigatorIOS
initialRoute={{
component: LoginView,
title: 'MyApp',
index: 0
}}
/>
</Provider>
);
}
}
AppRegistry.registerComponent('MyApp', () => MyApp);
Run Code Online (Sandbox Code Playgroud)
登录查看
import React, {Component} from 'react'
import {
View,
Text,
StyleSheet,
TouchableHighlight,
} from 'react-native'
import CategoryView from './category-view'
import {LoginButton, AccessToken, GraphRequest, GraphRequestManager} from 'react-native-fbsdk'
class LoginView …Run Code Online (Sandbox Code Playgroud) javascript ios react-native react-native-fbsdk navigator-ios
向下滚动时,我试图隐藏导航栏(NavigatorIOS)。我怎样才能做到这一点?
谢谢
我最近将我的反应原生项目从~0.28升级到最新版本(0.43.2),由于某种原因我的导航栏不再为我隐藏.
这是代码(它位于TabBarIOS组件中):
<TabBarIOS.Item
selected={this.state.selectedTab === 'home'}
title='Home'
icon={require ('./Icons/IconImages/HomeTabIcon.png')}
onPress={
() => this._tabPressed('home')
}>
<NavigatorIOS
style={styles.container}
ref="nav"
interactivePopGestureEnabled={false}
initialRoute={{
title: 'Home',
component: HomeNavigationController,
navigationBarHidden: true, //this does nothing now
showTabBar: false, //this is to hide the bottom tabBar
passProps: {
...
},
}}/>
</TabBarIOS.Item>
Run Code Online (Sandbox Code Playgroud)
在外面添加它initialRoute也不起作用:
<NavigatorIOS
style={styles.container}
ref="nav"
interactivePopGestureEnabled={false}
initialRoute={{
title: 'Home',
component: HomeNavigationController,
showTabBar: false,
passProps: {...},
}}
navigationBarHidden={true} // does not work
/>
Run Code Online (Sandbox Code Playgroud)