react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.47k stars 5.01k forks source link

native component can not be dealloc by use react-navigation #11411

Closed OrrHsiao closed 1 year ago

OrrHsiao commented 1 year ago

Current behavior

a reactnative view with react-navigation, this reactnative view have a Native component, when reactnative viewcontroller pop to native viewcontroller, the native component can not be dealloc

Expected behavior

RCTView can be dealloc

Reproduction

Please see current behavior

Platform

Packages

Environment

package version
@react-navigation/native
@react-navigation/bottom-tabs 6.5.7
@react-navigation/drawer 2.7.2
@react-navigation/material-top-tabs
@react-navigation/stack 2.10.4
@react-navigation/native-stack
react-native-safe-area-context 4.5.0
react-native-screens 3.20.0
react-native-gesture-handler 2.9.0
react-native-reanimated 3.2.0
react-native-tab-view
react-native-pager-view
react-native
expo
node v18.11.0
npm or yarn npm
github-actions[bot] commented 1 year ago

Hey @OrrHsiao! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

github-actions[bot] commented 1 year ago

Couldn't find version numbers for the following packages in the issue:

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

OrrHsiao commented 1 year ago

when reactnative viewcontroller pop to reactnative viewcontroller, the native component can be dealloc,but when reactnative pop to nativew, it can not be dealloc, help me plz

OrrHsiao commented 1 year ago

https://github.com/OrrHsiao/ReactNativeDemo You can use this example to reproduce the problem Repeat step

  1. Open demo and run iOS programs.
  2. Click the "push" button to jump to the RN page.
  3. Click "jump hello word" to go to the Page1 component page.
  4. Click on the navigation bar return arrow "<" Close the RN page. Observe that XATestView does not execute the dealloc function.
OrrHsiao commented 1 year ago

we have found the reason:https://github.com/software-mansion/react-native-screens/issues/1754