@@ -11,6 +11,7 @@ import android.os.Build
11
11
import android.view.ViewParent
12
12
import androidx.core.graphics.Insets
13
13
import androidx.core.view.ViewCompat
14
+ import androidx.core.view.WindowCompat
14
15
import androidx.core.view.WindowInsetsCompat
15
16
import androidx.core.view.WindowInsetsControllerCompat
16
17
import com.facebook.react.bridge.GuardedRunnable
@@ -185,6 +186,20 @@ object ScreenWindowTraits {
185
186
window.navigationBarColor = color
186
187
}
187
188
189
+ internal fun setNavigationBarTranslucent (screen : Screen , activity : Activity ? ) {
190
+ if (activity == null ) {
191
+ return
192
+ }
193
+
194
+ val window = activity.window
195
+
196
+ val screenForNavBarTranslucent = findScreenForTrait(screen, WindowTraits .NAVIGATION_BAR_TRANSLUCENT )
197
+ val translucent = screenForNavBarTranslucent?.isNavigationBarTranslucent ? : false
198
+
199
+ // Following method controls whether to display edge-to-edge content that draws behind the navigation bar
200
+ WindowCompat .setDecorFitsSystemWindows(window, ! translucent)
201
+ }
202
+
188
203
internal fun setNavigationBarHidden (screen : Screen , activity : Activity ? ) {
189
204
if (activity == null ) {
190
205
return
@@ -221,6 +236,7 @@ object ScreenWindowTraits {
221
236
}
222
237
if (didSetNavigationBarAppearance) {
223
238
setNavigationBarColor(screen, activity)
239
+ setNavigationBarTranslucent(screen, activity)
224
240
setNavigationBarHidden(screen, activity)
225
241
}
226
242
}
@@ -281,6 +297,7 @@ object ScreenWindowTraits {
281
297
WindowTraits .HIDDEN -> screen.isStatusBarHidden != null
282
298
WindowTraits .ANIMATED -> screen.isStatusBarAnimated != null
283
299
WindowTraits .NAVIGATION_BAR_COLOR -> screen.navigationBarColor != null
300
+ WindowTraits .NAVIGATION_BAR_TRANSLUCENT -> screen.isNavigationBarTranslucent != null
284
301
WindowTraits .NAVIGATION_BAR_HIDDEN -> screen.isNavigationBarHidden != null
285
302
}
286
303
}
0 commit comments