-
-
Notifications
You must be signed in to change notification settings - Fork 867
Description
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS, Android
What happened?
Expectation:
When using BottomSheetModal
with the containerOffset
prop, I expected that offset to.. well, offset the container. E.g. if I pass in a value like useSharedValue({top: 0, bottom: 12, left: 0, right: 0})
and trigger the keyboard open, I'd expect the sheet to be offset from the keyboard by 12.
Reality:
No offsets are applied. In taking a look at BottomSheetModal
, I see that the containerOffset
value is pulled from useBottomSheetModalInternal
. Further tracking that down, it appears BottomSheetModalProviderWrapper
sets the animatedContainerOffset directly as useSharedValue(INITIAL_CONTAINER_OFFSET)
without factoring in the user provided containerOffset
.
react-native-bottom-sheet/src/components/bottomSheetModal/BottomSheetModal.tsx
Lines 69 to 75 in 398e711
const { | |
containerHeight, | |
containerOffset, | |
mountSheet, | |
unmountSheet, | |
willUnmountSheet, | |
} = useBottomSheetModalInternal(); |
react-native-bottom-sheet/src/components/bottomSheetModalProvider/BottomSheetModalProvider.tsx
Line 28 in 398e711
const animatedContainerOffset = useSharedValue(INITIAL_CONTAINER_OFFSET); |
Reproduction steps
- Pass a value into
containerOffset
when using theBottomSheetModal
- Trigger a keyboard open by focusing on the
BottomSheetTextInput
- Note the missing offset 😢
Reproduction sample
https://snack.expo.dev/@expojojo/bottom-sheet---issue-reproduction-template
Relevant log output
No response