问题
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