Skip to content

Commit 6ffa49d

Browse files
authored
fix: export component props (#424)
## 📜 Description Exported props for all components, including: - `KeyboardAvoidingView`; - `KeyboardStcikyView`; - `KeyboardAwareScrollView`; - `KeyboardToolbar`. ## 💡 Motivation and Context Sometimes people need to wrap components into additional methods (for example `createBottomSheetScrollableComponent`) and it requires to know which props component is consuming. Before devs had to copy/paste the props, but this is not a good from code duplication and consistency perspective. So in this PR I'm exporting props for remaining components (`KeyboardToolbarProps` were already exported). ## 📢 Changelog ### JS - export props for `KeyboardAvoidingView`; - export props for `KeyboardStickyView`; - export props for `KeyboardAwareScrollView`; ## 🤔 How Has This Been Tested? Tested via CI 😁 ## 📸 Screenshots (if appropriate): <img width="910" alt="image" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/cb823852-6d41-484d-8afe-3dc8900f2172"> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent a3538f9 commit 6ffa49d

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

src/components/KeyboardAvoidingView/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useKeyboardAnimation } from "./hooks";
1212

1313
import type { LayoutRectangle, ViewProps } from "react-native";
1414

15-
type Props = {
15+
export type KeyboardAvoidingViewProps = {
1616
/**
1717
* Specify how to react to the presence of the keyboard.
1818
*/
@@ -47,7 +47,10 @@ const defaultLayout: LayoutRectangle = {
4747
* View that moves out of the way when the keyboard appears by automatically
4848
* adjusting its height, position, or bottom padding.
4949
*/
50-
const KeyboardAvoidingView = forwardRef<View, React.PropsWithChildren<Props>>(
50+
const KeyboardAvoidingView = forwardRef<
51+
View,
52+
React.PropsWithChildren<KeyboardAvoidingViewProps>
53+
>(
5154
(
5255
{
5356
behavior,

src/components/KeyboardAwareScrollView/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import type {
2424
} from "react-native";
2525
import type { FocusedInputLayoutChangedEvent } from "react-native-keyboard-controller";
2626

27-
type KeyboardAwareScrollViewProps = {
27+
export type KeyboardAwareScrollViewProps = {
2828
/** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */
2929
bottomOffset?: number;
3030
/** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */

src/components/KeyboardStickyView/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useReanimatedKeyboardAnimation } from "react-native-keyboard-controller
88

99
import type { View, ViewProps } from "react-native";
1010

11-
type KeyboardStickyViewProps = {
11+
export type KeyboardStickyViewProps = {
1212
/**
1313
* Specify additional offset to the view for given keyboard state.
1414
*/

src/components/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ export {
55
default as KeyboardToolbar,
66
DefaultKeyboardToolbarTheme,
77
} from "./KeyboardToolbar";
8+
export type { KeyboardAvoidingViewProps } from "./KeyboardAvoidingView";
9+
export type { KeyboardStickyViewProps } from "./KeyboardStickyView";
10+
export type { KeyboardAwareScrollViewProps } from "./KeyboardAwareScrollView";
811
export type { KeyboardToolbarProps } from "./KeyboardToolbar";

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ export {
1313
KeyboardToolbar,
1414
DefaultKeyboardToolbarTheme,
1515
} from "./components";
16-
export type { KeyboardToolbarProps } from "./components";
16+
export type {
17+
KeyboardAvoidingViewProps,
18+
KeyboardStickyViewProps,
19+
KeyboardAwareScrollViewProps,
20+
KeyboardToolbarProps,
21+
} from "./components";

0 commit comments

Comments
 (0)