Force React Navigation返回而不重新渲染

时间:2022-06-09 16:33:28

I am using DrawerNavigator from react-navigation with Redux for my React Native app (using Expo). My Home screen contains a map (using react-native-maps). From Home screen, I navigate to a new screen.

我正在使用来自反应导航的DrawerNavigator和Redux用于我的React Native应用程序(使用Expo)。我的主屏幕包含一张地图(使用react-native-maps)。在主屏幕上,我导航到新屏幕。

Whenever I click the Back button in this new screen to go back to Home screen: dispatch(NavigationActions.back(), the Home screen always re-render. Is there any way to go back without re-rendering my Home screen and keep all the states and props unchanged?

每当我点击这个新屏幕中的Back按钮返回主屏幕:dispatch(NavigationActions.back(),主屏幕总是重新渲染。有没有办法返回而不重新渲染我的主屏幕并保留所有状态和道具不变?

1 个解决方案

#1


0  

This is an open issue I think. Try using a stacknavigator inside the drawernavigator instead.

我认为这是一个悬而未决的问题。请尝试在drawernavigator中使用stacknavigator。

#1


0  

This is an open issue I think. Try using a stacknavigator inside the drawernavigator instead.

我认为这是一个悬而未决的问题。请尝试在drawernavigator中使用stacknavigator。