美文网首页
react-navigation使用

react-navigation使用

作者: 啊世ka | 来源:发表于2018-12-19 11:54 被阅读14次

1.安装

npm install --save react-navigation
npm link

2.导入模块

import { createAppContainer , createStackNavigator } from 'react-navigation'

3.写一个容器

const MeList = createStackNavigator({
Me:Me
});

const AppContainer = createAppContainer(MeList)

export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<AppContainer />
</View>
);
}
}

export default class Me extends Component {
static navigationOptions = {
title:'Me'
};
render() {
return (
<View style={styles.container}>
<Text>欢迎进入ME</Text>
</View>
);
}
}

相关文章

网友评论

      本文标题:react-navigation使用

      本文链接:https://www.haomeiwen.com/subject/headkqtx.html