react-native-keyboard-controller 1.10.0 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/EditText.kt +31 -1
- package/ios/.clang-format +30 -30
- package/ios/.swiftlint.yml +1 -1
- package/ios/observers/FocusedInputObserver.swift +1 -0
- package/ios/views/KeyboardControllerViewManager.swift +12 -2
- package/jest/index.js +14 -4
- package/lib/commonjs/animated.js +19 -19
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +6 -6
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +19 -5
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +12 -7
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +10 -8
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +2 -2
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js +9 -5
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/hooks/useKeyboardInterpolation.js +88 -0
- package/lib/commonjs/components/hooks/useKeyboardInterpolation.js.map +1 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +1 -1
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/monkey-patch.android.js +1 -1
- package/lib/commonjs/monkey-patch.android.js.map +1 -1
- package/lib/commonjs/monkey-patch.js.map +1 -1
- package/lib/commonjs/reanimated.js.map +1 -1
- package/lib/commonjs/reanimated.native.js +12 -12
- package/lib/commonjs/reanimated.native.js.map +1 -1
- package/lib/commonjs/replicas.js +5 -5
- package/lib/commonjs/replicas.js.map +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -2
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/NativeKeyboardController.js +1 -1
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +1 -1
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/animated.js +27 -27
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js +1 -1
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +7 -7
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/hooks.js +19 -5
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +15 -11
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +16 -14
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +8 -8
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/utils.js +2 -2
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js +9 -6
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/hooks/useKeyboardInterpolation.js +81 -0
- package/lib/module/components/hooks/useKeyboardInterpolation.js.map +1 -0
- package/lib/module/components/index.js +3 -3
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/context.js +2 -2
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks.js +5 -5
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +8 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +4 -4
- package/lib/module/internal.js.map +1 -1
- package/lib/module/monkey-patch.android.js +2 -2
- package/lib/module/monkey-patch.android.js.map +1 -1
- package/lib/module/monkey-patch.js.map +1 -1
- package/lib/module/reanimated.js.map +1 -1
- package/lib/module/reanimated.native.js +13 -13
- package/lib/module/reanimated.native.js.map +1 -1
- package/lib/module/replicas.js +11 -11
- package/lib/module/replicas.js.map +1 -1
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +2 -2
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +3 -3
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/module/specs/NativeKeyboardController.js +2 -2
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/specs/NativeStatusBarManagerCompat.js +2 -2
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/animated.d.ts +1 -1
- package/lib/typescript/bindings.d.ts +1 -1
- package/lib/typescript/bindings.native.d.ts +1 -1
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +4 -4
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +2 -2
- package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +1 -1
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +2 -2
- package/lib/typescript/components/hooks/useKeyboardInterpolation.d.ts +20 -0
- package/lib/typescript/components/index.d.ts +3 -3
- package/lib/typescript/context.d.ts +4 -4
- package/lib/typescript/hooks.d.ts +3 -3
- package/lib/typescript/index.d.ts +8 -8
- package/lib/typescript/internal.d.ts +2 -2
- package/lib/typescript/reanimated.d.ts +1 -1
- package/lib/typescript/reanimated.native.d.ts +1 -1
- package/lib/typescript/replicas.d.ts +1 -1
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +3 -3
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +4 -4
- package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -1
- package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +1 -1
- package/lib/typescript/types.d.ts +3 -3
- package/package.json +8 -10
- package/src/animated.tsx +39 -39
- package/src/bindings.native.ts +11 -11
- package/src/bindings.ts +3 -3
- package/src/components/KeyboardAvoidingView/hooks.ts +20 -6
- package/src/components/KeyboardAvoidingView/index.tsx +25 -24
- package/src/components/KeyboardAwareScrollView/index.tsx +29 -25
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +13 -13
- package/src/components/KeyboardAwareScrollView/utils.ts +3 -3
- package/src/components/KeyboardStickyView/index.tsx +12 -12
- package/src/components/hooks/useKeyboardInterpolation.ts +108 -0
- package/src/components/index.ts +3 -3
- package/src/context.ts +7 -7
- package/src/hooks.ts +12 -12
- package/src/index.ts +8 -8
- package/src/internal.ts +9 -9
- package/src/monkey-patch.android.ts +2 -2
- package/src/reanimated.native.ts +20 -20
- package/src/reanimated.ts +1 -1
- package/src/replicas.ts +16 -16
- package/src/specs/KeyboardControllerViewNativeComponent.ts +5 -5
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +7 -7
- package/src/specs/NativeKeyboardController.ts +3 -3
- package/src/specs/NativeStatusBarManagerCompat.ts +3 -3
- package/src/types.ts +21 -21
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from "./bindings";
|
|
2
|
+
export * from "./animated";
|
|
3
|
+
export * from "./replicas";
|
|
4
|
+
export * from "./context";
|
|
5
|
+
export * from "./hooks";
|
|
6
|
+
export * from "./constants";
|
|
7
|
+
export * from "./types";
|
|
8
8
|
|
|
9
9
|
export {
|
|
10
10
|
KeyboardAvoidingView,
|
|
11
11
|
KeyboardStickyView,
|
|
12
12
|
KeyboardAwareScrollView,
|
|
13
|
-
} from
|
|
13
|
+
} from "./components";
|
package/src/internal.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useCallback, useRef } from
|
|
2
|
-
import { Animated } from
|
|
3
|
-
import { useSharedValue } from
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
import { useSharedValue } from "react-native-reanimated";
|
|
4
4
|
|
|
5
|
-
import type { Handlers } from
|
|
5
|
+
import type { Handlers } from "./types";
|
|
6
6
|
|
|
7
7
|
type UntypedHandler = Record<string, (event: never) => void>;
|
|
8
8
|
type SharedHandlersReturnType<T extends UntypedHandler> = [
|
|
9
9
|
(handler: Handlers<T>) => void,
|
|
10
|
-
<K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void
|
|
10
|
+
<K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void,
|
|
11
11
|
];
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -22,7 +22,7 @@ type SharedHandlersReturnType<T extends UntypedHandler> = [
|
|
|
22
22
|
* }
|
|
23
23
|
*/
|
|
24
24
|
export function useSharedHandlers<
|
|
25
|
-
T extends UntypedHandler
|
|
25
|
+
T extends UntypedHandler,
|
|
26
26
|
>(): SharedHandlersReturnType<T> {
|
|
27
27
|
const handlers = useSharedValue<Handlers<T>>({});
|
|
28
28
|
const jsHandlers = useRef<Handlers<T>>({});
|
|
@@ -48,9 +48,9 @@ export function useSharedHandlers<
|
|
|
48
48
|
}, []);
|
|
49
49
|
const broadcast = <K extends keyof T>(
|
|
50
50
|
type: K,
|
|
51
|
-
event: Parameters<T[K]>[0]
|
|
51
|
+
event: Parameters<T[K]>[0],
|
|
52
52
|
) => {
|
|
53
|
-
|
|
53
|
+
"worklet";
|
|
54
54
|
|
|
55
55
|
Object.keys(handlers.value).forEach((key) => {
|
|
56
56
|
handlers.value[key]?.[type]?.(event);
|
|
@@ -71,7 +71,7 @@ export function useSharedHandlers<
|
|
|
71
71
|
*/
|
|
72
72
|
export function useAnimatedValue(
|
|
73
73
|
initialValue: number,
|
|
74
|
-
config?: Animated.AnimatedConfig
|
|
74
|
+
config?: Animated.AnimatedConfig,
|
|
75
75
|
): Animated.Value {
|
|
76
76
|
const ref = useRef<Animated.Value | null>(null);
|
|
77
77
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-expect-error because there is no corresponding type definition
|
|
2
|
-
import * as NativeAndroidManager from
|
|
2
|
+
import * as NativeAndroidManager from "react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid";
|
|
3
3
|
|
|
4
4
|
const DefaultNativeAndroidManager = NativeAndroidManager.default;
|
|
5
5
|
const getConstants = NativeAndroidManager.default.getConstants;
|
|
6
6
|
const RCTStatusBarManagerCompat =
|
|
7
|
-
require(
|
|
7
|
+
require("./specs/NativeStatusBarManagerCompat").default;
|
|
8
8
|
|
|
9
9
|
// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
|
|
10
10
|
// in order to use library on all available platforms we have to monkey patch
|
package/src/reanimated.native.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEvent, useHandler } from
|
|
1
|
+
import { useEvent, useHandler } from "react-native-reanimated";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
EventWithName,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
FocusedInputTextHandlerHook,
|
|
9
9
|
KeyboardHandlerHook,
|
|
10
10
|
NativeEvent,
|
|
11
|
-
} from
|
|
11
|
+
} from "./types";
|
|
12
12
|
|
|
13
13
|
export const useAnimatedKeyboardHandler: KeyboardHandlerHook<
|
|
14
14
|
Record<string, unknown>,
|
|
@@ -18,7 +18,7 @@ export const useAnimatedKeyboardHandler: KeyboardHandlerHook<
|
|
|
18
18
|
|
|
19
19
|
return useEvent(
|
|
20
20
|
(event) => {
|
|
21
|
-
|
|
21
|
+
"worklet";
|
|
22
22
|
const {
|
|
23
23
|
onKeyboardMoveStart,
|
|
24
24
|
onKeyboardMove,
|
|
@@ -28,33 +28,33 @@ export const useAnimatedKeyboardHandler: KeyboardHandlerHook<
|
|
|
28
28
|
|
|
29
29
|
if (
|
|
30
30
|
onKeyboardMoveStart &&
|
|
31
|
-
event.eventName.endsWith(
|
|
31
|
+
event.eventName.endsWith("onKeyboardMoveStart")
|
|
32
32
|
) {
|
|
33
33
|
onKeyboardMoveStart(event, context);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if (onKeyboardMove && event.eventName.endsWith(
|
|
36
|
+
if (onKeyboardMove && event.eventName.endsWith("onKeyboardMove")) {
|
|
37
37
|
onKeyboardMove(event, context);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (onKeyboardMoveEnd && event.eventName.endsWith(
|
|
40
|
+
if (onKeyboardMoveEnd && event.eventName.endsWith("onKeyboardMoveEnd")) {
|
|
41
41
|
onKeyboardMoveEnd(event, context);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (
|
|
45
45
|
onKeyboardMoveInteractive &&
|
|
46
|
-
event.eventName.endsWith(
|
|
46
|
+
event.eventName.endsWith("onKeyboardMoveInteractive")
|
|
47
47
|
) {
|
|
48
48
|
onKeyboardMoveInteractive(event, context);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
[
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
"onKeyboardMoveStart",
|
|
53
|
+
"onKeyboardMove",
|
|
54
|
+
"onKeyboardMoveEnd",
|
|
55
|
+
"onKeyboardMoveInteractive",
|
|
56
56
|
],
|
|
57
|
-
doDependenciesDiffer
|
|
57
|
+
doDependenciesDiffer,
|
|
58
58
|
);
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -66,18 +66,18 @@ export const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<
|
|
|
66
66
|
|
|
67
67
|
return useEvent(
|
|
68
68
|
(event) => {
|
|
69
|
-
|
|
69
|
+
"worklet";
|
|
70
70
|
const { onFocusedInputLayoutChanged } = handlers;
|
|
71
71
|
|
|
72
72
|
if (
|
|
73
73
|
onFocusedInputLayoutChanged &&
|
|
74
|
-
event.eventName.endsWith(
|
|
74
|
+
event.eventName.endsWith("onFocusedInputLayoutChanged")
|
|
75
75
|
) {
|
|
76
76
|
onFocusedInputLayoutChanged(event, context);
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
[
|
|
80
|
-
doDependenciesDiffer
|
|
79
|
+
["onFocusedInputLayoutChanged"],
|
|
80
|
+
doDependenciesDiffer,
|
|
81
81
|
);
|
|
82
82
|
};
|
|
83
83
|
|
|
@@ -89,17 +89,17 @@ export const useFocusedInputTextHandler: FocusedInputTextHandlerHook<
|
|
|
89
89
|
|
|
90
90
|
return useEvent(
|
|
91
91
|
(event) => {
|
|
92
|
-
|
|
92
|
+
"worklet";
|
|
93
93
|
const { onFocusedInputTextChanged } = handlers;
|
|
94
94
|
|
|
95
95
|
if (
|
|
96
96
|
onFocusedInputTextChanged &&
|
|
97
|
-
event.eventName.endsWith(
|
|
97
|
+
event.eventName.endsWith("onFocusedInputTextChanged")
|
|
98
98
|
) {
|
|
99
99
|
onFocusedInputTextChanged(event, context);
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
|
-
[
|
|
103
|
-
doDependenciesDiffer
|
|
102
|
+
["onFocusedInputTextChanged"],
|
|
103
|
+
doDependenciesDiffer,
|
|
104
104
|
);
|
|
105
105
|
};
|
package/src/reanimated.ts
CHANGED
package/src/replicas.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef } from
|
|
2
|
-
import { Animated, Easing, Keyboard, Platform } from
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { Animated, Easing, Keyboard, Platform } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
runOnUI,
|
|
5
5
|
useAnimatedReaction,
|
|
6
6
|
useDerivedValue,
|
|
7
7
|
useSharedValue,
|
|
8
8
|
withSpring,
|
|
9
|
-
} from
|
|
9
|
+
} from "react-native-reanimated";
|
|
10
10
|
|
|
11
|
-
import { KeyboardController } from
|
|
12
|
-
import { AndroidSoftInputModes } from
|
|
13
|
-
import { useReanimatedKeyboardAnimation } from
|
|
11
|
+
import { KeyboardController } from "./bindings";
|
|
12
|
+
import { AndroidSoftInputModes } from "./constants";
|
|
13
|
+
import { useReanimatedKeyboardAnimation } from "./hooks";
|
|
14
14
|
|
|
15
|
-
const availableOSEventType = Platform.OS ===
|
|
15
|
+
const availableOSEventType = Platform.OS === "ios" ? "Will" : "Did";
|
|
16
16
|
|
|
17
17
|
// cubic-bezier(.17,.67,.34,.94)
|
|
18
18
|
export const defaultAndroidEasing = Easing.bezier(0.4, 0.0, 0.2, 1);
|
|
@@ -37,12 +37,12 @@ export const useKeyboardAnimationReplica = (): KeyboardAnimation => {
|
|
|
37
37
|
height: height.current,
|
|
38
38
|
progress: progress.current,
|
|
39
39
|
}),
|
|
40
|
-
[]
|
|
40
|
+
[],
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
KeyboardController.setInputMode(
|
|
45
|
-
AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE
|
|
45
|
+
AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
return () => KeyboardController.setDefaultMode();
|
|
@@ -59,7 +59,7 @@ export const useKeyboardAnimationReplica = (): KeyboardAnimation => {
|
|
|
59
59
|
}).start();
|
|
60
60
|
|
|
61
61
|
return () => listener.remove();
|
|
62
|
-
}
|
|
62
|
+
},
|
|
63
63
|
);
|
|
64
64
|
}, []);
|
|
65
65
|
useEffect(() => {
|
|
@@ -74,7 +74,7 @@ export const useKeyboardAnimationReplica = (): KeyboardAnimation => {
|
|
|
74
74
|
}).start();
|
|
75
75
|
|
|
76
76
|
return () => listener.remove();
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
78
|
);
|
|
79
79
|
}, []);
|
|
80
80
|
|
|
@@ -111,7 +111,7 @@ export const useReanimatedKeyboardAnimationReplica = () => {
|
|
|
111
111
|
const progress = useDerivedValue(() => height.value / heightEvent.value);
|
|
112
112
|
|
|
113
113
|
const handler = useCallback((_height: number) => {
|
|
114
|
-
|
|
114
|
+
"worklet";
|
|
115
115
|
|
|
116
116
|
heightEvent.value = _height;
|
|
117
117
|
}, []);
|
|
@@ -128,14 +128,14 @@ export const useReanimatedKeyboardAnimationReplica = () => {
|
|
|
128
128
|
height.value = withSpring(_keyboardHeight, IOS_SPRING_CONFIG);
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
-
[]
|
|
131
|
+
[],
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
useEffect(() => {
|
|
135
|
-
const show = Keyboard.addListener(
|
|
135
|
+
const show = Keyboard.addListener("keyboardWillShow", (e) => {
|
|
136
136
|
runOnUI(handler)(-e.endCoordinates.height);
|
|
137
137
|
});
|
|
138
|
-
const hide = Keyboard.addListener(
|
|
138
|
+
const hide = Keyboard.addListener("keyboardWillHide", () => {
|
|
139
139
|
runOnUI(handler)(0);
|
|
140
140
|
});
|
|
141
141
|
|
|
@@ -149,6 +149,6 @@ export const useReanimatedKeyboardAnimationReplica = () => {
|
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
export const useGradualKeyboardAnimation =
|
|
152
|
-
Platform.OS ===
|
|
152
|
+
Platform.OS === "ios"
|
|
153
153
|
? useReanimatedKeyboardAnimationReplica
|
|
154
154
|
: useReanimatedKeyboardAnimation;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import codegenNativeComponent from
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
2
|
|
|
3
|
-
import type { HostComponent } from
|
|
4
|
-
import type { ViewProps } from
|
|
3
|
+
import type { HostComponent } from "react-native";
|
|
4
|
+
import type { ViewProps } from "react-native/Libraries/Components/View/ViewPropTypes";
|
|
5
5
|
import type {
|
|
6
6
|
DirectEventHandler,
|
|
7
7
|
Double,
|
|
8
8
|
Int32,
|
|
9
|
-
} from
|
|
9
|
+
} from "react-native/Libraries/Types/CodegenTypes";
|
|
10
10
|
|
|
11
11
|
type KeyboardMoveEvent = Readonly<{
|
|
12
12
|
height: Double;
|
|
@@ -48,5 +48,5 @@ export interface NativeProps extends ViewProps {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export default codegenNativeComponent<NativeProps>(
|
|
51
|
-
|
|
51
|
+
"KeyboardControllerView",
|
|
52
52
|
) as HostComponent<NativeProps>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import codegenNativeComponent from
|
|
1
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
2
|
|
|
3
|
-
import type { HostComponent } from
|
|
4
|
-
import type { ViewProps } from
|
|
5
|
-
import type { WithDefault } from
|
|
3
|
+
import type { HostComponent } from "react-native";
|
|
4
|
+
import type { ViewProps } from "react-native/Libraries/Components/View/ViewPropTypes";
|
|
5
|
+
import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
6
6
|
|
|
7
7
|
export interface NativeProps extends ViewProps {
|
|
8
|
-
interpolator?: WithDefault<
|
|
8
|
+
interpolator?: WithDefault<"linear" | "ios", "linear">;
|
|
9
9
|
showOnSwipeUp?: boolean;
|
|
10
10
|
enableSwipeToDismiss?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export default codegenNativeComponent<NativeProps>(
|
|
14
|
-
excludedPlatforms: [
|
|
13
|
+
export default codegenNativeComponent<NativeProps>("KeyboardGestureArea", {
|
|
14
|
+
excludedPlatforms: ["iOS"],
|
|
15
15
|
}) as HostComponent<NativeProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TurboModuleRegistry } from
|
|
1
|
+
import { TurboModuleRegistry } from "react-native";
|
|
2
2
|
|
|
3
|
-
import type { TurboModule } from
|
|
3
|
+
import type { TurboModule } from "react-native";
|
|
4
4
|
|
|
5
5
|
export interface Spec extends TurboModule {
|
|
6
6
|
readonly getConstants: () => {};
|
|
@@ -15,4 +15,4 @@ export interface Spec extends TurboModule {
|
|
|
15
15
|
removeListeners: (count: number) => void;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export default TurboModuleRegistry.get<Spec>(
|
|
18
|
+
export default TurboModuleRegistry.get<Spec>("KeyboardController");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TurboModuleRegistry } from
|
|
1
|
+
import { TurboModuleRegistry } from "react-native";
|
|
2
2
|
|
|
3
|
-
import type { TurboModule } from
|
|
3
|
+
import type { TurboModule } from "react-native";
|
|
4
4
|
|
|
5
5
|
export interface Spec extends TurboModule {
|
|
6
6
|
readonly getConstants: () => {};
|
|
@@ -11,4 +11,4 @@ export interface Spec extends TurboModule {
|
|
|
11
11
|
setStyle(style: string): void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export default TurboModuleRegistry.get<Spec>(
|
|
14
|
+
export default TurboModuleRegistry.get<Spec>("StatusBarManagerCompat");
|
package/src/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
EmitterSubscription,
|
|
3
3
|
NativeSyntheticEvent,
|
|
4
4
|
ViewProps,
|
|
5
|
-
} from
|
|
5
|
+
} from "react-native";
|
|
6
6
|
|
|
7
7
|
// DirectEventHandler events declaration
|
|
8
8
|
export type NativeEvent = {
|
|
@@ -33,32 +33,32 @@ export type EventWithName<T> = {
|
|
|
33
33
|
export type KeyboardControllerProps = {
|
|
34
34
|
// callback props
|
|
35
35
|
onKeyboardMoveStart?: (
|
|
36
|
-
e: NativeSyntheticEvent<EventWithName<NativeEvent
|
|
36
|
+
e: NativeSyntheticEvent<EventWithName<NativeEvent>>,
|
|
37
37
|
) => void;
|
|
38
38
|
onKeyboardMove?: (
|
|
39
|
-
e: NativeSyntheticEvent<EventWithName<NativeEvent
|
|
39
|
+
e: NativeSyntheticEvent<EventWithName<NativeEvent>>,
|
|
40
40
|
) => void;
|
|
41
41
|
onKeyboardMoveEnd?: (
|
|
42
|
-
e: NativeSyntheticEvent<EventWithName<NativeEvent
|
|
42
|
+
e: NativeSyntheticEvent<EventWithName<NativeEvent>>,
|
|
43
43
|
) => void;
|
|
44
44
|
onKeyboardMoveInteractive?: (
|
|
45
|
-
e: NativeSyntheticEvent<EventWithName<NativeEvent
|
|
45
|
+
e: NativeSyntheticEvent<EventWithName<NativeEvent>>,
|
|
46
46
|
) => void;
|
|
47
47
|
onFocusedInputLayoutChanged?: (
|
|
48
|
-
e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent
|
|
48
|
+
e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,
|
|
49
49
|
) => void;
|
|
50
50
|
onFocusedInputTextChanged?: (
|
|
51
|
-
e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent
|
|
51
|
+
e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,
|
|
52
52
|
) => void;
|
|
53
53
|
// fake props used to activate reanimated bindings
|
|
54
54
|
onKeyboardMoveReanimated?: (
|
|
55
|
-
e: NativeSyntheticEvent<EventWithName<NativeEvent
|
|
55
|
+
e: NativeSyntheticEvent<EventWithName<NativeEvent>>,
|
|
56
56
|
) => void;
|
|
57
57
|
onFocusedInputLayoutChangedReanimated?: (
|
|
58
|
-
e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent
|
|
58
|
+
e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,
|
|
59
59
|
) => void;
|
|
60
60
|
onFocusedInputTextChangedReanimated?: (
|
|
61
|
-
e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent
|
|
61
|
+
e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,
|
|
62
62
|
) => void;
|
|
63
63
|
// props
|
|
64
64
|
statusBarTranslucent?: boolean;
|
|
@@ -67,7 +67,7 @@ export type KeyboardControllerProps = {
|
|
|
67
67
|
} & ViewProps;
|
|
68
68
|
|
|
69
69
|
export type KeyboardGestureAreaProps = {
|
|
70
|
-
interpolator:
|
|
70
|
+
interpolator: "ios" | "linear";
|
|
71
71
|
/**
|
|
72
72
|
* Whether to allow to show a keyboard from dismissed state by swipe up.
|
|
73
73
|
* Default to `false`.
|
|
@@ -94,10 +94,10 @@ export type KeyboardControllerModule = {
|
|
|
94
94
|
|
|
95
95
|
// Event module declarations
|
|
96
96
|
export type KeyboardControllerEvents =
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
97
|
+
| "keyboardWillShow"
|
|
98
|
+
| "keyboardDidShow"
|
|
99
|
+
| "keyboardWillHide"
|
|
100
|
+
| "keyboardDidHide";
|
|
101
101
|
export type KeyboardEventData = {
|
|
102
102
|
height: number;
|
|
103
103
|
duration: number;
|
|
@@ -107,7 +107,7 @@ export type KeyboardEventData = {
|
|
|
107
107
|
export type KeyboardEventsModule = {
|
|
108
108
|
addListener: (
|
|
109
109
|
name: KeyboardControllerEvents,
|
|
110
|
-
cb: (e: KeyboardEventData) => void
|
|
110
|
+
cb: (e: KeyboardEventData) => void,
|
|
111
111
|
) => EmitterSubscription;
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -119,25 +119,25 @@ export type KeyboardHandlerHook<TContext, Event> = (
|
|
|
119
119
|
onKeyboardMoveEnd?: (e: NativeEvent, context: TContext) => void;
|
|
120
120
|
onKeyboardMoveInteractive?: (e: NativeEvent, context: TContext) => void;
|
|
121
121
|
},
|
|
122
|
-
dependencies?: unknown[]
|
|
122
|
+
dependencies?: unknown[],
|
|
123
123
|
) => (e: NativeSyntheticEvent<Event>) => void;
|
|
124
124
|
export type FocusedInputLayoutHandlerHook<TContext, Event> = (
|
|
125
125
|
handlers: {
|
|
126
126
|
onFocusedInputLayoutChanged?: (
|
|
127
127
|
e: FocusedInputLayoutChangedEvent,
|
|
128
|
-
context: TContext
|
|
128
|
+
context: TContext,
|
|
129
129
|
) => void;
|
|
130
130
|
},
|
|
131
|
-
dependencies?: unknown[]
|
|
131
|
+
dependencies?: unknown[],
|
|
132
132
|
) => (e: NativeSyntheticEvent<Event>) => void;
|
|
133
133
|
export type FocusedInputTextHandlerHook<TContext, Event> = (
|
|
134
134
|
handlers: {
|
|
135
135
|
onFocusedInputTextChanged?: (
|
|
136
136
|
e: FocusedInputTextChangedEvent,
|
|
137
|
-
context: TContext
|
|
137
|
+
context: TContext,
|
|
138
138
|
) => void;
|
|
139
139
|
},
|
|
140
|
-
dependencies?: unknown[]
|
|
140
|
+
dependencies?: unknown[],
|
|
141
141
|
) => (e: NativeSyntheticEvent<Event>) => void;
|
|
142
142
|
|
|
143
143
|
// package types
|