Skip to content
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 Modal causing glitches and crashs when using exiting animation inside it #2545

Open
YasinAkimura opened this issue Dec 2, 2024 · 9 comments
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@YasinAkimura
Copy link

YasinAkimura commented Dec 2, 2024

Description

description is not missing *test

related to

INFO: copied from my issue on expo-router repo as its still the same

  • read the crash report below and you'll see it's related to react-native-screens
  • only happens on iOS
  • you really need to use a custom header doesn't matter what kind of when it's there it'll crash if screen contains a view with exiting animation
  • seems to be new arch related did not happen before so I had to temporary remove all exiting animations and or modals in my project to continue trying out the new arch

Expected Behavior

I can dismiss the modal containing any basic headers configured in screenOptions and I should be able to use functionalities which are not marked as unstable or experimental like exiting animations on reanimated.

Whats actually happening

App and Modal screen glitches completely out after swiping it down a few times.

  • Note: You don't even have to do it as fast as I did on the provided video.

I am also sure that this bug is different from expo/expo#32874 (comment) as react-native-screens does not fix that issue and the cause is precise problem.

  • Did not happen on previous SDK eg old arch and react-native-screens < 4
  • I think that issue is related to reanimated and expo-router eg. react-navigation react-native-screens.
  • What's weird is that the cause is so specific ONLY IF you use a custom header and happen to have an exiting animation on any component in that modal it glitches out so it might be connected.
updated video
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-12-11.at.12.32.40.mp4
Bildschirmfoto 2024-12-11 um 12 51 37

crash report

[Foundation] *** Assertion failure in -[RNSScreenStackView setModalViewControllers:](),
/Users/yasinsimsek/Projects/ExpoSDK52-Modal-issue/node_modules/react-native-screens/ios/RNSScreenStack.mm:452
[CoreFoundation] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modally presented controllers are
being reshuffled, this is not allowed'
*** First throw call stack:
(
0   CoreFoundation                      0x00000001804b757c __exceptionPreprocess + 172
1   libobjc.A.dylib                     0x000000018008eda8 objc_exception_throw + 72
2   Foundation                          0x0000000180e7a398 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
3   ExpoSDK52Modalissue.debug.dylib     0x0000000108e33d8c -[RNSScreenStackView setModalViewControllers:] + 1712
4   ExpoSDK52Modalissue.debug.dylib     0x0000000108e35de0 -[RNSScreenStackView updateContainer] + 1208
5   ExpoSDK52Modalissue.debug.dylib     0x0000000108e34588 __46-[RNSScreenStackView setModalViewControllers:]_block_invoke + 220
6   ExpoSDK52Modalissue.debug.dylib     0x0000000108e34e14 __46-[RNSScreenStackView setModalViewControllers:]_block_invoke_2 + 144
7   UIKit                               0x0<…>

Steps to reproduce

  1. create a modal screen on ios
  2. put an AnimatedView with exiting animation inside the modal AND use a CUSTOM header (very important)
  3. open and close the modal using swipe / touch gestures and it'll crash on you eventually

Snack or a link to a repository

https://github.com/YasinAkimura/expo-sdk-52-modal-bug-reanimated

Screens version

4.3.0

React Native version

0.76.3

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo bare workflow

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 16 Pro (iOS 18.1)

Acknowledgements

Yes

@github-actions github-actions bot added Missing info The user didn't precise the problem enough Repro provided A reproduction with a snack or repo is provided Platform: iOS This issue is specific to iOS and removed Missing info The user didn't precise the problem enough labels Dec 2, 2024
@kkafar
Copy link
Member

kkafar commented Dec 11, 2024

Hey! Thanks for reporting. How is the crash you pasted connected to the recording? I don't see the app crash on the video you provided.

The visual glitches are observable. This looks like some bad interactions between react-native-screens and react-native-reanimated. We'll look into this.

@jgo80
Copy link

jgo80 commented Dec 11, 2024

Hey! Thanks for reporting. How is the crash you pasted connected to the recording? I don't see the app crash on the video you provided.

The visual glitches are observable. This looks like some bad interactions between react-native-screens and react-native-reanimated. We'll look into this.

I also experience this. The bad interactions between react-native-screens and react-native-reanimated also lead to strange animation effects when a modal opens on a iPhone. Strangely this only happens in "production release" not in Dev mode. Maybe you could look into that behavior as well :-) Thx!

@YasinAkimura
Copy link
Author

Hey! Thanks for reporting. How is the crash you pasted connected to the recording? I don't see the app crash on the video you provided.

The visual glitches are observable. This looks like some bad interactions between react-native-screens and react-native-reanimated. We'll look into this.

Ah yes I didn't update the recording that one you saw was with expo-go there it also crashed but after a few more tries then on the simulator it also first left a few broken fragments of the modal at the bottom of the screen with the app not responding properly and then crashing.

*updated the video and provided a screenshot above

@kkafar
Copy link
Member

kkafar commented Dec 11, 2024

Thanks for the update!

@bnemeth-parkl
Copy link

I also experience this. The bad interactions between react-native-screens and react-native-reanimated also lead to strange animation effects when a modal opens on a iPhone. Strangely this only happens in "production release" not in Dev mode. Maybe you could look into that behavior as well :-) Thx!

I have the same issue in dev mode and old architecture.

@jgo80
Copy link

jgo80 commented Dec 16, 2024

I have to revise my statement, for me it also happens both in dev mode and release mode.

@kkafar
Copy link
Member

kkafar commented Dec 17, 2024

I forwarded the issue to reanimated team

@thomasflensted
Copy link

Same thing happens for me. Hadn't seen it until I tried using my app on a physical device. Also happens after creating a build and running it on my simulator. Here's the full trace.
Screenshot 2024-12-17 at 17 13 20

@jgo80
Copy link

jgo80 commented Jan 6, 2025

I forwarded the issue to reanimated team

Is there a reference, or a new issue or will updates be posted here? Thx for looking into this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

No branches or pull requests

5 participants