diff --git a/docs/docs/api/components/keyboard-aware-scroll-view.mdx b/docs/docs/api/components/keyboard-aware-scroll-view.mdx index 36028e8676..ea01e84872 100644 --- a/docs/docs/api/components/keyboard-aware-scroll-view.mdx +++ b/docs/docs/api/components/keyboard-aware-scroll-view.mdx @@ -115,6 +115,10 @@ If you have _**sticky elements**_ above the keyboard and want to extend the keyb This property acts as [extraScrollHeight](https://github.com/APSL/react-native-keyboard-aware-scroll-view/tree/9eee405f7b3e261faf86a0fc8e495288d91c853e?tab=readme-ov-file#props) from original [react-native-keyboard-aware-scroll-view](https://github.com/APSL/react-native-keyboard-aware-scroll-view) package. ::: +### `withKeyboardHeightPadding` + +Specifies whether to add padding equal to the keyboard height. This is useful when working with components like a bottom sheet, where the bottom sheet manages the position of the modal above the keyboard. In such cases, adding extra padding for the keyboard is unnecessary. + ## Integration with 3rd party components ### `FlatList`/`FlashList`/`SectionList` etc. diff --git a/src/components/KeyboardAwareScrollView/index.tsx b/src/components/KeyboardAwareScrollView/index.tsx index 4e2b22c0b4..07a73e5e2d 100644 --- a/src/components/KeyboardAwareScrollView/index.tsx +++ b/src/components/KeyboardAwareScrollView/index.tsx @@ -41,6 +41,8 @@ export type KeyboardAwareScrollViewProps = { enabled?: boolean; /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */ extraKeyboardSpace?: number; + /** Specifies whether to add padding equal to the keyboard height. This is useful when working with components like a bottom sheet, where the bottom sheet manages the position of the modal above the keyboard. In such cases, adding extra padding for the keyboard is unnecessary. */ + withKeyboardHeightPadding?: boolean; /** Custom component for `ScrollView`. Default is `ScrollView`. */ ScrollViewComponent?: React.ComponentType; } & ScrollViewProps; @@ -112,6 +114,7 @@ const KeyboardAwareScrollView = forwardRef< extraKeyboardSpace = 0, ScrollViewComponent = Reanimated.ScrollView, snapToOffsets, + withKeyboardHeightPadding = true, ...rest }, ref, @@ -426,7 +429,7 @@ const KeyboardAwareScrollView = forwardRef< onLayout={onScrollViewLayout} > {children} - {enabled && } + {withKeyboardHeightPadding && } ); },