zqrios

React Navigation基本用法

/**
 * 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);

发表于 2018-09-23 12:08  qrcode  阅读(100)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章:

  • 2019-06-04
  • 2021-08-03
  • 2021-08-05
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案