|
| 1 | +# @alkafinance/react-native-keyboard-aware-scroll-view |
| 2 | + |
| 3 | +[](https://www.npmjs.org/package/@alkafinance/react-native-keyboard-aware-scroll-view) |
| 4 | +[](https://circleci.com/gh/react-native-community/workflows/react-native-netinfo/tree/master) |
| 5 | + |
| 6 | + |
| 7 | +[](https://github.com/prettier/prettier) |
| 8 | + |
| 9 | +A collection of React Native components that respond to the visibility of on-screen keyboard and automatically scroll to the currently focused text input. |
| 10 | + |
| 11 | +<img src="./.github/demo.gif" width="auto" height="640"> |
| 12 | + |
| 13 | +## Getting started |
| 14 | + |
| 15 | +`$ npm install @alkafinance/react-native-keyboard-aware-scroll-view --save` |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +Import `KeyboardAwareScrollView`, `KeyboardAwareFlatList`, or `KeyboardAwareSectionList` and use them like the regular `ScrollView`, `FlatList` or `SectionList` components from React Native core. Internally, these components are wrapped in another custom component called `KeyboardAwareContainer`, which is also exported for advanced use cases. |
| 20 | + |
| 21 | +```javascript |
| 22 | +import {KeyboardAwareScrollView} from '@alkafinance/react-native-keyboard-aware-scroll-view'; |
| 23 | + |
| 24 | +function MyComponent() { |
| 25 | + return ( |
| 26 | + <KeyboardAwareScrollView> |
| 27 | + <TextInput /> |
| 28 | + <TextInput /> |
| 29 | + <Button /> |
| 30 | + </TouchableHighlight> |
| 31 | + ) |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +## API |
| 36 | + |
| 37 | +In addition to the regular `ScrollView`, `FlatList` or `SectionList` props, you can also provide the following props for extra customization: |
| 38 | + |
| 39 | +### Props |
| 40 | + |
| 41 | +- [`stickyHeader`](#stickyHeader) |
| 42 | +- [`stickyFooter`](#stickyFooter) |
| 43 | +- [`containerStyle`](#containerStyle) |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +# Reference |
| 48 | + |
| 49 | +## Props |
| 50 | + |
| 51 | +### `stickyHeader` |
| 52 | + |
| 53 | +Used to display a persisted view above the scrollable content. |
| 54 | + |
| 55 | +| Type | Required | |
| 56 | +| ----------------- | -------- | |
| 57 | +| `React.ReactNode` | No | |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +### `stickyFooter` |
| 62 | + |
| 63 | +Used to display a persisted view under the scrollable content. Sticky footer is always shown above the keyboard, which could be the desired behaviour for a submit button. |
| 64 | + |
| 65 | +| Type | Required | |
| 66 | +| ----------------- | -------- | |
| 67 | +| `React.ReactNode` | No | |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### `containerStyle` |
| 72 | + |
| 73 | +Used to style the container component. |
| 74 | + |
| 75 | +| Type | Required | |
| 76 | +| ---------------------- | -------- | |
| 77 | +| `StyleProp<ViewStyle>` | No | |
| 78 | + |
| 79 | +## License |
| 80 | + |
| 81 | +[MIT License](./LICENSE) © Alka, Inc |
0 commit comments