React native 在React Native中,我想添加数据来自api的动态抽屉导航项(fetch)
这是我的静态代码:React native 在React Native中,我想添加数据来自api的动态抽屉导航项(fetch),react-native,navigation-drawer,dynamic-programming,es6-promise,React Native,Navigation Drawer,Dynamic Programming,Es6 Promise,这是我的静态代码: class App extends Component { render() { return ( <MyApp /> ) } } const CustomDrawerContentComponent = (props) => ( <View style={{position:'relative', height:'100%'}}> <View style={styles.drawerH
class App extends Component {
render() {
return (
<MyApp />
)
}
}
const CustomDrawerContentComponent = (props) => (
<View style={{position:'relative', height:'100%'}}>
<View style={styles.drawerHeader}>
<ImageBackground style={styles.back} source={require('./src/Header/banner.jpg')}>
<View style={{flex:1, justifyContent:'center', alignItems:'center'}}>
<Image
style={styles.drawerImage}
source={require('./src/shirsho.png')} />
</View>
</ImageBackground>
</View>
<View>
{/* <DrawerItems {...props} /> */}
<DrawerItems {...props}
activeTintColor='#000'
activeBackgroundColor='#e3e3e3'
inactiveTintColor='rgba(0, 0, 0, .87)'
inactiveBackgroundColor='transparent'
itemsContainerStyle= {{ marginTop: 0,}}
itemStyle={{ borderBottomWidth: 2, borderBottomColor: '#eee',}}
labelStyle={{fontSize: 16,color: '#000'}}/>
</View>
<View style={{width:100,height:50, position:'absolute', bottom:0,right:30}}>
<Image
style={{width:100, marginLeft: 10,}}
source={require('./src/bdtask.png')} />
</View>
</View>
);
const MyApp = DrawerNavigator({
'হোম' : {
screen : Homepage,
},
'জাতীয়' :{
screen : NationalTab,
},
'খেলা' :{
screen : PlayTab,
},
'প্রশাসন' :{
screen : AdminTab,
},
'অর্থনীতি' :{
screen : EconomicsTab,
},
'বিনোদন' :{
screen : EntertainmentTab,
},
'শিক্ষা' :{
screen : EducationTab,
}
},{
initialRouteName: 'হোম',
drawerPosition: 'left',
contentComponent: CustomDrawerContentComponent,
drawerOpenRoute: 'DrawerOpen',
drawerCloseRoute: 'DrawerClose',
drawerToggleRoute: 'DrawerToggle'
})
export default App
类应用程序扩展组件{
render(){
返回(
)
}
}
常量CustomDrawerContentComponent=(道具)=>(
{/* */}
);
const MyApp=抽屉驱动程序({
'হোম' : {
屏幕:主页,
},
'জাতীয়' :{
屏幕:NationalTab,
},
'খেলা' :{
屏幕:PlayTab,
},
'প্রশাসন' :{
屏幕:AdminTab,
},
'অর্থনীতি' :{
屏幕:经济选项卡,
},
'বিনোদন' :{
屏幕:娱乐选项卡,
},
'শিক্ষা' :{
屏幕:教育选项卡,
}
},{
initialRouteName:'হোম',
抽屉位置:'左',
contentComponent:CustomDrawerContentComponent,
DropeRopenRoute:“DropeRopen”,
抽屉关闭路线:“抽屉关闭”,
抽屉勾选:“抽屉勾选”
})
导出默认应用程序
另外,我想将值作为道具传递给这个抽屉项目。这是屏幕截图