File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
android/src/main/java/com/unistyles Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -87,18 +87,19 @@ class UnistylesInsets(private val reactApplicationContext: ReactApplicationConte
8787 @Suppress(" DEPRECATION" )
8888 private fun getBottomInset (baseInsets : Insets , window : Window ): Int {
8989 val translucentNavigation = hasTranslucentNavigation(window)
90+ val fullScreenMode = hasFullScreenMode(window)
9091
9192 // Android 11 has inconsistent FLAG_LAYOUT_NO_LIMITS, which alone does nothing
9293 // https://stackoverflow.com/questions/64153785/android-11-window-setdecorfitssystemwindow-doesnt-show-screen-behind-status-a
9394 if (Build .VERSION .SDK_INT == Build .VERSION_CODES .R ) {
94- if ((hasFullScreenMode(window) && translucentNavigation) || translucentNavigation) {
95+ if ((fullScreenMode && translucentNavigation) || translucentNavigation) {
9596 return baseInsets.bottom
9697 }
9798
9899 return 0
99100 }
100101
101- return if (hasTranslucentNavigation(window) || hasFullScreenMode(window) ) baseInsets.bottom else 0
102+ return if (translucentNavigation || fullScreenMode ) baseInsets.bottom else 0
102103 }
103104
104105 private fun forceLandscapeInsets (baseInsets : Insets , window : Window ): Boolean {
@@ -133,6 +134,8 @@ class UnistylesInsets(private val reactApplicationContext: ReactApplicationConte
133134 }
134135
135136 private fun hasFullScreenMode (window : Window ): Boolean {
136- return (window.attributes.flags and WindowManager .LayoutParams .FLAG_LAYOUT_NO_LIMITS ) == WindowManager .LayoutParams .FLAG_LAYOUT_NO_LIMITS
137+ val decorFitsSystemWindows = window.decorView.fitsSystemWindows
138+
139+ return (window.attributes.flags and WindowManager .LayoutParams .FLAG_LAYOUT_NO_LIMITS ) == WindowManager .LayoutParams .FLAG_LAYOUT_NO_LIMITS || ! decorFitsSystemWindows
137140 }
138141}
You can’t perform that action at this time.
0 commit comments