我创建了一个常量const drawbleItems
来托管我的应用程序中我想要的可绘制导航菜单的屏幕,
如何在我的反应应用程序中显示它?
这是我的代码:
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import { DrawerNavigator } from 'react-navigation';
import {
Platform,
StyleSheet,
Text,
View
} from 'react-native';
import TreeBar from './UI/TreeBar';
import PieBar from './UI/PieBar';
import StockBar from './UI/StockBar';
import SmoothBar from './UI/SmoothBar';
import ScatterBar from './UI/ScatterBar';
import RadarChart from './UI/RadarChart';
const drawbleItems = DrawerNavigator({
Tree: {
screen: TreeBar,
},
Pie: {
screen: PieBar,
},
Stock: {
screen: StockBar,
},
Smooth: {
screen: SmoothBar,
},
Scatter: {
screen: ScatterBar,
},
Radar: {
screen: RadarChart,
},
});
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Hi
</Text>
<Text style={styles.instructions}>
To get started, edit App.js
</Text>
<Text style={styles.instructions}>
{instructions}
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});