-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Update StatusBar for Android 11+ #32975
Conversation
Base commit: 8aa8781 |
Base commit: 8aa8781 |
@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this 👍 Left some comments but overall looks good
ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java
Outdated
Show resolved
Hide resolved
ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java
Outdated
Show resolved
Hide resolved
@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java
Show resolved
Hide resolved
@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @ieatfood in 50c8e97. When will my fix make it into a release? | Upcoming Releases |
Summary: In #32975 I implemented the new `insetsController#setSystemBarsAppearance` interface, but I found that on Android 11 (API 30) it doesn't appear to work which I missed in earlier testing. It works correctly on Android 12 and the deprecated `systemUiVisibility` interface still works fine on Android 11, so I'm having Android 11 use the deprecated mechanism. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix StatusBar on Android API 30 Pull Request resolved: #33058 Test Plan: Tested in `rn-tester` on simulators using Android 9, 10, 11, 12, and on an Android 9 device. Reviewed By: lunaleaps Differential Revision: D34050025 Pulled By: ShikaSD fbshipit-source-id: ad80fae1446aca368b09df810785a1cc38383450
Summary: Android 11 (API 30) introduced a new interface for changing the appearance of the status bars with [`WindowInsetsController#setSystemBarsAppearance`](https://developer.android.com/reference/kotlin/android/view/WindowInsetsController#setsystembarsappearance) and deprecated using the `WindowManager#systemUiVisibility` properties. Apparently, once you call `setSystemBarsAppearance` Android will no longer respect `systemUiVisibility` and if anyone, such as the Android 12 Splash Screen library, happens to call it, it will break status bars. This PR augments the RN StatusBarModule to use the new interface on Android 11+. Also updated the rn-tester app, see video. https://user-images.githubusercontent.com/1124321/151321561-8202e237-cf7d-45ce-b957-18b5bafd17c4.mov ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Changed] - Use new StatusBar API on Android 11 (API 30)+ Pull Request resolved: facebook#32975 Reviewed By: cortinico Differential Revision: D33814853 Pulled By: ShikaSD fbshipit-source-id: c0f2651015dddb4871a3e3b26642f76a46da2a76
Summary: Android 11 (API 30) introduced a new interface for changing the appearance of the status bars with [`WindowInsetsController#setSystemBarsAppearance`](https://developer.android.com/reference/kotlin/android/view/WindowInsetsController#setsystembarsappearance) and deprecated using the `WindowManager#systemUiVisibility` properties. Apparently, once you call `setSystemBarsAppearance` Android will no longer respect `systemUiVisibility` and if anyone, such as the Android 12 Splash Screen library, happens to call it, it will break status bars. This PR augments the RN StatusBarModule to use the new interface on Android 11+. Also updated the rn-tester app, see video. https://user-images.githubusercontent.com/1124321/151321561-8202e237-cf7d-45ce-b957-18b5bafd17c4.mov ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Changed] - Use new StatusBar API on Android 11 (API 30)+ Pull Request resolved: facebook#32975 Reviewed By: cortinico Differential Revision: D33814853 Pulled By: ShikaSD fbshipit-source-id: c0f2651015dddb4871a3e3b26642f76a46da2a76
Summary: In facebook#32975 I implemented the new `insetsController#setSystemBarsAppearance` interface, but I found that on Android 11 (API 30) it doesn't appear to work which I missed in earlier testing. It works correctly on Android 12 and the deprecated `systemUiVisibility` interface still works fine on Android 11, so I'm having Android 11 use the deprecated mechanism. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix StatusBar on Android API 30 Pull Request resolved: facebook#33058 Test Plan: Tested in `rn-tester` on simulators using Android 9, 10, 11, 12, and on an Android 9 device. Reviewed By: lunaleaps Differential Revision: D34050025 Pulled By: ShikaSD fbshipit-source-id: ad80fae1446aca368b09df810785a1cc38383450
Summary
Android 11 (API 30) introduced a new interface for changing the appearance of the status bars with
WindowInsetsController#setSystemBarsAppearance
and deprecated using theWindowManager#systemUiVisibility
properties.Apparently, once you call
setSystemBarsAppearance
Android will no longer respectsystemUiVisibility
and if anyone, such as the Android 12 Splash Screen library, happens to call it, it will break status bars.This PR augments the RN StatusBarModule to use the new interface on Android 11+.
Also updated the rn-tester app, see video.
Screen.Recording.2022-01-27.at.12.31.58.AM.mov
Changelog
[Android] [Changed] - Use new StatusBar API on Android 11 (API 30)+
Test Plan