diff --git a/docs/docs/api/components/keyboard-aware-scroll-view.mdx b/docs/docs/api/components/keyboard-aware-scroll-view.mdx index 6d3e45778e..d13e506842 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 10e316b88c..bad281cc8c 100644 --- a/src/components/KeyboardAwareScrollView/index.tsx +++ b/src/components/KeyboardAwareScrollView/index.tsx @@ -39,6 +39,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; @@ -95,6 +97,7 @@ const KeyboardAwareScrollView = forwardRef< extraKeyboardSpace = 0, ScrollViewComponent = Reanimated.ScrollView, snapToOffsets, + withKeyboardHeightPadding = true, ...rest }, ref, @@ -383,7 +386,7 @@ const KeyboardAwareScrollView = forwardRef< onLayout={onScrollViewLayout} > {children} - + {withKeyboardHeightPadding && } ); },