Skip to content

Conversation

@hsource
Copy link
Contributor

@hsource hsource commented Oct 13, 2025

Motivation

Users of our app (that had recently switched to react-native-multiple-modals) noticed that the modal had the wrong sizes in some cases:

  1. When starting the app in landscape, the orientation was incorrect
  2. When opening the modal after rotating, the orientation would also become incorrect

Investigation/root cause

  1. Right now, we call RCTScreenSize and invert the size if it's in landscape. This isn't needed and causes the initial dimensions to be inverted because RCTScreenSize already takes into account the orientation
  2. For unknown reasons, RNTModalViewController's viewDidAppear never seems to get called on Paper, which makes it so that shouldTrackRotationChange never gets set to true. This also seems not to be really needed and isn't used in the React Native equivalent RCTModalHostViewController.m

Fix

  1. Just call RCTScreenSize without processing the output, since it already accounts for screen orientation
  2. Get rid of shouldTrackRotationChange

Testing

Note: I only tested on Paper since our app is on an old, non-Fabric RN version

In the before version, the scrim doesn't cover the correct part of the screen because the shadow view width is incorrect.

Before After
Before After

@paufau
Copy link
Owner

paufau commented Oct 14, 2025

Thanks for noticing the issue and submitting a pull request!

It will take some time for me to test it on the new architecture and other devices.

@paufau
Copy link
Owner

paufau commented Nov 4, 2025

Sorry for the long delay. The fix works perfectly on Fabric!
So, I'm going to merge it and release asap.

Thank you a lot!

@paufau paufau merged commit 1b41959 into paufau:main Nov 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants