-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ios][bug] views are not unmounting / deallocating when closing/popping/removing screens #1379
Comments
I did some further checks and the issue is even happening without a bottom tab bar. Cameras and Videos keep running when you pop a screen. I will no try to downgrade RNS to check if the newly fabric update is causing some trouble here or not. EDIT: |
@WoLewicki @kacperkapusciak after 3 days of searching, I found the issue. https://github.com/hirbod/react-reanimatad-layoutanimation-bug/tree/main The issue is coming from react-native-reanimated's This issue has a big impact, since it prevents any unmounted screen from being deallocated (I've checked that with XCode breakpoints in certain packages, like expo-av). A single Here is also a demonstrative video. Please watch with Audio Bildschirmaufnahme.2022-04-01.um.02.10.50.mp4 |
Here is a cross-link to REA, since I am not sure what is causing the problem: |
Hope this bug gets solved. |
@Hady207 it looks like this issue is due to reanimated. There is already a draft PR for that, but lets see if there is really no connection between both issues |
Since this problem is caused exclusively by the bug in |
@WoLewicki Since react-native-screens relies upon react-native-reanimated (and not via a peer dependency), I think it's worth keeping this open to track. Looks like there's a new version of react-native-reanimated which may fix this issue, but what would be the upgrade path for react-native-screens? |
Reanimated v3 has indeed fixed this issue. |
I am not sure if there is anything to do in |
hi bro, I tried different versions of Reanimated but it didn't fix the problem. Switching from @react-navigation/native-stack to @react-navigation/stack solved my problem. Thank you for everything |
Description
I think there is a deeper problem with nested navigators and react native screens. Before I invest too much effort in an example, I would like to describe the problem in the hope that my explanations will trigger a sparking idea.
I have noticed that with deeply nested navigators (bottom tabs in a navigator and other navigators in the upper and lower hierarchy), it seems that for individual screens or stacks that are above the tabs in the hierarchy, screens that have actually been unmounted (goBack/pop) are still active somehow.
This can be detected with react-native-vision-camera, react-native-video and expo-av.
For example, I did several tests with card, modal, fullScreenModal etc (single screen, but which opens above my bottom tabs navigator) and when I go back (with back button, with goBack() or pop()), the allocated memory is not freed, the camera remains active (green light indicator) and with react-native-video and expo-av even the sound continues to play.
I have tried for several hours to fix the problem. At first I thought the problem might be with enableFreeze, but it wasn't. As soon as native-stack or js-stack is used with enableScreens(true), this phenomenon occurs that unmounted components like expo-av or the camera remain active.
I have already done various tests with useEffects cleanup methods, I also get the feedback that my screen has been unmounted, but it is not true as it seems to still remain in native land. Not sure if your attach/detach logic has a flaw here.
What could be the problem? Any ideas?
Screenshots
Please watch this video. Have a look at RAM + AUDIO (music keeps playing even though the screen is gone)
After that, I am opening the camera. Please have a look at the green light indicator at the top and the RAM. Neither RAM is freed nor does the music stop nor does the camera unmount.
RPReplay_Final1648726480.mp4
Steps To Reproduce
Expected behavior
Should remove element fully from the system and actually unmount that screen.
Actual behavior
Does somehow not fully unmount it. Cameras will be mounted (not always, but most of the times) and video players will keep playing audio, even when they have been unmounted.
Reproduction
https://github.com/hirbod/react-reanimatad-layoutanimation-bug
Platform
Workflow
I am using a custom dev client.
Package versions
The text was updated successfully, but these errors were encountered: