ReactNative导航
来源:互联网 发布:服务器网卡聚合linux 编辑:程序博客网 时间:2024/05/16 15:11
常用的兼容的android和iOS的导航目前推荐使用StackNavigation,目前官网最新版本。旧版本的Navigation依旧可以使用。
import React from 'react';import { TouchableOpacity, AppRegistry, StyleSheet, Text, Image, View} from 'react-native';import {StackNavigator} from 'react-navigation';import { Button } from 'antd-mobile';import MyButton from './src/component/MyButton';import Setting from './src/activity/Setting';import DataSet from './src/activity/DataSet'import SecondPage from './SecondPage';class HomeScreen extends React.Component { static navigationOptions = ({navigation}) => ({ headerTitle: '设置中心', headerRight: <Text onPress={() => alert('0')} style={styles.text}>info</Text>, headerBackTitle: '返回', headerLeft: <Image source={require('./src/img/btn_back_white.png')}/>, style: {backgroundColor: '#5ebafd'} }); render() { return ( <View style={styles.container}> <Text style={styles.Button} onPress={() => this.props.navigation.navigate('ProfileNavigator')} title="资料设置" > 资料设置</Text> <Text style={styles.Button} onPress={() => this.props.navigation.navigate('AccountBind')} title="账号绑定" >账号绑定 </Text> <Text style={styles.Button} onPress={() => this.props.navigation.navigate('ProfileNavigator')} title="个性签名" >个性签名</Text> <Text style={styles.Button} onPress={() => this.props.navigation.navigate('ProfileNavigator')} title="我的账户" >我的账户</Text> <Button style={styles.Button} onPress={() => this.props.navigation.navigate('ProfileNavigator')} title="我的积分" /> </View> ); }}const untitled1 = StackNavigator({ Home: {screen: HomeScreen}, ProfileNavigator: { screen: SecondPage, }, AccountBind: { screen: DataSet, },});const Dimensions = require('Dimensions');const {width, height, scale} = Dimensions.get('window');const styles = StyleSheet.create({ button: { height: 50, width: 400, backgroundColor: '#5ebafd', color:'blue', alignItems: 'flex-start',//垂直 justifyContent: 'center',//水平 }, container: { width: width, height: height, alignItems: 'center',//垂直 justifyContent: 'center',//水平 }, text: { fontSize: 14, marginRight: 8 }});AppRegistry.registerComponent('untitled1', () => untitled1);
阅读全文
0 0
- ReactNative导航
- reactNative Navigator导航组件
- reactNative中的导航页面
- ReactNative 自定义导航栏
- ReactNative导航设计与实现
- 《ReactNative》之底部导航TabNavigator
- reactNative底部导航菜单栏实现
- ReactNative
- ReactNative
- ReactNative
- ReactNative
- ReactNative
- ReactNative导航器react-navigation的使用心得总结
- 【原创】东方耀reactnative 视频31之-开源导航组件 react-native-tab-navigator
- 【原创】东方耀reactnative 视频32之-开源导航组件 react-native-side-menu
- ReactNative 导航栏Navigator的使用及参数navigator的传递
- ReactNative学习实例(八) 第三方组件TabNavigator底部导航栏
- 原生native传参进ReactNative导航根视图StackNavigator时的参数处理方法
- JAVA学习笔记——泛型
- 原码, 反码, 补码 详解
- Java---join()方法的作用
- linux下使用CRF++结合java做的命名实体识别demo
- 删除myeclipse注册表
- ReactNative导航
- JAVAWEB开发之权限管理(一)——权限管理详解(权限管理原理以及方案)、不使用权限框架的原始授权方式详解
- stm32103R8C6 捕捉2路pwm 串口打印捕捉数据!
- Google Java编程风格指南
- Intellij IDEA 手动安装Scala 和SBT
- php笔试面试总结
- 调研TCP定时器
- STM8S103F3--PWM配置
- PHP调用百度地图API