react native 之页面跳转
2016-08-12 17:52
706 查看
第一章 跳转的实现
1.component 中添加这行代码
onPress 主要运用于点击事件中
2.在运行的主页面中只能运行如下的component
需要注意的是:a. middleware 是中间件的设置,它有固定的格式.
<view/> 不能包含<Navigator/>这个标签 但反过来可以
3.点击跳转的页面的设置代码
根据name 实现不同的跳转
第二章 跳转效果的展示
react native 中的跳转效果可以很轻松的设置,不像js 中需要设置相应的动画效果,它主要是通过这一行代码设置的
这是从下往上跳出的效果.
react native 中还有哪些跳转效果,后期继续补充
1.component 中添加这行代码
<View style={styles.loginmain}> <Text style={styles.logintext} onPress={() => navigator.push({name:'In'})}>注册</Text> <Text style={styles.logintext} onPress={() => navigator.push({name:'Forget'})}>忘记密码 </Text> </View>
onPress 主要运用于点击事件中
2.在运行的主页面中只能运行如下的component
const thunkMiddleWare = (store) => (next) => (action) => { if (typeof action === 'function') { return action(store.dispatch, store.getState) } return next(action) export default function () { return ( <Provider store={createStore(reducer, applyMiddleware(thunkMiddleWare))}> <NavigatorApp /> </Provider> ) }
需要注意的是:a. middleware 是中间件的设置,它有固定的格式.
<view/> 不能包含<Navigator/>这个标签 但反过来可以
3.点击跳转的页面的设置代码
function InComponent({navigator}){ return ( <View style={[styles.fullCenter,{backgroundColor:'#CCC',flex:1}]}> <Text style={styles.size} onPress={() => navigator.pop()} >注册</Text> </View> ) } function ForgetComponent({navigator}){ return ( <View style={[styles.fullCenter,{backgroundColor:'#CCC',flex:1}]}> <Text style={styles.size} onPress={() => navigator.pop()} >忘记密码</Text> </View> ) } export default class NavigatorApp extends Component { render() { return ( <Navigator initialRoute={{name:'Main'}} renderScene={this.renderScene} navigationBar ={this.navigationBar} /> ); } renderScene(route,navigator){ if (route.name==="Main"){ return <App navigator={navigator}/> } if (route.name==="In"){ return <InComponent navigator={navigator}/> } if (route.name==="Forget"){ return <ForgetComponent navigator={navigator}/> } if (route.name==='Nav'){ return <NavComponent navigator={navigator} /> } } // configureScene (route,navigator) { // return Navigator.SceneConfigs.FloatFromBottom // } }
根据name 实现不同的跳转
第二章 跳转效果的展示
react native 中的跳转效果可以很轻松的设置,不像js 中需要设置相应的动画效果,它主要是通过这一行代码设置的
configureScene (route,navigator) { return Navigator.SceneConfigs.FloatFromBottom }
这是从下往上跳出的效果.
react native 中还有哪些跳转效果,后期继续补充
相关文章推荐
- React_Native页面跳转和Android回退键
- react-native 页面跳转与数据操作
- ReactNative页面跳转实例代码
- react-native 使用 StackNavigator 导航器跳转页面
- ReactNative页面跳转Navigator
- RN(react native)入坑指南-07,使用navigator实现页面跳转
- 第三章、ReactNative页面跳转
- 在iOS中创建React-Native页面,并跳转到原生页面
- 【React Native】页面跳转(七)
- react native 不同页面之间传参 传值 __listview列表跳转详情页 带参数 传值
- 在react-native的项目中跳转到原生iOS页面
- (React-Native 学习之六) react-native-router-flux 组件学习(页面间的跳转)
- react-native使用react-navigation进行页面跳转导航的示例
- ReactNative页面跳转Navigator
- ReactNative——页面跳转
- react-native最新的ES6基于页面跳转和传值
- React Native Navigator 的路由以及页面跳转
- React-native页面跳转传值实现
- ReactNative页面跳转Navigator
- ReactNative官网例子练习(五)——页面跳转传参