Skip to content

Commit a171cd6

Browse files
committed
update interface insets on visibility change
1 parent 8cc5e15 commit a171cd6

File tree

1 file changed

+10
-3
lines changed
  • android/src/main/java/com/swmansion/rnscreens/gamma/tabs

1 file changed

+10
-3
lines changed

android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHost.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class TabsHost(
194194
}
195195

196196
var tabBarHidden: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
197+
updateInterfaceInsets()
197198
updateNavigationMenuIfNeeded(oldValue, newValue)
198199
}
199200

@@ -495,9 +496,15 @@ class TabsHost(
495496
val newHeight = bottom - top
496497

497498
if (newHeight != oldHeight) {
498-
interfaceInsetsChangeListener?.apply {
499-
this.onInterfaceInsetsChange(EdgeInsets(0.0f, 0.0f, 0.0f, newHeight.toFloat()))
500-
}
499+
updateInterfaceInsets(newHeight)
500+
}
501+
}
502+
503+
private fun updateInterfaceInsets(newHeight: Int? = null) {
504+
val height = if (tabBarHidden) 0 else (newHeight ?: bottomNavigationView.height)
505+
506+
interfaceInsetsChangeListener?.apply {
507+
this.onInterfaceInsetsChange(EdgeInsets(0.0f, 0.0f, 0.0f, height.toFloat()))
501508
}
502509
}
503510

0 commit comments

Comments
 (0)