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.
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS, Android
What happened?
Expectation:
When using
BottomSheetModal
with thecontainerOffset
prop, I expected that offset to.. well, offset the container. E.g. if I pass in a value likeuseSharedValue({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 thecontainerOffset
value is pulled fromuseBottomSheetModalInternal
. Further tracking that down, it appearsBottomSheetModalProviderWrapper
sets the animatedContainerOffset directly asuseSharedValue(INITIAL_CONTAINER_OFFSET)
without factoring in the user providedcontainerOffset
.https://github.com/gorhom/react-native-bottom-sheet/blob/398e7114d7577c37361e6e24c9180b13de2c08ed/src/components/bottomSheetModal/BottomSheetModal.tsx#L69-L75 https://github.com/gorhom/react-native-bottom-sheet/blob/398e7114d7577c37361e6e24c9180b13de2c08ed/src/components/bottomSheetModalProvider/BottomSheetModalProvider.tsx#L28
Reproduction steps
containerOffset
when using theBottomSheetModal
BottomSheetTextInput
Reproduction sample
https://snack.expo.dev/@expojojo/bottom-sheet---issue-reproduction-template
Relevant log output
No response