码迷,mamicode.com
首页 > 其他好文 > 详细

React Navigation基本用法

时间:2018-09-23 13:43:43      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:turn   gate   基本用法   ati   scree   info   extend   detail   hello   

/**
 * Created by apple on 2018/9/23.
 */
import React, { Component } from ‘react‘;
import {AppRegistry, View, Text,Button } from ‘react-native‘;
import { StackNavigator } from ‘react-navigation‘;

const HomeScreen = ({navigation}) => (
  <View style={{ flex: 1, alignItems: ‘center‘, justifyContent: ‘center‘ }}>
    <Text>Home Screen</Text>
      <Button title="Go to details" onPress={()=>navigation.navigate(‘Details‘)}/>
  </View>
);

const DetailsScreen = () => (
  <View style={{ flex: 1, alignItems: ‘center‘, justifyContent: ‘center‘ }}>
    <Text>Details Screen</Text>
  </View>
);


const RootNavigator = StackNavigator({
Home:{
    screen:HomeScreen,
    navigationOptions:{
        headerTitle:‘Home‘,
    },
},
Details:{
    screen:DetailsScreen,
    navigationOptions:{
        headerTitle:‘Details‘,
    },
},
});
export default class qrHello extends Component {

  render() {
    return(
        <RootNavigator/>
    );
  }
}
AppRegistry.registerComponent(‘qrHello‘, () => qrHello);

技术分享图片技术分享图片

React Navigation基本用法

标签:turn   gate   基本用法   ati   scree   info   extend   detail   hello   

原文地址:https://www.cnblogs.com/zqrios/p/9692375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!