forked from kirillzyusko/react-native-keyboard-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbindings.ts
More file actions
93 lines (90 loc) · 3.46 KB
/
Copy pathbindings.ts
File metadata and controls
93 lines (90 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { View } from "react-native";
import type {
ClippingScrollViewProps,
FocusedInputEventsModule,
KeyboardBackgroundViewProps,
KeyboardControllerNativeModule,
KeyboardControllerProps,
KeyboardEventsModule,
KeyboardExtenderProps,
KeyboardGestureAreaProps,
OverKeyboardViewProps,
WindowDimensionsEventsModule,
} from "./types";
import type { EmitterSubscription } from "react-native";
const NOOP = () => {};
export const KeyboardControllerNative: KeyboardControllerNativeModule = {
setDefaultMode: NOOP,
setInputMode: NOOP,
preload: NOOP,
dismiss: NOOP,
setFocusTo: NOOP,
windowPosition: () => Promise.resolve({ x: 0, y: 0, width: 0, height: 0 }),
addListener: NOOP,
removeListeners: NOOP,
};
/**
* An event emitter that provides a way to subscribe to next keyboard events:
* - `keyboardWillShow`;
* - `keyboardDidShow`;
* - `keyboardWillHide`;
* - `keyboardDidHide`.
*
* Use `addListener` function to add your event listener for a specific keyboard event.
*/
export const KeyboardEvents: KeyboardEventsModule = {
addListener: () => ({ remove: NOOP } as EmitterSubscription),
};
/**
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
* Use it with cautious.
*/
export const FocusedInputEvents: FocusedInputEventsModule = {
addListener: () => ({ remove: NOOP } as EmitterSubscription),
};
export const WindowDimensionsEvents: WindowDimensionsEventsModule = {
addListener: () => ({ remove: NOOP } as EmitterSubscription),
};
/**
* A view that sends events whenever keyboard or focused events are happening.
*
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.
*/
export const KeyboardControllerView =
View as unknown as React.FC<KeyboardControllerProps>;
export const KeyboardControllerViewCommands = {
synchronizeFocusedInputLayout: (
_ref: React.Component<KeyboardControllerProps> | null,
) => {},
};
/**
* A view that defines a region on the screen, where gestures will control the keyboard position.
*
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.
*/
export const KeyboardGestureArea =
View as unknown as React.FC<KeyboardGestureAreaProps>;
export const RCTOverKeyboardView =
View as unknown as React.FC<OverKeyboardViewProps>;
/**
* A view that matches keyboard background.
*
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-background-view|Documentation} page for more details.
*/
export const KeyboardBackgroundView =
View as unknown as React.FC<KeyboardBackgroundViewProps>;
/**
* A container that will embed its children into the keyboard
* and will always show them above the keyboard.
*
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-extender|Documentation} page for more details.
*/
export const RCTKeyboardExtender =
View as unknown as React.FC<KeyboardExtenderProps>;
/**
* A decorator that will clip the content of the `ScrollView`. It helps to simulate `contentInset` behavior on Android.
* Supports only `bottom` property (`paddingBottom` is not supported property of `ScrollView.style`).
* Using this component we can modify bottom inset without having a fake view.
*/
export const ClippingScrollView =
View as unknown as React.FC<ClippingScrollViewProps>;