Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/docs/api/components/keyboard-aware-scroll-view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/components/KeyboardAwareScrollView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
} & ScrollViewProps;
Expand Down Expand Up @@ -112,6 +114,7 @@ const KeyboardAwareScrollView = forwardRef<
extraKeyboardSpace = 0,
ScrollViewComponent = Reanimated.ScrollView,
snapToOffsets,
withKeyboardHeightPadding = true,
...rest
},
ref,
Expand Down Expand Up @@ -426,7 +429,7 @@ const KeyboardAwareScrollView = forwardRef<
onLayout={onScrollViewLayout}
>
{children}
{enabled && <Reanimated.View style={view} />}
{withKeyboardHeightPadding && <Reanimated.View style={view} />}
</ScrollViewComponent>
);
},
Expand Down