Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync Modal system bars visibility with current activity (facebook#48516)
Summary: Fixes facebook#37801 This PR fixes the system bars visibility not being in sync as with the activity it is displayed on. Here I am also taking into account the feedback given in [this PR](facebook#36854) which was also aiming to address this issue. Unfortunately, I tried in multiple ways to get this to work by simply extending the whole system bars behaviour in the dialog with the activity system bars behaviour but found out that that solution won't work as we [currently clear the flag "FLAG_NOT_FOCUSABLE"](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt#L314) and unless we remove that line, extending the behaviour won't work. Removing that line is not an option as it would cause other side effects in the dialog itself. With the above said, I ended up doing this in a more explicit way, by checking whether the status or navigation bars are hidden in the activity and then hiding then as well in the dialog or otherwise, similar as we are currently doing with the status bars appearance. ## Changelog: [ANDROID] [FIXED] - Sync Modal system bars visibility with current activity Pull Request resolved: facebook#48516 Test Plan: In order to test this, you need to trigger any method that hides or shows the system bars using `window.insetsController`. Here a very small example of it: ```kt fun toggleSystemBarsVisibility(shouldHide: Boolean) { val window = currentActivity?.window val controller = window?.insetsController if (shouldHide) { controller?.hide(WindowInsets.Type.systemBars()) } else { controller?.show(WindowInsets.Type.systemBars()) } } ``` You can do this optionally from JS to make testing different cases easier. Below is a screen recording of how the solutions looks like: <details> <summary>Screen recording showcasing the solution in the test plan</summary> https://github.com/user-attachments/assets/c497c1cb-5e65-4f31-98cc-aefd2d7b0339 </details> Reviewed By: mdvacca, Abbondanzo Differential Revision: D67906071 Pulled By: alanleedev fbshipit-source-id: cbb2d15520d7729a9e9eafb5f5efb8d20d796c60
- Loading branch information