@react-native-ohos/react-native-keyboard-controller 1.12.8-beta.9
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/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +19 -0
- package/harmony/keyboard_controller/BuildProfile.ets +17 -0
- package/harmony/keyboard_controller/Index.ets +30 -0
- package/harmony/keyboard_controller/ResourceTable.txt +9 -0
- package/harmony/keyboard_controller/build-profile.json5 +31 -0
- package/harmony/keyboard_controller/consumer-rules.txt +0 -0
- package/harmony/keyboard_controller/hvigorfile.ts +6 -0
- package/harmony/keyboard_controller/obfuscation-rules.txt +18 -0
- package/harmony/keyboard_controller/oh-package-lock.json5 +19 -0
- package/harmony/keyboard_controller/oh-package.json5 +11 -0
- package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +111 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +98 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +274 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +101 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +85 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +110 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +84 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +46 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +64 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +77 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +64 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +77 -0
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +67 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +70 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +245 -0
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +119 -0
- package/harmony/keyboard_controller/src/main/ets/Type.ts +62 -0
- package/harmony/keyboard_controller/src/main/module.json +29 -0
- package/harmony/keyboard_controller/src/main/module.json5 +11 -0
- package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/keyboard_controller/ts.ets +30 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +188 -0
- package/lib/commonjs/animated.js.map +1 -0
- package/lib/commonjs/bindings.js +38 -0
- package/lib/commonjs/bindings.js.map +1 -0
- package/lib/commonjs/bindings.native.js +37 -0
- package/lib/commonjs/bindings.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
- package/lib/commonjs/components/index.js +42 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/constants.js +27 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context.js +42 -0
- package/lib/commonjs/context.js.map +1 -0
- package/lib/commonjs/hooks/index.js +104 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/commonjs/index.js +116 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal.js +73 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/monkey-patch.android.js +57 -0
- package/lib/commonjs/monkey-patch.android.js.map +1 -0
- package/lib/commonjs/monkey-patch.js +11 -0
- package/lib/commonjs/monkey-patch.js.map +1 -0
- package/lib/commonjs/reanimated.js +12 -0
- package/lib/commonjs/reanimated.js.map +1 -0
- package/lib/commonjs/reanimated.native.js +88 -0
- package/lib/commonjs/reanimated.native.js.map +1 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +9 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/animated.js +180 -0
- package/lib/module/animated.js.map +1 -0
- package/lib/module/bindings.js +32 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/bindings.native.js +31 -0
- package/lib/module/bindings.native.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/module/components/KeyboardStickyView/index.js +33 -0
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Button.js +62 -0
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.js +15 -0
- package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +140 -0
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/types.js +2 -0
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/module/components/hooks/useColorScheme.js +4 -0
- package/lib/module/components/hooks/useColorScheme.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/constants.js +21 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context.js +35 -0
- package/lib/module/context.js.map +1 -0
- package/lib/module/hooks/index.js +68 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.js +2 -0
- package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal.js +66 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/monkey-patch.android.js +47 -0
- package/lib/module/monkey-patch.android.js.map +1 -0
- package/lib/module/monkey-patch.js +5 -0
- package/lib/module/monkey-patch.js.map +1 -0
- package/lib/module/reanimated.js +6 -0
- package/lib/module/reanimated.js.map +1 -0
- package/lib/module/reanimated.native.js +78 -0
- package/lib/module/reanimated.native.js.map +1 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js +3 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +2 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/animated.d.ts +31 -0
- package/lib/typescript/bindings.d.ts +12 -0
- package/lib/typescript/bindings.native.d.ts +12 -0
- package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
- package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
- package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
- package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
- package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
- package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
- package/lib/typescript/components/index.d.ts +8 -0
- package/lib/typescript/constants.d.ts +16 -0
- package/lib/typescript/context.d.ts +23 -0
- package/lib/typescript/hooks/index.d.ts +17 -0
- package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
- package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/internal.d.ts +30 -0
- package/lib/typescript/monkey-patch.android.d.ts +2 -0
- package/lib/typescript/monkey-patch.d.ts +2 -0
- package/lib/typescript/reanimated.d.ts +5 -0
- package/lib/typescript/reanimated.native.d.ts +7 -0
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
- package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
- package/lib/typescript/types.d.ts +133 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/package.json +178 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +253 -0
- package/src/bindings.native.ts +57 -0
- package/src/bindings.ts +38 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
- package/src/components/KeyboardAvoidingView/index.tsx +156 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
- package/src/components/KeyboardStickyView/index.tsx +57 -0
- package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
- package/src/components/KeyboardToolbar/Button.tsx +98 -0
- package/src/components/KeyboardToolbar/colors.native.ts +37 -0
- package/src/components/KeyboardToolbar/colors.ts +16 -0
- package/src/components/KeyboardToolbar/index.tsx +211 -0
- package/src/components/KeyboardToolbar/types.ts +40 -0
- package/src/components/hooks/useColorScheme.ts +5 -0
- package/src/components/index.ts +11 -0
- package/src/constants.ts +19 -0
- package/src/context.ts +65 -0
- package/src/hooks/index.ts +90 -0
- package/src/hooks/useWindowDimensions/index.android.ts +33 -0
- package/src/hooks/useWindowDimensions/index.ts +1 -0
- package/src/index.ts +21 -0
- package/src/internal.ts +84 -0
- package/src/monkey-patch.android.ts +44 -0
- package/src/monkey-patch.ts +4 -0
- package/src/reanimated.native.ts +132 -0
- package/src/reanimated.ts +29 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
- package/src/specs/NativeKeyboardController.ts +19 -0
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
- package/src/types.ts +211 -0
- package/src/utils.ts +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFocusedInputTextHandler = exports.useFocusedInputSelectionHandler = exports.useFocusedInputLayoutHandler = exports.useAnimatedKeyboardHandler = void 0;
|
|
7
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
|
+
const useAnimatedKeyboardHandler = (handlers, dependencies) => {
|
|
9
|
+
const {
|
|
10
|
+
context,
|
|
11
|
+
doDependenciesDiffer
|
|
12
|
+
} = (0, _reactNativeReanimated.useHandler)(handlers, dependencies);
|
|
13
|
+
return (0, _reactNativeReanimated.useEvent)(event => {
|
|
14
|
+
"worklet";
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
onKeyboardMoveStart,
|
|
18
|
+
onKeyboardMove,
|
|
19
|
+
onKeyboardMoveEnd,
|
|
20
|
+
onKeyboardMoveInteractive
|
|
21
|
+
} = handlers;
|
|
22
|
+
if (onKeyboardMoveStart && event.eventName.endsWith("onKeyboardMoveStart")) {
|
|
23
|
+
onKeyboardMoveStart(event, context);
|
|
24
|
+
}
|
|
25
|
+
if (onKeyboardMove && event.eventName.endsWith("onKeyboardMove")) {
|
|
26
|
+
onKeyboardMove(event, context);
|
|
27
|
+
}
|
|
28
|
+
if (onKeyboardMoveEnd && event.eventName.endsWith("onKeyboardMoveEnd")) {
|
|
29
|
+
onKeyboardMoveEnd(event, context);
|
|
30
|
+
}
|
|
31
|
+
if (onKeyboardMoveInteractive && event.eventName.endsWith("onKeyboardMoveInteractive")) {
|
|
32
|
+
onKeyboardMoveInteractive(event, context);
|
|
33
|
+
}
|
|
34
|
+
}, ["onKeyboardMoveStart", "onKeyboardMove", "onKeyboardMoveEnd", "onKeyboardMoveInteractive"], doDependenciesDiffer);
|
|
35
|
+
};
|
|
36
|
+
exports.useAnimatedKeyboardHandler = useAnimatedKeyboardHandler;
|
|
37
|
+
const useFocusedInputLayoutHandler = (handlers, dependencies) => {
|
|
38
|
+
const {
|
|
39
|
+
context,
|
|
40
|
+
doDependenciesDiffer
|
|
41
|
+
} = (0, _reactNativeReanimated.useHandler)(handlers, dependencies);
|
|
42
|
+
return (0, _reactNativeReanimated.useEvent)(event => {
|
|
43
|
+
"worklet";
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
onFocusedInputLayoutChanged
|
|
47
|
+
} = handlers;
|
|
48
|
+
if (onFocusedInputLayoutChanged && event.eventName.endsWith("onFocusedInputLayoutChanged")) {
|
|
49
|
+
onFocusedInputLayoutChanged(event, context);
|
|
50
|
+
}
|
|
51
|
+
}, ["onFocusedInputLayoutChanged"], doDependenciesDiffer);
|
|
52
|
+
};
|
|
53
|
+
exports.useFocusedInputLayoutHandler = useFocusedInputLayoutHandler;
|
|
54
|
+
const useFocusedInputTextHandler = (handlers, dependencies) => {
|
|
55
|
+
const {
|
|
56
|
+
context,
|
|
57
|
+
doDependenciesDiffer
|
|
58
|
+
} = (0, _reactNativeReanimated.useHandler)(handlers, dependencies);
|
|
59
|
+
return (0, _reactNativeReanimated.useEvent)(event => {
|
|
60
|
+
"worklet";
|
|
61
|
+
|
|
62
|
+
const {
|
|
63
|
+
onFocusedInputTextChanged
|
|
64
|
+
} = handlers;
|
|
65
|
+
if (onFocusedInputTextChanged && event.eventName.endsWith("onFocusedInputTextChanged")) {
|
|
66
|
+
onFocusedInputTextChanged(event, context);
|
|
67
|
+
}
|
|
68
|
+
}, ["onFocusedInputTextChanged"], doDependenciesDiffer);
|
|
69
|
+
};
|
|
70
|
+
exports.useFocusedInputTextHandler = useFocusedInputTextHandler;
|
|
71
|
+
const useFocusedInputSelectionHandler = (handlers, dependencies) => {
|
|
72
|
+
const {
|
|
73
|
+
context,
|
|
74
|
+
doDependenciesDiffer
|
|
75
|
+
} = (0, _reactNativeReanimated.useHandler)(handlers, dependencies);
|
|
76
|
+
return (0, _reactNativeReanimated.useEvent)(event => {
|
|
77
|
+
"worklet";
|
|
78
|
+
|
|
79
|
+
const {
|
|
80
|
+
onFocusedInputSelectionChanged
|
|
81
|
+
} = handlers;
|
|
82
|
+
if (onFocusedInputSelectionChanged && event.eventName.endsWith("onFocusedInputSelectionChanged")) {
|
|
83
|
+
onFocusedInputSelectionChanged(event, context);
|
|
84
|
+
}
|
|
85
|
+
}, ["onFocusedInputSelectionChanged"], doDependenciesDiffer);
|
|
86
|
+
};
|
|
87
|
+
exports.useFocusedInputSelectionHandler = useFocusedInputSelectionHandler;
|
|
88
|
+
//# sourceMappingURL=reanimated.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeReanimated","require","useAnimatedKeyboardHandler","handlers","dependencies","context","doDependenciesDiffer","useHandler","useEvent","event","onKeyboardMoveStart","onKeyboardMove","onKeyboardMoveEnd","onKeyboardMoveInteractive","eventName","endsWith","exports","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","useFocusedInputTextHandler","onFocusedInputTextChanged","useFocusedInputSelectionHandler","onFocusedInputSelectionChanged"],"sources":["reanimated.native.ts"],"sourcesContent":["import { useEvent, useHandler } from \"react-native-reanimated\";\r\n\r\nimport type {\r\n EventWithName,\r\n FocusedInputLayoutChangedEvent,\r\n FocusedInputLayoutHandlerHook,\r\n FocusedInputSelectionChangedEvent,\r\n FocusedInputSelectionHandlerHook,\r\n FocusedInputTextChangedEvent,\r\n FocusedInputTextHandlerHook,\r\n KeyboardHandlerHook,\r\n NativeEvent,\r\n} from \"./types\";\r\n\r\ntype EventContext = Record<string, unknown>;\r\n\r\nexport const useAnimatedKeyboardHandler: KeyboardHandlerHook<\r\n EventContext,\r\n EventWithName<NativeEvent>\r\n> = (handlers, dependencies) => {\r\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\r\n\r\n return useEvent(\r\n (event) => {\r\n \"worklet\";\r\n const {\r\n onKeyboardMoveStart,\r\n onKeyboardMove,\r\n onKeyboardMoveEnd,\r\n onKeyboardMoveInteractive,\r\n } = handlers;\r\n\r\n if (\r\n onKeyboardMoveStart &&\r\n event.eventName.endsWith(\"onKeyboardMoveStart\")\r\n ) {\r\n onKeyboardMoveStart(event, context);\r\n }\r\n\r\n if (onKeyboardMove && event.eventName.endsWith(\"onKeyboardMove\")) {\r\n onKeyboardMove(event, context);\r\n }\r\n\r\n if (onKeyboardMoveEnd && event.eventName.endsWith(\"onKeyboardMoveEnd\")) {\r\n onKeyboardMoveEnd(event, context);\r\n }\r\n\r\n if (\r\n onKeyboardMoveInteractive &&\r\n event.eventName.endsWith(\"onKeyboardMoveInteractive\")\r\n ) {\r\n onKeyboardMoveInteractive(event, context);\r\n }\r\n },\r\n [\r\n \"onKeyboardMoveStart\",\r\n \"onKeyboardMove\",\r\n \"onKeyboardMoveEnd\",\r\n \"onKeyboardMoveInteractive\",\r\n ],\r\n doDependenciesDiffer,\r\n );\r\n};\r\n\r\nexport const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<\r\n EventContext,\r\n EventWithName<FocusedInputLayoutChangedEvent>\r\n> = (handlers, dependencies) => {\r\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\r\n\r\n return useEvent(\r\n (event) => {\r\n \"worklet\";\r\n const { onFocusedInputLayoutChanged } = handlers;\r\n\r\n if (\r\n onFocusedInputLayoutChanged &&\r\n event.eventName.endsWith(\"onFocusedInputLayoutChanged\")\r\n ) {\r\n onFocusedInputLayoutChanged(event, context);\r\n }\r\n },\r\n [\"onFocusedInputLayoutChanged\"],\r\n doDependenciesDiffer,\r\n );\r\n};\r\n\r\nexport const useFocusedInputTextHandler: FocusedInputTextHandlerHook<\r\n EventContext,\r\n EventWithName<FocusedInputTextChangedEvent>\r\n> = (handlers, dependencies) => {\r\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\r\n\r\n return useEvent(\r\n (event) => {\r\n \"worklet\";\r\n const { onFocusedInputTextChanged } = handlers;\r\n\r\n if (\r\n onFocusedInputTextChanged &&\r\n event.eventName.endsWith(\"onFocusedInputTextChanged\")\r\n ) {\r\n onFocusedInputTextChanged(event, context);\r\n }\r\n },\r\n [\"onFocusedInputTextChanged\"],\r\n doDependenciesDiffer,\r\n );\r\n};\r\n\r\nexport const useFocusedInputSelectionHandler: FocusedInputSelectionHandlerHook<\r\n EventContext,\r\n EventWithName<FocusedInputSelectionChangedEvent>\r\n> = (handlers, dependencies) => {\r\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\r\n\r\n return useEvent(\r\n (event) => {\r\n \"worklet\";\r\n const { onFocusedInputSelectionChanged } = handlers;\r\n\r\n if (\r\n onFocusedInputSelectionChanged &&\r\n event.eventName.endsWith(\"onFocusedInputSelectionChanged\")\r\n ) {\r\n onFocusedInputSelectionChanged(event, context);\r\n }\r\n },\r\n [\"onFocusedInputSelectionChanged\"],\r\n doDependenciesDiffer,\r\n );\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAgBO,MAAMC,0BAGZ,GAAGA,CAACC,QAAQ,EAAEC,YAAY,KAAK;EAC9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;AAACU,OAAA,CAAAK,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)("RNKeyboardControllerView");
|
|
10
|
+
//# sourceMappingURL=KeyboardControllerViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sources":["KeyboardControllerViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\r\n\r\nimport type { HostComponent } from \"react-native\";\r\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\r\nimport type {\r\n DirectEventHandler,\r\n Double,\r\n Int32,\r\n} from \"react-native/Libraries/Types/CodegenTypes\";\r\n\r\ntype KeyboardMoveEvent = Readonly<{\r\n height: Double;\r\n progress: Double;\r\n duration: Int32;\r\n target: Int32;\r\n}>;\r\n\r\ntype FocusedInputLayoutChangedEvent = Readonly<{\r\n target: Int32;\r\n parentScrollViewTarget: Int32;\r\n layout: {\r\n x: Double;\r\n y: Double;\r\n width: Double;\r\n height: Double;\r\n absoluteX: Double;\r\n absoluteY: Double;\r\n };\r\n}>;\r\n\r\ntype FocusedInputTextChangedEvent = Readonly<{\r\n text: string;\r\n}>;\r\n\r\ntype FocusedInputSelectionChangedEvent = Readonly<{\r\n target: Int32;\r\n selection: {\r\n start: {\r\n x: Double;\r\n y: Double;\r\n position: Int32;\r\n };\r\n end: {\r\n x: Double;\r\n y: Double;\r\n position: Int32;\r\n };\r\n };\r\n}>;\r\n\r\nexport interface NativeProps extends ViewProps {\r\n // props\r\n enabled?: boolean;\r\n statusBarTranslucent?: boolean;\r\n navigationBarTranslucent?: boolean;\r\n // callbacks\r\n /// keyboard\r\n onKeyboardMoveStart?: DirectEventHandler<KeyboardMoveEvent>;\r\n onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;\r\n onKeyboardMoveEnd?: DirectEventHandler<KeyboardMoveEvent>;\r\n onKeyboardMoveInteractive?: DirectEventHandler<KeyboardMoveEvent>;\r\n /// focused input\r\n onFocusedInputLayoutChanged?: DirectEventHandler<FocusedInputLayoutChangedEvent>;\r\n onFocusedInputTextChanged?: DirectEventHandler<FocusedInputTextChangedEvent>;\r\n onFocusedInputSelectionChanged?: DirectEventHandler<FocusedInputSelectionChangedEvent>;\r\n}\r\n\r\nexport default codegenNativeComponent<NativeProps>(\r\n \"RNKeyboardControllerView\",\r\n) as HostComponent<NativeProps>;\r\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAmE9E,IAAAG,+BAAsB,EACnC,0BACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)("RNKeyboardGestureArea", {
|
|
10
|
+
excludedPlatforms: ["iOS"]
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=KeyboardGestureAreaNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent","excludedPlatforms"],"sources":["KeyboardGestureAreaNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\r\n\r\nimport type { HostComponent } from \"react-native\";\r\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\r\nimport type { WithDefault } from \"react-native/Libraries/Types/CodegenTypes\";\r\n\r\nexport interface NativeProps extends ViewProps {\r\n interpolator?: WithDefault<\"linear\" | \"ios\", \"linear\">;\r\n showOnSwipeUp?: boolean;\r\n enableSwipeToDismiss?: boolean;\r\n}\r\n\r\nexport default codegenNativeComponent<NativeProps>(\"RNKeyboardGestureArea\", {\r\n excludedPlatforms: [\"iOS\"],\r\n}) as HostComponent<NativeProps>;\r\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAY9E,IAAAG,+BAAsB,EAAc,uBAAuB,EAAE;EAC1EC,iBAAiB,EAAE,CAAC,KAAK;AAC3B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.get("KeyboardController");
|
|
9
|
+
//# sourceMappingURL=NativeKeyboardController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeKeyboardController.ts"],"sourcesContent":["import { TurboModuleRegistry } from \"react-native\";\r\n\r\nimport type { TurboModule } from \"react-native\";\r\n\r\nexport interface Spec extends TurboModule {\r\n readonly getConstants: () => {};\r\n\r\n // methods\r\n setInputMode(mode: number): void;\r\n setDefaultMode(): void;\r\n dismiss(): void;\r\n setFocusTo(direction: string): void;\r\n\r\n // event emitter\r\n addListener: (eventName: string) => void;\r\n removeListeners: (count: number) => void;\r\n}\r\n\r\nexport default TurboModuleRegistry.get<Spec>(\"KeyboardController\");\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAkBpCC,gCAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.get("StatusBarManagerCompat");
|
|
9
|
+
//# sourceMappingURL=NativeStatusBarManagerCompat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeStatusBarManagerCompat.ts"],"sourcesContent":["import { TurboModuleRegistry } from \"react-native\";\r\n\r\nimport type { TurboModule } from \"react-native\";\r\n\r\nexport interface Spec extends TurboModule {\r\n readonly getConstants: () => {};\r\n\r\n setHidden(hidden: boolean): void;\r\n setColor(color: number, animated: boolean): void;\r\n setTranslucent(translucent: boolean): void;\r\n setStyle(style: string): void;\r\n}\r\n\r\nexport default TurboModuleRegistry.get<Spec>(\"StatusBarManagerCompat\");\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAapCC,gCAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\r\n EmitterSubscription,\r\n NativeSyntheticEvent,\r\n ViewProps,\r\n} from \"react-native\";\r\n\r\n// DirectEventHandler events declaration\r\nexport type NativeEvent = {\r\n progress: number;\r\n height: number;\r\n duration: number;\r\n target: number;\r\n};\r\nexport type FocusedInputLayoutChangedEvent = {\r\n target: number;\r\n parentScrollViewTarget: number;\r\n layout: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n absoluteX: number;\r\n absoluteY: number;\r\n };\r\n};\r\nexport type FocusedInputTextChangedEvent = {\r\n text: string;\r\n};\r\nexport type FocusedInputSelectionChangedEvent = {\r\n target: number;\r\n selection: {\r\n start: {\r\n x: number;\r\n y: number;\r\n position: number;\r\n };\r\n end: {\r\n x: number;\r\n y: number;\r\n position: number;\r\n };\r\n };\r\n};\r\nexport type EventWithName<T> = {\r\n eventName: string;\r\n} & T;\r\n\r\n// native View/Module declarations\r\nexport type KeyboardControllerProps = {\r\n // callback props\r\n onKeyboardMoveStart?: (\r\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\r\n ) => void;\r\n onKeyboardMove?: (\r\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\r\n ) => void;\r\n onKeyboardMoveEnd?: (\r\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\r\n ) => void;\r\n onKeyboardMoveInteractive?: (\r\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\r\n ) => void;\r\n onFocusedInputLayoutChanged?: (\r\n e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,\r\n ) => void;\r\n onFocusedInputTextChanged?: (\r\n e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,\r\n ) => void;\r\n onFocusedInputSelectionChanged?: (\r\n e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,\r\n ) => void;\r\n // fake props used to activate reanimated bindings\r\n onKeyboardMoveReanimated?: (\r\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\r\n ) => void;\r\n onFocusedInputLayoutChangedReanimated?: (\r\n e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,\r\n ) => void;\r\n onFocusedInputTextChangedReanimated?: (\r\n e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,\r\n ) => void;\r\n onFocusedInputSelectionChangedReanimated?: (\r\n e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,\r\n ) => void;\r\n // props\r\n statusBarTranslucent?: boolean;\r\n navigationBarTranslucent?: boolean;\r\n enabled?: boolean;\r\n} & ViewProps;\r\n\r\nexport type KeyboardGestureAreaProps = {\r\n interpolator: \"ios\" | \"linear\";\r\n /**\r\n * Whether to allow to show a keyboard from dismissed state by swipe up.\r\n * Default to `false`.\r\n */\r\n showOnSwipeUp?: boolean;\r\n /**\r\n * Whether to allow to control a keyboard by gestures. The strategy how\r\n * it should be controlled is determined by `interpolator` property.\r\n * Defaults to `true`.\r\n */\r\n enableSwipeToDismiss?: boolean;\r\n} & ViewProps;\r\n\r\nexport type Direction = \"next\" | \"prev\" | \"current\";\r\nexport type KeyboardControllerModule = {\r\n // android only\r\n setDefaultMode: () => void;\r\n setInputMode: (mode: number) => void;\r\n // all platforms\r\n dismiss: () => void;\r\n setFocusTo: (direction: Direction) => void;\r\n // native event module stuff\r\n addListener: (eventName: string) => void;\r\n removeListeners: (count: number) => void;\r\n};\r\n\r\n// Event module declarations\r\nexport type KeyboardControllerEvents =\r\n | \"keyboardWillShow\"\r\n | \"keyboardDidShow\"\r\n | \"keyboardWillHide\"\r\n | \"keyboardDidHide\";\r\nexport type KeyboardEventData = {\r\n height: number;\r\n duration: number;\r\n timestamp: number;\r\n target: number;\r\n};\r\nexport type KeyboardEventsModule = {\r\n addListener: (\r\n name: KeyboardControllerEvents,\r\n cb: (e: KeyboardEventData) => void,\r\n ) => EmitterSubscription;\r\n};\r\nexport type FocusedInputAvailableEvents = \"focusDidSet\";\r\nexport type FocusedInputEventData = {\r\n current: number;\r\n count: number;\r\n};\r\nexport type FocusedInputEventsModule = {\r\n addListener: (\r\n name: FocusedInputAvailableEvents,\r\n cb: (e: FocusedInputEventData) => void,\r\n ) => EmitterSubscription;\r\n};\r\nexport type WindowDimensionsAvailableEvents = \"windowDidResize\";\r\nexport type WindowDimensionsEventData = {\r\n width: number;\r\n height: number;\r\n};\r\nexport type WindowDimensionsEventsModule = {\r\n addListener: (\r\n name: WindowDimensionsAvailableEvents,\r\n cb: (e: WindowDimensionsEventData) => void,\r\n ) => EmitterSubscription;\r\n};\r\n\r\n// reanimated hook declaration\r\nexport type KeyboardHandlerHook<TContext, Event> = (\r\n handlers: {\r\n onKeyboardMoveStart?: (e: NativeEvent, context: TContext) => void;\r\n onKeyboardMove?: (e: NativeEvent, context: TContext) => void;\r\n onKeyboardMoveEnd?: (e: NativeEvent, context: TContext) => void;\r\n onKeyboardMoveInteractive?: (e: NativeEvent, context: TContext) => void;\r\n },\r\n dependencies?: unknown[],\r\n) => (e: NativeSyntheticEvent<Event>) => void;\r\nexport type FocusedInputLayoutHandlerHook<TContext, Event> = (\r\n handlers: {\r\n onFocusedInputLayoutChanged?: (\r\n e: FocusedInputLayoutChangedEvent,\r\n context: TContext,\r\n ) => void;\r\n },\r\n dependencies?: unknown[],\r\n) => (e: NativeSyntheticEvent<Event>) => void;\r\nexport type FocusedInputTextHandlerHook<TContext, Event> = (\r\n handlers: {\r\n onFocusedInputTextChanged?: (\r\n e: FocusedInputTextChangedEvent,\r\n context: TContext,\r\n ) => void;\r\n },\r\n dependencies?: unknown[],\r\n) => (e: NativeSyntheticEvent<Event>) => void;\r\nexport type FocusedInputSelectionHandlerHook<TContext, Event> = (\r\n handlers: {\r\n onFocusedInputSelectionChanged?: (\r\n e: FocusedInputSelectionChangedEvent,\r\n context: TContext,\r\n ) => void;\r\n },\r\n dependencies?: unknown[],\r\n) => (e: NativeSyntheticEvent<Event>) => void;\r\n\r\n// package types\r\nexport type Handlers<T> = Record<string, T | undefined>;\r\nexport type KeyboardHandler = Partial<{\r\n onStart: (e: NativeEvent) => void;\r\n onMove: (e: NativeEvent) => void;\r\n onEnd: (e: NativeEvent) => void;\r\n onInteractive: (e: NativeEvent) => void;\r\n}>;\r\nexport type KeyboardHandlers = Handlers<KeyboardHandler>;\r\nexport type FocusedInputHandler = Partial<{\r\n onChangeText: (e: FocusedInputTextChangedEvent) => void;\r\n onSelectionChange: (e: FocusedInputSelectionChangedEvent) => void;\r\n}>;\r\nexport type FocusedInputHandlers = Handlers<FocusedInputHandler>;\r\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["uuid","Math","random","toString","slice","exports"],"sources":["utils.ts"],"sourcesContent":["export const uuid = () => Math.random().toString(36).slice(-6);\r\n"],"mappings":";;;;;;AAAO,MAAMA,IAAI,GAAGA,CAAA,KAAMC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAL,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Animated, Platform, StyleSheet } from "react-native";
|
|
3
|
+
import Reanimated, { useSharedValue, Easing, withTiming } from "react-native-reanimated";
|
|
4
|
+
import { KeyboardControllerView } from "./bindings";
|
|
5
|
+
import { KeyboardContext } from "./context";
|
|
6
|
+
import { useAnimatedValue, useSharedHandlers } from "./internal";
|
|
7
|
+
import { applyMonkeyPatch, revertMonkeyPatch } from "./monkey-patch";
|
|
8
|
+
import { useAnimatedKeyboardHandler, useFocusedInputLayoutHandler, useFocusedInputSelectionHandler, useFocusedInputTextHandler } from "./reanimated";
|
|
9
|
+
const KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(Animated.createAnimatedComponent(KeyboardControllerView));
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
container: {
|
|
12
|
+
flex: 1
|
|
13
|
+
},
|
|
14
|
+
hidden: {
|
|
15
|
+
display: "none",
|
|
16
|
+
position: "absolute"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
20
|
+
// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details
|
|
21
|
+
const OS = Platform.OS;
|
|
22
|
+
export const KeyboardProvider = ({
|
|
23
|
+
children,
|
|
24
|
+
statusBarTranslucent,
|
|
25
|
+
navigationBarTranslucent,
|
|
26
|
+
enabled: initiallyEnabled = true
|
|
27
|
+
}) => {
|
|
28
|
+
// state
|
|
29
|
+
const [enabled, setEnabled] = useState(initiallyEnabled);
|
|
30
|
+
// animated values
|
|
31
|
+
const progress = useAnimatedValue(0);
|
|
32
|
+
const height = useAnimatedValue(0);
|
|
33
|
+
// shared values
|
|
34
|
+
const progressSV = useSharedValue(0);
|
|
35
|
+
const heightSV = useSharedValue(0);
|
|
36
|
+
const layout = useSharedValue(null);
|
|
37
|
+
const [setKeyboardHandlers, broadcastKeyboardEvents] = useSharedHandlers();
|
|
38
|
+
const [setInputHandlers, broadcastInputEvents] = useSharedHandlers();
|
|
39
|
+
// memo
|
|
40
|
+
const context = useMemo(() => ({
|
|
41
|
+
enabled,
|
|
42
|
+
animated: {
|
|
43
|
+
progress: progress,
|
|
44
|
+
height: Animated.multiply(height, -1)
|
|
45
|
+
},
|
|
46
|
+
reanimated: {
|
|
47
|
+
progress: progressSV,
|
|
48
|
+
height: heightSV
|
|
49
|
+
},
|
|
50
|
+
layout,
|
|
51
|
+
setKeyboardHandlers,
|
|
52
|
+
setInputHandlers,
|
|
53
|
+
setEnabled
|
|
54
|
+
}), [enabled]);
|
|
55
|
+
const style = useMemo(() => [styles.hidden, {
|
|
56
|
+
transform: [{
|
|
57
|
+
translateX: height
|
|
58
|
+
}, {
|
|
59
|
+
translateY: progress
|
|
60
|
+
}]
|
|
61
|
+
}], []);
|
|
62
|
+
const onKeyboardMove = useMemo(() => Animated.event([{
|
|
63
|
+
nativeEvent: {
|
|
64
|
+
progress,
|
|
65
|
+
height
|
|
66
|
+
}
|
|
67
|
+
}], {
|
|
68
|
+
useNativeDriver: Platform.OS == 'harmony' ? false : true
|
|
69
|
+
}), []);
|
|
70
|
+
// handlers
|
|
71
|
+
const updateSharedValues = (event, platforms) => {
|
|
72
|
+
"worklet";
|
|
73
|
+
|
|
74
|
+
if (platforms.includes(OS)) {
|
|
75
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
76
|
+
if (Platform.OS == 'harmony') {
|
|
77
|
+
const dur = 460;
|
|
78
|
+
progressSV.value = withTiming(event.progress, {
|
|
79
|
+
duration: dur,
|
|
80
|
+
easing: Easing.out(Easing.exp)
|
|
81
|
+
});
|
|
82
|
+
heightSV.value = withTiming(-event.height, {
|
|
83
|
+
duration: dur,
|
|
84
|
+
easing: Easing.out(Easing.exp)
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
progressSV.value = event.progress;
|
|
88
|
+
heightSV.value = -event.height;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const keyboardHandler = useAnimatedKeyboardHandler({
|
|
93
|
+
onKeyboardMoveStart: event => {
|
|
94
|
+
"worklet";
|
|
95
|
+
|
|
96
|
+
broadcastKeyboardEvents("onStart", event);
|
|
97
|
+
updateSharedValues(event, ["ios"]);
|
|
98
|
+
},
|
|
99
|
+
onKeyboardMove: event => {
|
|
100
|
+
"worklet";
|
|
101
|
+
|
|
102
|
+
broadcastKeyboardEvents("onMove", event);
|
|
103
|
+
updateSharedValues(event, ["android"]);
|
|
104
|
+
},
|
|
105
|
+
onKeyboardMoveEnd: event => {
|
|
106
|
+
"worklet";
|
|
107
|
+
|
|
108
|
+
broadcastKeyboardEvents("onEnd", event);
|
|
109
|
+
updateSharedValues(event, ['harmony']);
|
|
110
|
+
},
|
|
111
|
+
onKeyboardMoveInteractive: event => {
|
|
112
|
+
"worklet";
|
|
113
|
+
|
|
114
|
+
updateSharedValues(event, ["android", "ios"]);
|
|
115
|
+
broadcastKeyboardEvents("onInteractive", event);
|
|
116
|
+
}
|
|
117
|
+
}, []);
|
|
118
|
+
const inputLayoutHandler = useFocusedInputLayoutHandler({
|
|
119
|
+
onFocusedInputLayoutChanged: e => {
|
|
120
|
+
"worklet";
|
|
121
|
+
|
|
122
|
+
if (e.target !== -1) {
|
|
123
|
+
layout.value = e;
|
|
124
|
+
} else {
|
|
125
|
+
layout.value = null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, []);
|
|
129
|
+
const inputTextHandler = useFocusedInputTextHandler({
|
|
130
|
+
onFocusedInputTextChanged: e => {
|
|
131
|
+
"worklet";
|
|
132
|
+
|
|
133
|
+
broadcastInputEvents("onChangeText", e);
|
|
134
|
+
}
|
|
135
|
+
}, []);
|
|
136
|
+
const inputSelectionHandler = useFocusedInputSelectionHandler({
|
|
137
|
+
onFocusedInputSelectionChanged: e => {
|
|
138
|
+
"worklet";
|
|
139
|
+
|
|
140
|
+
broadcastInputEvents("onSelectionChange", e);
|
|
141
|
+
}
|
|
142
|
+
}, []);
|
|
143
|
+
// effects
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (enabled) {
|
|
146
|
+
applyMonkeyPatch();
|
|
147
|
+
} else {
|
|
148
|
+
revertMonkeyPatch();
|
|
149
|
+
}
|
|
150
|
+
}, [enabled]);
|
|
151
|
+
return /*#__PURE__*/React.createElement(KeyboardContext.Provider, {
|
|
152
|
+
value: context
|
|
153
|
+
}, /*#__PURE__*/React.createElement(KeyboardControllerViewAnimated, {
|
|
154
|
+
enabled: enabled,
|
|
155
|
+
onKeyboardMoveReanimated: keyboardHandler,
|
|
156
|
+
onKeyboardMoveStart: OS === "ios" ? onKeyboardMove : undefined,
|
|
157
|
+
onKeyboardMove: OS === "android" ? onKeyboardMove : undefined,
|
|
158
|
+
onKeyboardMoveInteractive: onKeyboardMove,
|
|
159
|
+
onKeyboardMoveEnd: OS === "harmony" ? onKeyboardMove : undefined,
|
|
160
|
+
onFocusedInputLayoutChangedReanimated: inputLayoutHandler,
|
|
161
|
+
onFocusedInputTextChangedReanimated: inputTextHandler,
|
|
162
|
+
onFocusedInputSelectionChangedReanimated: inputSelectionHandler,
|
|
163
|
+
navigationBarTranslucent: navigationBarTranslucent,
|
|
164
|
+
statusBarTranslucent: statusBarTranslucent,
|
|
165
|
+
style: styles.container
|
|
166
|
+
}, /*#__PURE__*/React.createElement(Reanimated.View, {
|
|
167
|
+
style: styles.container
|
|
168
|
+
}, children)), /*#__PURE__*/React.createElement(Animated.View, {
|
|
169
|
+
// we are using this small hack, because if the component (where
|
|
170
|
+
// animated value has been used) is unmounted, then animation will
|
|
171
|
+
// stop receiving events (seems like it's react-native optimization).
|
|
172
|
+
// So we need to keep a reference to the animated value, to keep it's
|
|
173
|
+
// always mounted (keep a reference to an animated value).
|
|
174
|
+
//
|
|
175
|
+
// To test why it's needed, try to open screen which consumes Animated.Value
|
|
176
|
+
// then close it and open it again (for example 'Animated transition').
|
|
177
|
+
style: style
|
|
178
|
+
}));
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=animated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useMemo","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","Easing","withTiming","KeyboardControllerView","KeyboardContext","useAnimatedValue","useSharedHandlers","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","dur","value","duration","easing","out","exp","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue, Easing, withTiming } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height, -1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver: Platform.OS as string == 'harmony' ? false : true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n if (Platform.OS as string == 'harmony') {\r\n const dur = 460\r\n progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });\r\n heightSV.value = withTiming(-event.height, { duration: dur, easing: Easing.out(Easing.exp) });\r\n } else {\r\n progressSV.value = event.progress;\r\n heightSV.value = -event.height;\r\n\r\n }\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={OS as string === \"harmony\" ? onKeyboardMove : undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n style={styles.container}\r\n >\r\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\r\n {/* {children} */}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,OAAOC,UAAU,IAAIC,cAAc,EAAEC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAExF,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAY;AAChE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpE,SACEC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,0BAA0B,QACrB,cAAc;AAYrB,MAAMC,8BAA8B,GAAGd,UAAU,CAACe,uBAAuB,CACvElB,QAAQ,CAACkB,uBAAuB,CAC9BX,sBACF,CACF,CAAC;AAOD,MAAMY,MAAM,GAAGjB,UAAU,CAACkB,MAAM,CAAS;EACvCC,SAAS,EAAE;IACTC,IAAI,EAAE;EACR,CAAC;EACDC,MAAM,EAAE;IACNC,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AA+BF;AACA;AACA,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S,CAAC,MAAM;IACd,IAAIkC,OAAO,EAAE;MACXpB,gBAAgB,CAAC,CAAC;IACpB,CAAC,MAAM;MACLC,iBAAiB,CAAC,CAAC;IACrB;EACF,CAAC,EAAE,CAACmB,OAAO,CAAC,CAAC;EAEb,oBACEnC,KAAA,CAAAgF,aAAA,CAACpE,eAAe,CAACqE,QAAQ;IAAClB,KAAK,EAAEhB;EAAQ,gBACvC/C,KAAA,CAAAgF,aAAA,CAAC3D,8BAA8B;IAC7Bc,OAAO,EAAEA,OAAQ;IACjB+C,wBAAwB,EAAEd,eAAgB;IAC1CC,mBAAmB,EAAEvC,EAAE,KAAK,KAAK,GAAGyB,cAAc,GAAG4B,SAAU;IAC/D5B,cAAc,EAAEzB,EAAE,KAAK,SAAS,GAAGyB,cAAc,GAAG4B,SAAU;IAC9DZ,yBAAyB,EAAEhB,cAAe;IAC1Ce,iBAAiB,EAAExC,EAAE,KAAe,SAAS,GAAGyB,cAAc,GAAG4B,SAAU;IAC3EC,qCAAqC,EAAEZ,kBAAmB;IAC1Da,mCAAmC,EAAET,gBAAiB;IACtDU,wCAAwC,EAAER,qBAAsB;IAChE5C,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CkB,KAAK,EAAE5B,MAAM,CAACE;EAAU,gBAExBzB,KAAA,CAAAgF,aAAA,CAACzE,UAAU,CAACgF,IAAI;IAACpC,KAAK,EAAE5B,MAAM,CAACE;EAAU,GAAEO,QAA0B,CAEvC,CAAC,eACjChC,KAAA,CAAAgF,aAAA,CAAC5E,QAAQ,CAACmF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACApC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
const NOOP = () => {};
|
|
3
|
+
export const KeyboardController = {
|
|
4
|
+
setDefaultMode: NOOP,
|
|
5
|
+
setInputMode: NOOP,
|
|
6
|
+
dismiss: NOOP,
|
|
7
|
+
setFocusTo: NOOP,
|
|
8
|
+
addListener: NOOP,
|
|
9
|
+
removeListeners: NOOP
|
|
10
|
+
};
|
|
11
|
+
export const KeyboardEvents = {
|
|
12
|
+
addListener: () => ({
|
|
13
|
+
remove: NOOP
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
18
|
+
* Use it with cautious.
|
|
19
|
+
*/
|
|
20
|
+
export const FocusedInputEvents = {
|
|
21
|
+
addListener: () => ({
|
|
22
|
+
remove: NOOP
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
export const WindowDimensionsEvents = {
|
|
26
|
+
addListener: () => ({
|
|
27
|
+
remove: NOOP
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
export const KeyboardControllerView = View;
|
|
31
|
+
export const KeyboardGestureArea = View;
|
|
32
|
+
//# sourceMappingURL=bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","NOOP","KeyboardController","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputEventsModule,\r\n KeyboardControllerModule,\r\n KeyboardControllerProps,\r\n KeyboardEventsModule,\r\n KeyboardGestureAreaProps,\r\n WindowDimensionsEventsModule,\r\n} from \"./types\";\r\nimport type { EmitterSubscription } from \"react-native\";\r\n\r\nconst NOOP = () => {};\r\nexport const KeyboardController: KeyboardControllerModule = {\r\n setDefaultMode: NOOP,\r\n setInputMode: NOOP,\r\n dismiss: NOOP,\r\n setFocusTo: NOOP,\r\n addListener: NOOP,\r\n removeListeners: NOOP,\r\n};\r\nexport const KeyboardEvents: KeyboardEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\n/**\r\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\r\n * Use it with cautious.\r\n */\r\nexport const FocusedInputEvents: FocusedInputEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\r\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\r\n};\r\nexport const KeyboardControllerView =\r\n View as unknown as React.FC<KeyboardControllerProps>;\r\nexport const KeyboardGestureArea =\r\n View as unknown as React.FC<KeyboardGestureAreaProps>;\r\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,cAAc;AAYnC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,OAAO,MAAMC,kBAA4C,GAAG;EAC1DC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,UAAU,EAAEL,IAAI;EAChBM,WAAW,EAAEN,IAAI;EACjBO,eAAe,EAAEP;AACnB,CAAC;AACD,OAAO,MAAMQ,cAAoC,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMU,kBAA4C,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMW,sBAAoD,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMY,sBAAsB,GACjCb,IAAoD;AACtD,OAAO,MAAMc,mBAAmB,GAC9Bd,IAAqD","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NativeEventEmitter, Platform } from "react-native";
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ""
|
|
5
|
+
}) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
|
|
6
|
+
const RCTKeyboardController = require("./specs/NativeKeyboardController").default;
|
|
7
|
+
export const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
|
|
8
|
+
get() {
|
|
9
|
+
throw new Error(LINKING_ERROR);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const KEYBOARD_CONTROLLER_NAMESPACE = "KeyboardController::";
|
|
13
|
+
const eventEmitter = new NativeEventEmitter(KeyboardController);
|
|
14
|
+
export const KeyboardEvents = {
|
|
15
|
+
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
19
|
+
* Use it with cautious.
|
|
20
|
+
*/
|
|
21
|
+
export const FocusedInputEvents = {
|
|
22
|
+
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
23
|
+
};
|
|
24
|
+
export const WindowDimensionsEvents = {
|
|
25
|
+
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
26
|
+
};
|
|
27
|
+
export const KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
|
|
28
|
+
export const KeyboardGestureArea = Platform.OS === "android" && Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : ({
|
|
29
|
+
children
|
|
30
|
+
}) => children;
|
|
31
|
+
//# sourceMappingURL=bindings.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","RCTKeyboardController","require","KeyboardController","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputEventsModule,\r\n KeyboardControllerModule,\r\n KeyboardControllerProps,\r\n KeyboardEventsModule,\r\n KeyboardGestureAreaProps,\r\n WindowDimensionsEventsModule,\r\n} from \"./types\";\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\r\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\r\n \"- You rebuilt the app after installing the package\\n\" +\r\n \"- You are not using Expo Go\\n\";\r\n\r\nconst RCTKeyboardController =\r\n require(\"./specs/NativeKeyboardController\").default;\r\nexport const KeyboardController = (\r\n RCTKeyboardController\r\n ? RCTKeyboardController\r\n : new Proxy(\r\n {},\r\n {\r\n get() {\r\n throw new Error(LINKING_ERROR);\r\n },\r\n },\r\n )\r\n) as KeyboardControllerModule;\r\n\r\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\r\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\r\n\r\nexport const KeyboardEvents: KeyboardEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\n/**\r\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\r\n * Use it with cautious.\r\n */\r\nexport const FocusedInputEvents: FocusedInputEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\r\n addListener: (name, cb) =>\r\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\r\n};\r\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\r\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\r\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\r\n Platform.OS === \"android\" && Platform.Version >= 30\r\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\r\n : ({ children }: KeyboardGestureAreaProps) => children;\r\n"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAW3D,MAAMC,aAAa,GACjB,2FAA2F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBC,OAAO,CAAC,kCAAkC,CAAC,CAACF,OAAO;AACrD,OAAO,MAAMG,kBAAkB,GAC7BF,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAE7B,MAAMU,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIb,kBAAkB,CAACQ,kBAAkB,CAAC;AAE/D,OAAO,MAAMM,cAAoC,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAA4C,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD,OAAO,MAAME,sBAAoD,GAAG;EAClEJ,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBJ,YAAY,CAACE,WAAW,CAACH,6BAA6B,GAAGI,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD,OAAO,MAAMG,sBAAyD,GACpEb,OAAO,CAAC,+CAA+C,CAAC,CAACF,OAAO;AAClE,OAAO,MAAMgB,mBAAuD,GAClEpB,QAAQ,CAACqB,EAAE,KAAK,SAAS,IAAIrB,QAAQ,CAACsB,OAAO,IAAI,EAAE,GAC/ChB,OAAO,CAAC,4CAA4C,CAAC,CAACF,OAAO,GAC7D,CAAC;EAAEmB;AAAmC,CAAC,KAAKA,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useSharedValue } from "react-native-reanimated";
|
|
2
|
+
import { useKeyboardHandler } from "../../hooks";
|
|
3
|
+
import { useKeyboardContext } from "../../context";
|
|
4
|
+
import { Platform } from "react-native";
|
|
5
|
+
export const useKeyboardAnimation = () => {
|
|
6
|
+
const {
|
|
7
|
+
reanimated
|
|
8
|
+
} = useKeyboardContext();
|
|
9
|
+
const heightWhenOpened = useSharedValue(-reanimated.height.value);
|
|
10
|
+
const height = useSharedValue(-reanimated.height.value);
|
|
11
|
+
const progress = useSharedValue(reanimated.progress.value);
|
|
12
|
+
const isClosed = useSharedValue(reanimated.progress.value === 0);
|
|
13
|
+
useKeyboardHandler({
|
|
14
|
+
onStart: e => {
|
|
15
|
+
"worklet";
|
|
16
|
+
|
|
17
|
+
if (e.height > 0) {
|
|
18
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
19
|
+
isClosed.value = false;
|
|
20
|
+
heightWhenOpened.value = e.height;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onMove: e => {
|
|
24
|
+
"worklet";
|
|
25
|
+
|
|
26
|
+
progress.value = e.progress;
|
|
27
|
+
height.value = e.height;
|
|
28
|
+
},
|
|
29
|
+
onEnd: e => {
|
|
30
|
+
"worklet";
|
|
31
|
+
|
|
32
|
+
if (Platform.OS === 'harmony') {
|
|
33
|
+
heightWhenOpened.value = e.height;
|
|
34
|
+
}
|
|
35
|
+
isClosed.value = e.height === 0;
|
|
36
|
+
|
|
37
|
+
// `height` update happens in `onMove` handler
|
|
38
|
+
// in `onEnd` we need to update only if `onMove`
|
|
39
|
+
// wasn't called (i. e. duration === 0)
|
|
40
|
+
//
|
|
41
|
+
// we can not call this code without condition below
|
|
42
|
+
// because in some corner cases (iOS with `secureTextEntry`)
|
|
43
|
+
// `onEnd` can be emitted before `onMove` and in this case
|
|
44
|
+
// it may lead to choppy/glitchy/jumpy UI
|
|
45
|
+
// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327
|
|
46
|
+
if (e.duration === 0) {
|
|
47
|
+
progress.value = e.progress;
|
|
48
|
+
height.value = e.height;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
return {
|
|
53
|
+
height,
|
|
54
|
+
progress,
|
|
55
|
+
heightWhenOpened,
|
|
56
|
+
isClosed
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSharedValue","useKeyboardHandler","useKeyboardContext","Platform","useKeyboardAnimation","reanimated","heightWhenOpened","height","value","progress","isClosed","onStart","e","onMove","onEnd","OS","duration"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\r\n\r\nimport {useKeyboardHandler} from \"../../hooks\";\r\nimport {useKeyboardContext} from \"../../context\";\r\nimport { Platform } from \"react-native\";\r\n\r\nexport const useKeyboardAnimation = () => {\r\n const { reanimated } = useKeyboardContext();\r\n const heightWhenOpened = useSharedValue(-reanimated.height.value);\r\n const height = useSharedValue(-reanimated.height.value);\r\n const progress = useSharedValue(reanimated.progress.value);\r\n const isClosed = useSharedValue(reanimated.progress.value === 0);\r\n\r\n useKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n if (e.height > 0) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n isClosed.value = false;\r\n heightWhenOpened.value = e.height;\r\n }\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n \r\n progress.value = e.progress;\r\n height.value = e.height;\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n if(Platform.OS as string === 'harmony'){\r\n heightWhenOpened.value = e.height;\r\n }\r\n \r\n isClosed.value = e.height === 0;\r\n\r\n // `height` update happens in `onMove` handler\r\n // in `onEnd` we need to update only if `onMove`\r\n // wasn't called (i. e. duration === 0)\r\n //\r\n // we can not call this code without condition below\r\n // because in some corner cases (iOS with `secureTextEntry`)\r\n // `onEnd` can be emitted before `onMove` and in this case\r\n // it may lead to choppy/glitchy/jumpy UI\r\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\r\n if (e.duration === 0) {\r\n progress.value = e.progress;\r\n height.value = e.height;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n\r\n return { height, progress, heightWhenOpened, isClosed };\r\n};\r\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAExD,SAAQC,kBAAkB,QAAO,aAAa;AAC9C,SAAQC,kBAAkB,QAAO,eAAe;AAChD,SAASC,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAW,CAAC,GAAGH,kBAAkB,CAAC,CAAC;EAC3C,MAAMI,gBAAgB,GAAGN,cAAc,CAAC,CAACK,UAAU,CAACE,MAAM,CAACC,KAAK,CAAC;EACjE,MAAMD,MAAM,GAAGP,cAAc,CAAC,CAACK,UAAU,CAACE,MAAM,CAACC,KAAK,CAAC;EACvD,MAAMC,QAAQ,GAAGT,cAAc,CAACK,UAAU,CAACI,QAAQ,CAACD,KAAK,CAAC;EAC1D,MAAME,QAAQ,GAAGV,cAAc,CAACK,UAAU,CAACI,QAAQ,CAACD,KAAK,KA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