react-native-screens: transparentModal doesn't appear on the screen although it is rendered after upgrading from react-native 0.72.5 to 0.74.1 on Android 14
Description
I use transparentModal to show overlays at many different places in the app. I have been using this for quite some time in my production app. I recently updated from react-native 0.72.5 to 0.74.1. After updating, some of the transparentModals are not shown even though they are rendered. Please see the screenshots below:
As you can see above, RequestPermissionsScreen is rendered and be selected on the Element Inspector but it is not visible at all. If I add a timeout before rendering the screen, the overlay is seen as shown below:
When the screen is not visible as shown in screenshot 1, if I tap where the buttons are in screen 2, the onPress handler is invoked. If I change the presentation style to anything other than transparentModal, then screen appears fine but it no longer appears as an overlay now.
Also, it only happens on Android 13 and Android 14. We tried on Android 12 and lower and the screen appears okay.
What could possibly cause the screen to not display like this. I have also tried disabling animations and adding a timing animation but none of those helped either. I am currently stuck on this and I am not able to release any new features for Android. Please suggest what could be wrong here.
I have earlier reported this issue at https://github.com/react-navigation/react-navigation/issues/12009 but I was suggested to post it here also.
Steps to reproduce
Although I tried reproducing it in a snack but I didn’t see it in the snack. I am not using Expo in my app but the snack uses Expo, so I am not sure if that is the reason I don’t see problem in the snack. I am sharing a link to the snack nonetheless.
Snack or a link to a repository
https://snack.expo.dev/@varungupta85/react-navigation-transparentmodal-issue
Screens version
3.31.1
React Native version
0.74.1
Platforms
Android
JavaScript runtime
JSC
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
Android emulator
Device model
Samsung Galaxy S24
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 31 (14 by maintainers)
@kkafar After I update react-native-screens to 4.10.0. This issue is gone. Thank you so much for your help and support!
Yep, I’ll look into it in few hours. Thanks for bumping me here
Edit: won’t be able to do it today, deferring to Monday.
I’ll try to look into when I have a moment
Update: haven’t looked into it yet. Will be able to do it todays evening / tomorrow
Hi @kkafar, I have remade a repository that uses React Navigation v7 to reproduce issue instead of Expo Router. I hope this makes it clearer to locate the issue. It is running react-native-screens 4.7.0. invisible-modal
Thanks. The fix is available for everyone with 4.6.0-beta.1 version. I’ll release stable version by the end of the week (that is at least current plan)
@kkafar I can confirm, seems to be working fine.
@kkafar, I rebuilt my app and tested it. It worked. Thank you so much for your help and support!
Thanks @clspeter. I’ll try to look into it by the end of the week
Thanks for looking into this. I’m still currently seeing the same issue on android emulator using the 7.0.0-r.c… The first time I open the transparentModal when switching to the tab, it opens in the background. If I dismiss, it loads correctly. I’ll continue to check some of our implementation.
@steven-isbell I can confirm I was able to reproduce the issue using your snack and the versions you specified in related navigation issue.
Bumping the navigation packages versions to
7.0.0-rcsolves the issue for me. Let me know if that works for you.Make sure to follow upgrading guide when bumping.
https://github.com/user-attachments/assets/db169e65-6abd-47c3-8199-74a16d7f3dc0
https://github.com/user-attachments/assets/becc66bb-c312-470e-a2e3-8d9a501cbcb9
@steven-isbell thanks for submitting the message, no need to open a new issue. I’m going to re-open this one and look into it.
I created another reproduction of this issue with this snack
@alduzy let me know if I should open a new issue
The gist of the issue is that if a transparentModal is nested in a tab stack, it will open behind the parent screen in the stack instead of on top of it if you go to another tab and back to the tab that navigates to the modal before opening the modal.
If you open the modal before you navigate to another tab, or you set
unmountOnBlur: trueon the options for TabStack Screen that holds the nested navigator so that it remounts every time you go back to the tab, it works fine.This issue only exists on android.
reproducible steps are
Open Modal Screenopen modal screenbefore switching tabs