Skip to content

Commit

Permalink
Merge pull request #232 from jpudysz/feature/keyboard-insets
Browse files Browse the repository at this point in the history
feat: improve bottom insets
  • Loading branch information
jpudysz authored Jul 5, 2024
2 parents 85ad23b + 1b98797 commit 947133b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion android/src/main/java/com/unistyles/Platform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ class Platform(private val reactApplicationContext: ReactApplicationContext) {

val insets = insetsCompat.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())

this.insets = Insets(statusBarTopInset, insets.bottom, insets.left, insets.right)
// reports inset bottom as 0 when keyboard is visible
// otherwise it will break other libraries that manipulates bottom insets
val imeInsets = insetsCompat.getInsets(WindowInsetsCompat.Type.ime())
val insetsBottom = if (imeInsets.bottom > 0) 0 else insets.bottom

this.insets = Insets(statusBarTopInset, insetsBottom, insets.left, insets.right)
}

fun getInsets(): Insets {
Expand Down

0 comments on commit 947133b

Please sign in to comment.