简体   繁体   中英

Contentoptions custom drawer navigator does work react navigation 4

Hi everybody i make a react native and expo app, previously i have a problem with the global data and my fix that use Redux, in this moment i implement redux so:

 const DrawerStack = createDrawerNavigator({ Galeria: { screen: Home, navigationOptions: { drawerLockMode: 'locked-closed', drawerIcon: ({ tintColor, focused }) => ( <Icon type='Entypo' name='camera' style={{fontSize:20, color: tintColor}} />) } }, Modificar: { screen: editprofile, navigationOptions: { drawerLockMode: 'locked-closed', drawerIcon: ({ tintColor, focused }) => ( <Icon type='FontAwesome5' name='user-edit' style={{fontSize:20, color: tintColor}} />) } } }, { drawerPosition: 'right', contentOptions: { activeTintColor:'#ffffff', inactiveTintColor: '#1f1f1f', activeBackgroundColor: '#24d060', inactiveBackgroundColor: '#ffffff', headerMode: 'none' }, contentComponent:({navigation, items, renderIcon, getLabel, onItemPress}) => ( <Provider store ={createStore(Reducers)}> <CustomDrawerContentComponent items={items} renderIcon={renderIcon} getLabel={getLabel} navigation={navigation} onItemPress={onItemPress}/> </Provider> ), })

the problem its why "contentoptions" doeswork now.. ¿Have another way to implement?

tkx 4 the answers

[SOLVED] I resolve this making another component whit my app container inside and put the provider outside

 const Aplicacion = createAppContainer( createSwitchNavigator( { AuthLoading: AuthLoadingScreen, App: DrawerStack, Login: Loginstack }, { initialRouteName: 'AuthLoading' } ) );export default class App extends React.Component { render() { return ( <Provider store={createStore(Reducers)}> <Aplicacion/> </Provider> ); } }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM