React Navigation基本用法 - qrcode

react

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) 

编辑 

收藏 

举报

 

以上是 React Navigation基本用法 - qrcode 的全部内容, 来源链接: utcz.com/z/382770.html

回到顶部