Ящик не открывается открывается на initialRouteName, когда я вызываю DrawerOpen - PullRequest
0 голосов
/ 29 апреля 2019

У меня есть два Nagigators 1: StackNavigator и 2: DrawerNavigator

моя реагирующая и реагирующая версии навигации

  • "реагировать-нативно": "0.55.4",
  • «реакция-навигация»: «^ 1.0.0-бета.11»,

мой корневой навигатор - это StackNavigator, из которого я вызываю DrawerNavigator.

, когдая вызываю navigation.navigate('DrawerOpen') мой экран возвращается к initialRouteName.

мой StackNavigator

import DrawerNavigatorScreen from "./src/DrawerNavigator";

const myApp = StackNavigator({
  Home: {
    screen: App,
    navigationOptions: {
      header: null
    }
  },
HomeChildData: {
        screen: DrawerNavigatorScreen,
        navigationOptions: {
          header:null,
        }
},
otp: {
    screen: otp,
    navigationOptions: ({ navigation }) => ({
      header: null
      })
  }
});

мой DrawerNavigator (/ src / DrawerNavigator)

const DrawerNavigatorScreen = DrawerNavigator(
  {
social: {
          screen: socialstack,
          navigationOptions: {
            header: null
          }
        },
profile: {
    screen: profilescreen,
    navigationOptions: ({ navigation }) => ({
      header: null
      })
  },
{
    initialRouteName: "social",
    contentOptions: {
      labelStyle: {
        alignSelf: "center",
        fontFamily: "Avenir-Light",
        fontSize: 15,
        color: "#3B3B3B"
      },
      activeTintColor: "#3B3B3B",
      activeBackgroundColor: "#ffc34d", //rgba(255,181,14,0.1)
      // inactiveTintColor: 'black',
      inactiveBackgroundColor: "#fff"
    },
});

export default DrawerNavigatorScreen 

где моя проблемапроисходит

 static navigationOptions = ({ navigation }) => ({
        header:null,
        headerTitleStyle: {
          alignSelf: 'center',
          marginLeft: margintLeftValue,
              color: '#2F2E2F',
              fontFamily: 'Avenir-Medium'
        },
        headerLeft: <TouchableOpacity onPress={() => navigation.navigate('DrawerOpen')}>
          <Image
            source={require('./../images/menu.png')}
            style={styles.drawerIcon} />
        </TouchableOpacity>,

      })

Я хочу просто открыть или переключить ящик.

1 Ответ

0 голосов
/ 29 апреля 2019

Я думаю, что вы ищете navigation.toggleDrawer();.

Вы можете прочитать больше здесь .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...