Skip to content

[v4] Container offset calculation doesn't support landscape orientation #1279

@joeporpeglia

Description

@joeporpeglia

Bug

While in landscape orientation, BottomSheetContainer is using the portrait window height to compute animatedContainerOffset.bottom value. This bottom offset is then used to compute animatedKeyboardHeightInContainer, which results in extra space between the keyboard and the bottom sheet content.

Example:

  • bottom sheet content height = 375
  • keyboard height = 209
  • portrait window height = 812
  • final keyboard offset: 209 - (812 - 375) = 228

These calculations are done in BottomSheetContainer and BottomSheet.

Environment info

Library Version
@gorhom/bottom-sheet 4.4.3
react-native 0.69.7
react-native-reanimated 2.9.1
react-native-gesture-handler 2.5.0

Steps To Reproduce

  1. Render a full height bottom sheet with a bottom sheet text input
  2. Switch to landscape orientation
  3. Focus on the input

Describe what you expected to happen:

  1. Bottom offset animates to the top of the keyboard (no space between the keyboard and bottom sheet content)

Reproducible sample code

Having a hard time getting this snack to run 🤔
https://snack.expo.dev/FcJeOyJNw

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions