react-navigation, how to close the drawer menu when clicking on the overlay?

允我心安 提交于 2020-02-05 04:22:40

问题


I am running the react-native-paper example app on the web.

For this, I have replaced in the render:

    <PaperProvider theme={theme}>
      <SafeAreaProvider>
        <PreferencesContext.Provider value={preferences}>
          <React.Fragment>
            <NavigationNativeContainer
              initialState={initialState}
              onStateChange={state =>
                AsyncStorage.setItem(PERSISTENCE_KEY, JSON.stringify(state))
              }
            >
-              {Platform.OS === 'web' ? (
-                <App />
-              ) : (
                <Drawer.Navigator drawerContent={() => <DrawerContent />}>
                  <Drawer.Screen name="Home" component={App} />
                </Drawer.Navigator>
-              )}
            </NavigationNativeContainer>
          </React.Fragment>
        </PreferencesContext.Provider>
      </SafeAreaProvider>
    </PaperProvider>

The drawer render fine and I can open it, but I can't close it, clicking on the overlay does not close it.

Is there a way to close it on the web

来源:https://stackoverflow.com/questions/59817071/react-navigation-how-to-close-the-drawer-menu-when-clicking-on-the-overlay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!