@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.1
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 +9 -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.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 +90 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +77 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +158 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +74 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +43 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +89 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +63 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +39 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +25 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +27 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +43 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +56 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +28 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +43 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +56 -0
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +46 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +46 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +210 -0
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +98 -0
- package/harmony/keyboard_controller/src/main/ets/Type.ts +41 -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 +9 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +174 -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 +25 -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 +166 -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 +19 -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 +177 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +246 -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,19 @@
|
|
|
1
|
+
// copied from `android.view.WindowManager.LayoutParams`
|
|
2
|
+
export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes) {
|
|
3
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_NOTHING"] = 48] = "SOFT_INPUT_ADJUST_NOTHING";
|
|
4
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_PAN"] = 32] = "SOFT_INPUT_ADJUST_PAN";
|
|
5
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_RESIZE"] = 16] = "SOFT_INPUT_ADJUST_RESIZE";
|
|
6
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_UNSPECIFIED"] = 0] = "SOFT_INPUT_ADJUST_UNSPECIFIED";
|
|
7
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_IS_FORWARD_NAVIGATION"] = 256] = "SOFT_INPUT_IS_FORWARD_NAVIGATION";
|
|
8
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_ADJUST"] = 240] = "SOFT_INPUT_MASK_ADJUST";
|
|
9
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_STATE"] = 15] = "SOFT_INPUT_MASK_STATE";
|
|
10
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MODE_CHANGED"] = 512] = "SOFT_INPUT_MODE_CHANGED";
|
|
11
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_HIDDEN"] = 3] = "SOFT_INPUT_STATE_ALWAYS_HIDDEN";
|
|
12
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_VISIBLE"] = 5] = "SOFT_INPUT_STATE_ALWAYS_VISIBLE";
|
|
13
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_HIDDEN"] = 2] = "SOFT_INPUT_STATE_HIDDEN";
|
|
14
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNCHANGED"] = 1] = "SOFT_INPUT_STATE_UNCHANGED";
|
|
15
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNSPECIFIED"] = 0] = "SOFT_INPUT_STATE_UNSPECIFIED";
|
|
16
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
|
|
17
|
+
return AndroidSoftInputModes;
|
|
18
|
+
}({});
|
|
19
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AndroidSoftInputModes"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":"AAAA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
const NOOP = () => {};
|
|
4
|
+
const withSharedValue = value => ({
|
|
5
|
+
value,
|
|
6
|
+
addListener: NOOP,
|
|
7
|
+
removeListener: NOOP,
|
|
8
|
+
modify: NOOP
|
|
9
|
+
});
|
|
10
|
+
const DEFAULT_SHARED_VALUE = withSharedValue(0);
|
|
11
|
+
const DEFAULT_LAYOUT = withSharedValue(null);
|
|
12
|
+
const defaultContext = {
|
|
13
|
+
enabled: true,
|
|
14
|
+
animated: {
|
|
15
|
+
progress: new Animated.Value(0),
|
|
16
|
+
height: new Animated.Value(0)
|
|
17
|
+
},
|
|
18
|
+
reanimated: {
|
|
19
|
+
progress: DEFAULT_SHARED_VALUE,
|
|
20
|
+
height: DEFAULT_SHARED_VALUE
|
|
21
|
+
},
|
|
22
|
+
layout: DEFAULT_LAYOUT,
|
|
23
|
+
setKeyboardHandlers: NOOP,
|
|
24
|
+
setInputHandlers: NOOP,
|
|
25
|
+
setEnabled: NOOP
|
|
26
|
+
};
|
|
27
|
+
export const KeyboardContext = /*#__PURE__*/createContext(defaultContext);
|
|
28
|
+
export const useKeyboardContext = () => {
|
|
29
|
+
const context = useContext(KeyboardContext);
|
|
30
|
+
if (__DEV__ && context === defaultContext) {
|
|
31
|
+
console.warn("Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.");
|
|
32
|
+
}
|
|
33
|
+
return context;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","Animated","NOOP","withSharedValue","value","addListener","removeListener","modify","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","useKeyboardContext","context","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\r\nimport { Animated } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputHandlers,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardHandlers,\r\n} from \"./types\";\r\nimport type React from \"react\";\r\nimport type { SharedValue } from \"react-native-reanimated\";\r\n\r\nexport type AnimatedContext = {\r\n progress: Animated.Value;\r\n height: Animated.AnimatedMultiplication<number>;\r\n};\r\nexport type ReanimatedContext = {\r\n progress: SharedValue<number>;\r\n height: SharedValue<number>;\r\n};\r\nexport type KeyboardAnimationContext = {\r\n enabled: boolean;\r\n animated: AnimatedContext;\r\n reanimated: ReanimatedContext;\r\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\r\n setKeyboardHandlers: (handlers: KeyboardHandlers) => void;\r\n setInputHandlers: (handlers: FocusedInputHandlers) => void;\r\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\r\n};\r\nconst NOOP = () => {};\r\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\r\n value,\r\n addListener: NOOP,\r\n removeListener: NOOP,\r\n modify: NOOP,\r\n});\r\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\r\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\r\n null,\r\n);\r\nconst defaultContext: KeyboardAnimationContext = {\r\n enabled: true,\r\n animated: {\r\n progress: new Animated.Value(0),\r\n height: new Animated.Value(0),\r\n },\r\n reanimated: {\r\n progress: DEFAULT_SHARED_VALUE,\r\n height: DEFAULT_SHARED_VALUE,\r\n },\r\n layout: DEFAULT_LAYOUT,\r\n setKeyboardHandlers: NOOP,\r\n setInputHandlers: NOOP,\r\n setEnabled: NOOP,\r\n};\r\nexport const KeyboardContext = createContext(defaultContext);\r\nexport const useKeyboardContext = () => {\r\n const context = useContext(KeyboardContext);\r\n if (__DEV__ && context === defaultContext) {\r\n console.warn(\r\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\r\n );\r\n }\r\n\r\n return context;\r\n};\r\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,QAAQ,QAAQ,cAAc;AA2BvC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,eAAe,GAAOC,KAAQ,KAAsB;EACxDA,KAAK;EACLC,WAAW,EAAEH,IAAI;EACjBI,cAAc,EAAEJ,IAAI;EACpBK,MAAM,EAAEL;AACV,CAAC,CAAC;AACF,MAAMM,oBAAoB,GAAGL,eAAe,CAAC,CAAC,CAAC;AAC/C,MAAMM,cAAc,GAAGN,eAAe,CACpC,IACF,CAAC;AACD,MAAMO,cAAwC,GAAG;EAC/CC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIZ,QAAQ,CAACa,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAId,QAAQ,CAACa,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVH,QAAQ,EAAEL,oBAAoB;IAC9BO,MAAM,EAAEP;EACV,CAAC;EACDS,MAAM,EAAER,cAAc;EACtBS,mBAAmB,EAAEhB,IAAI;EACzBiB,gBAAgB,EAAEjB,IAAI;EACtBkB,UAAU,EAAElB;AACd,CAAC;AACD,OAAO,MAAMmB,eAAe,gBAAGtB,aAAa,CAACW,cAAc,CAAC;AAC5D,OAAO,MAAMY,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAGvB,UAAU,CAACqB,eAAe,CAAC;EAC3C,IAAIG,OAAO,IAAID,OAAO,KAAKb,cAAc,EAAE;IACzCe,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { KeyboardController } from "../bindings";
|
|
3
|
+
import { AndroidSoftInputModes } from "../constants";
|
|
4
|
+
import { useKeyboardContext } from "../context";
|
|
5
|
+
import { uuid } from "../utils";
|
|
6
|
+
export const useResizeMode = () => {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
KeyboardController.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
|
|
9
|
+
return () => KeyboardController.setDefaultMode();
|
|
10
|
+
}, []);
|
|
11
|
+
};
|
|
12
|
+
export const useKeyboardAnimation = () => {
|
|
13
|
+
useResizeMode();
|
|
14
|
+
const context = useKeyboardContext();
|
|
15
|
+
return context.animated;
|
|
16
|
+
};
|
|
17
|
+
export const useReanimatedKeyboardAnimation = () => {
|
|
18
|
+
useResizeMode();
|
|
19
|
+
const context = useKeyboardContext();
|
|
20
|
+
return context.reanimated;
|
|
21
|
+
};
|
|
22
|
+
export function useGenericKeyboardHandler(handler, deps) {
|
|
23
|
+
const context = useKeyboardContext();
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const key = uuid();
|
|
26
|
+
context.setKeyboardHandlers({
|
|
27
|
+
[key]: handler
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
context.setKeyboardHandlers({
|
|
31
|
+
[key]: undefined
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}, deps);
|
|
35
|
+
}
|
|
36
|
+
export function useKeyboardHandler(handler, deps) {
|
|
37
|
+
useResizeMode();
|
|
38
|
+
useGenericKeyboardHandler(handler, deps);
|
|
39
|
+
}
|
|
40
|
+
export function useKeyboardController() {
|
|
41
|
+
const context = useKeyboardContext();
|
|
42
|
+
return {
|
|
43
|
+
setEnabled: context.setEnabled,
|
|
44
|
+
enabled: context.enabled
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function useReanimatedFocusedInput() {
|
|
48
|
+
const context = useKeyboardContext();
|
|
49
|
+
return {
|
|
50
|
+
input: context.layout
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function useFocusedInputHandler(handler, deps) {
|
|
54
|
+
const context = useKeyboardContext();
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const key = uuid();
|
|
57
|
+
context.setInputHandlers({
|
|
58
|
+
[key]: handler
|
|
59
|
+
});
|
|
60
|
+
return () => {
|
|
61
|
+
context.setInputHandlers({
|
|
62
|
+
[key]: undefined
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}, deps);
|
|
66
|
+
}
|
|
67
|
+
export * from "./useWindowDimensions";
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","KeyboardController","AndroidSoftInputModes","useKeyboardContext","uuid","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\r\n\r\nimport { KeyboardController } from \"../bindings\";\r\nimport { AndroidSoftInputModes } from \"../constants\";\r\nimport { useKeyboardContext } from \"../context\";\r\nimport { uuid } from \"../utils\";\r\n\r\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\r\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\r\nimport type { DependencyList } from \"react\";\r\n\r\nexport const useResizeMode = () => {\r\n useEffect(() => {\r\n KeyboardController.setInputMode(\r\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\r\n );\r\n\r\n return () => KeyboardController.setDefaultMode();\r\n }, []);\r\n};\r\n\r\nexport const useKeyboardAnimation = (): AnimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.animated;\r\n};\r\n\r\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.reanimated;\r\n};\r\n\r\nexport function useGenericKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setKeyboardHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setKeyboardHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport function useKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n useResizeMode();\r\n useGenericKeyboardHandler(handler, deps);\r\n}\r\n\r\nexport function useKeyboardController() {\r\n const context = useKeyboardContext();\r\n\r\n return { setEnabled: context.setEnabled, enabled: context.enabled };\r\n}\r\n\r\nexport function useReanimatedFocusedInput() {\r\n const context = useKeyboardContext();\r\n\r\n return { input: context.layout };\r\n}\r\n\r\nexport function useFocusedInputHandler(\r\n handler?: FocusedInputHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setInputHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setInputHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport * from \"./useWindowDimensions\";\r\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,kBAAkB,QAAQ,aAAa;AAChD,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,kBAAkB,QAAQ,YAAY;AAC/C,SAASC,IAAI,QAAQ,UAAU;AAM/B,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjCL,SAAS,CAAC,MAAM;IACdC,kBAAkB,CAACK,YAAY,CAC7BJ,qBAAqB,CAACK,wBACxB,CAAC;IAED,OAAO,MAAMN,kBAAkB,CAACO,cAAc,CAAC,CAAC;EAClD,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAuB;EACzDJ,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAOO,OAAO,CAACC,QAAQ;AACzB,CAAC;AAED,OAAO,MAAMC,8BAA8B,GAAGA,CAAA,KAAyB;EACrEP,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAOO,OAAO,CAACG,UAAU;AAC3B,CAAC;AAED,OAAO,SAASC,yBAAyBA,CACvCC,OAAwB,EACxBC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpCH,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGb,IAAI,CAAC,CAAC;IAElBM,OAAO,CAACQ,mBAAmB,CAAC;MAAE,CAACD,GAAG,GAAGF;IAAQ,CAAC,CAAC;IAE/C,OAAO,MAAM;MACXL,OAAO,CAACQ,mBAAmB,CAAC;QAAE,CAACD,GAAG,GAAGE;MAAU,CAAC,CAAC;IACnD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,OAAO,SAASI,kBAAkBA,CAChCL,OAAwB,EACxBC,IAAqB,EACrB;EACAX,aAAa,CAAC,CAAC;EACfS,yBAAyB,CAACC,OAAO,EAAEC,IAAI,CAAC;AAC1C;AAEA,OAAO,SAASK,qBAAqBA,CAAA,EAAG;EACtC,MAAMX,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAO;IAAEmB,UAAU,EAAEZ,OAAO,CAACY,UAAU;IAAEC,OAAO,EAAEb,OAAO,CAACa;EAAQ,CAAC;AACrE;AAEA,OAAO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,MAAMd,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpC,OAAO;IAAEsB,KAAK,EAAEf,OAAO,CAACgB;EAAO,CAAC;AAClC;AAEA,OAAO,SAASC,sBAAsBA,CACpCZ,OAA6B,EAC7BC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGP,kBAAkB,CAAC,CAAC;EAEpCH,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGb,IAAI,CAAC,CAAC;IAElBM,OAAO,CAACkB,gBAAgB,CAAC;MAAE,CAACX,GAAG,GAAGF;IAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM;MACXL,OAAO,CAACkB,gBAAgB,CAAC;QAAE,CAACX,GAAG,GAAGE;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,cAAc,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { WindowDimensionsEvents } from "../../bindings";
|
|
3
|
+
let initialDimensions = {
|
|
4
|
+
width: 0,
|
|
5
|
+
height: 0
|
|
6
|
+
};
|
|
7
|
+
WindowDimensionsEvents.addListener("windowDidResize", e => {
|
|
8
|
+
initialDimensions = e;
|
|
9
|
+
});
|
|
10
|
+
export const useWindowDimensions = () => {
|
|
11
|
+
const [dimensions, setDimensions] = useState(initialDimensions);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const subscription = WindowDimensionsEvents.addListener("windowDidResize", e => {
|
|
14
|
+
setDimensions(e);
|
|
15
|
+
});
|
|
16
|
+
return () => {
|
|
17
|
+
subscription.remove();
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
return dimensions;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","WindowDimensionsEvents","initialDimensions","width","height","addListener","e","useWindowDimensions","dimensions","setDimensions","subscription","remove"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\r\n\r\nimport { WindowDimensionsEvents } from \"../../bindings\";\r\n\r\nimport type { WindowDimensionsEventData } from \"../../types\";\r\n\r\nlet initialDimensions: WindowDimensionsEventData = {\r\n width: 0,\r\n height: 0,\r\n};\r\n\r\nWindowDimensionsEvents.addListener(\"windowDidResize\", (e) => {\r\n initialDimensions = e;\r\n});\r\n\r\nexport const useWindowDimensions = () => {\r\n const [dimensions, setDimensions] = useState(initialDimensions);\r\n\r\n useEffect(() => {\r\n const subscription = WindowDimensionsEvents.addListener(\r\n \"windowDidResize\",\r\n (e) => {\r\n setDimensions(e);\r\n },\r\n );\r\n\r\n return () => {\r\n subscription.remove();\r\n };\r\n }, []);\r\n\r\n return dimensions;\r\n};\r\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,sBAAsB,QAAQ,gBAAgB;AAIvD,IAAIC,iBAA4C,GAAG;EACjDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAEDH,sBAAsB,CAACI,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EAC3DJ,iBAAiB,GAAGI,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGT,QAAQ,CAACE,iBAAiB,CAAC;EAE/DH,SAAS,CAAC,MAAM;IACd,MAAMW,YAAY,GAAGT,sBAAsB,CAACI,WAAW,CACrD,iBAAiB,EAChBC,CAAC,IAAK;MACLG,aAAa,CAACH,CAAC,CAAC;IAClB,CACF,CAAC;IAED,OAAO,MAAM;MACXI,YAAY,CAACC,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOH,UAAU;AACnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useWindowDimensions"],"sources":["index.ts"],"sourcesContent":["export { useWindowDimensions } from \"react-native\";\r\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./bindings";
|
|
2
|
+
export * from "./animated";
|
|
3
|
+
export * from "./context";
|
|
4
|
+
export * from "./hooks";
|
|
5
|
+
export * from "./constants";
|
|
6
|
+
export * from "./types";
|
|
7
|
+
export { KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
|
|
8
|
+
// keyboard toolbar
|
|
9
|
+
KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./components";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\r\nexport * from \"./animated\";\r\nexport * from \"./context\";\r\nexport * from \"./hooks\";\r\nexport * from \"./constants\";\r\nexport * from \"./types\";\r\n\r\nexport {\r\n KeyboardAvoidingView,\r\n KeyboardStickyView,\r\n KeyboardAwareScrollView,\r\n // keyboard toolbar\r\n KeyboardToolbar,\r\n DefaultKeyboardToolbarTheme,\r\n} from \"./components\";\r\nexport type {\r\n KeyboardAvoidingViewProps,\r\n KeyboardStickyViewProps,\r\n KeyboardAwareScrollViewProps,\r\n KeyboardToolbarProps,\r\n} from \"./components\";\r\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AAEvB,SACEA,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,QACtB,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
import { useSharedValue } from "react-native-reanimated";
|
|
4
|
+
/**
|
|
5
|
+
* Hook for storing worklet handlers (objects with keys, where values are worklets).
|
|
6
|
+
* Returns methods for setting handlers and broadcasting events in them.
|
|
7
|
+
*
|
|
8
|
+
* T is a generic that looks like:
|
|
9
|
+
* @example
|
|
10
|
+
* {
|
|
11
|
+
* onEvent: () => {},
|
|
12
|
+
* onEvent2: () => {},
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export function useSharedHandlers() {
|
|
16
|
+
const handlers = useSharedValue({});
|
|
17
|
+
const jsHandlers = useRef({});
|
|
18
|
+
|
|
19
|
+
// since js -> worklet -> js call is asynchronous, we can not write handlers
|
|
20
|
+
// straight into shared variable (using current shared value as a previous result),
|
|
21
|
+
// since there may be a race condition in a call, and closure may have out-of-dated
|
|
22
|
+
// values. As a result, some of handlers may be not written to "all handlers" object.
|
|
23
|
+
// Below we are writing all handlers to `ref` and afterwards synchronize them with
|
|
24
|
+
// shared value (since `refs` are not referring to actual value in worklets).
|
|
25
|
+
// This approach allow us to update synchronously handlers in js thread (and it assures,
|
|
26
|
+
// that it will have all of them) and then update them in worklet thread (calls are
|
|
27
|
+
// happening in FIFO order, so we will always have actual value).
|
|
28
|
+
const updateSharedHandlers = () => {
|
|
29
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
30
|
+
handlers.value = jsHandlers.current;
|
|
31
|
+
};
|
|
32
|
+
const setHandlers = useCallback(handler => {
|
|
33
|
+
jsHandlers.current = {
|
|
34
|
+
...jsHandlers.current,
|
|
35
|
+
...handler
|
|
36
|
+
};
|
|
37
|
+
updateSharedHandlers();
|
|
38
|
+
}, []);
|
|
39
|
+
const broadcast = (type, event) => {
|
|
40
|
+
"worklet";
|
|
41
|
+
|
|
42
|
+
Object.keys(handlers.value).forEach(key => {
|
|
43
|
+
var _handlers$value$key, _handlers$value$key$t;
|
|
44
|
+
(_handlers$value$key = handlers.value[key]) === null || _handlers$value$key === void 0 || (_handlers$value$key$t = _handlers$value$key[type]) === null || _handlers$value$key$t === void 0 || _handlers$value$key$t.call(_handlers$value$key, event);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
return [setHandlers, broadcast];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* TS variant of `useAnimatedValue` hook which is added in RN 0.71
|
|
52
|
+
* A better alternative of storing animated values in refs, since
|
|
53
|
+
* it doesn't recreate a new `Animated.Value` object on every re-render
|
|
54
|
+
* and therefore consumes less memory. We can not use a variant from
|
|
55
|
+
* RN, since this library supports earlier versions of RN.
|
|
56
|
+
*
|
|
57
|
+
* @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937
|
|
58
|
+
*/
|
|
59
|
+
export function useAnimatedValue(initialValue, config) {
|
|
60
|
+
const ref = useRef(null);
|
|
61
|
+
if (ref.current == null) {
|
|
62
|
+
ref.current = new Animated.Value(initialValue, config);
|
|
63
|
+
}
|
|
64
|
+
return ref.current;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","Animated","useSharedValue","useSharedHandlers","handlers","jsHandlers","updateSharedHandlers","value","current","setHandlers","handler","broadcast","type","event","Object","keys","forEach","key","_handlers$value$key","_handlers$value$key$t","call","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\r\nimport { Animated } from \"react-native\";\r\nimport { useSharedValue } from \"react-native-reanimated\";\r\n\r\nimport type { Handlers } from \"./types\";\r\n\r\ntype UntypedHandler = Record<string, (event: never) => void>;\r\ntype SharedHandlersReturnType<T extends UntypedHandler> = [\r\n (handler: Handlers<T>) => void,\r\n <K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void,\r\n];\r\n\r\n/**\r\n * Hook for storing worklet handlers (objects with keys, where values are worklets).\r\n * Returns methods for setting handlers and broadcasting events in them.\r\n *\r\n * T is a generic that looks like:\r\n * @example\r\n * {\r\n * onEvent: () => {},\r\n * onEvent2: () => {},\r\n * }\r\n */\r\nexport function useSharedHandlers<\r\n T extends UntypedHandler,\r\n>(): SharedHandlersReturnType<T> {\r\n const handlers = useSharedValue<Handlers<T>>({});\r\n const jsHandlers = useRef<Handlers<T>>({});\r\n\r\n // since js -> worklet -> js call is asynchronous, we can not write handlers\r\n // straight into shared variable (using current shared value as a previous result),\r\n // since there may be a race condition in a call, and closure may have out-of-dated\r\n // values. As a result, some of handlers may be not written to \"all handlers\" object.\r\n // Below we are writing all handlers to `ref` and afterwards synchronize them with\r\n // shared value (since `refs` are not referring to actual value in worklets).\r\n // This approach allow us to update synchronously handlers in js thread (and it assures,\r\n // that it will have all of them) and then update them in worklet thread (calls are\r\n // happening in FIFO order, so we will always have actual value).\r\n const updateSharedHandlers = () => {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n handlers.value = jsHandlers.current;\r\n };\r\n const setHandlers = useCallback((handler: Handlers<T>) => {\r\n jsHandlers.current = {\r\n ...jsHandlers.current,\r\n ...handler,\r\n };\r\n updateSharedHandlers();\r\n }, []);\r\n const broadcast = <K extends keyof T>(\r\n type: K,\r\n event: Parameters<T[K]>[0],\r\n ) => {\r\n \"worklet\";\r\n\r\n Object.keys(handlers.value).forEach((key) => {\r\n handlers.value[key]?.[type]?.(event);\r\n });\r\n };\r\n\r\n return [setHandlers, broadcast];\r\n}\r\n\r\n/**\r\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\r\n * A better alternative of storing animated values in refs, since\r\n * it doesn't recreate a new `Animated.Value` object on every re-render\r\n * and therefore consumes less memory. We can not use a variant from\r\n * RN, since this library supports earlier versions of RN.\r\n *\r\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\r\n */\r\nexport function useAnimatedValue(\r\n initialValue: number,\r\n config?: Animated.AnimatedConfig,\r\n): Animated.Value {\r\n const ref = useRef<Animated.Value | null>(null);\r\n\r\n if (ref.current == null) {\r\n ref.current = new Animated.Value(initialValue, config);\r\n }\r\n\r\n return ref.current;\r\n}\r\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAAQ,yBAAyB;AAUxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAEA;EAC/B,MAAMC,QAAQ,GAAGF,cAAc,CAAc,CAAC,CAAC,CAAC;EAChD,MAAMG,UAAU,GAAGL,MAAM,CAAc,CAAC,CAAC,CAAC;;EAE1C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMM,oBAAoB,GAAGA,CAAA,KAAM;IACjC;IACAF,QAAQ,CAACG,KAAK,GAAGF,UAAU,CAACG,OAAO;EACrC,CAAC;EACD,MAAMC,WAAW,GAAGV,WAAW,CAAEW,OAAoB,IAAK;IACxDL,UAAU,CAACG,OAAO,GAAG;MACnB,GAAGH,UAAU,CAACG,OAAO;MACrB,GAAGE;IACL,CAAC;IACDJ,oBAAoB,CAAC,CAAC;EACxB,CAAC,EAAE,EAAE,CAAC;EACN,MAAMK,SAAS,GAAGA,CAChBC,IAAO,EACPC,KAA0B,KACvB;IACH,SAAS;;IAETC,MAAM,CAACC,IAAI,CAACX,QAAQ,CAACG,KAAK,CAAC,CAACS,OAAO,CAAEC,GAAG,IAAK;MAAA,IAAAC,mBAAA,EAAAC,qBAAA;MAC3C,CAAAD,mBAAA,GAAAd,QAAQ,CAACG,KAAK,CAACU,GAAG,CAAC,cAAAC,mBAAA,gBAAAC,qBAAA,GAAnBD,mBAAA,CAAsBN,IAAI,CAAC,cAAAO,qBAAA,eAA3BA,qBAAA,CAAAC,IAAA,CAAAF,mBAAA,EAA8BL,KAAK,CAAC;IACtC,CAAC,CAAC;EACJ,CAAC;EAED,OAAO,CAACJ,WAAW,EAAEE,SAAS,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,gBAAgBA,CAC9BC,YAAoB,EACpBC,MAAgC,EAChB;EAChB,MAAMC,GAAG,GAAGxB,MAAM,CAAwB,IAAI,CAAC;EAE/C,IAAIwB,GAAG,CAAChB,OAAO,IAAI,IAAI,EAAE;IACvBgB,GAAG,CAAChB,OAAO,GAAG,IAAIP,QAAQ,CAACwB,KAAK,CAACH,YAAY,EAAEC,MAAM,CAAC;EACxD;EAEA,OAAOC,GAAG,CAAChB,OAAO;AACpB","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-expect-error because there is no corresponding type definition
|
|
2
|
+
import * as NativeAndroidManager from "react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid";
|
|
3
|
+
const RCTStatusBarManagerCompat =
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
+
require("./specs/NativeStatusBarManagerCompat").default;
|
|
6
|
+
|
|
7
|
+
// Copy original default manager to keep its original state and methods
|
|
8
|
+
const OriginalNativeAndroidManager = {
|
|
9
|
+
...NativeAndroidManager.default
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Create a new object that modifies the necessary methods
|
|
13
|
+
// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
|
|
14
|
+
// in order to use library on all available platforms we have to monkey patch
|
|
15
|
+
// default RN implementation and use modern `WindowInsetsControllerCompat`.
|
|
16
|
+
const ModifiedNativeAndroidManager = {
|
|
17
|
+
...NativeAndroidManager.default,
|
|
18
|
+
// Spread original properties to keep existing functionality
|
|
19
|
+
setColor: (color, animated) => {
|
|
20
|
+
RCTStatusBarManagerCompat.setColor(color, animated);
|
|
21
|
+
},
|
|
22
|
+
setTranslucent: translucent => {
|
|
23
|
+
RCTStatusBarManagerCompat.setTranslucent(translucent);
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* - statusBarStyles can be:
|
|
27
|
+
* - 'default'
|
|
28
|
+
* - 'dark-content'
|
|
29
|
+
*/
|
|
30
|
+
setStyle: statusBarStyle => {
|
|
31
|
+
RCTStatusBarManagerCompat.setStyle(statusBarStyle);
|
|
32
|
+
},
|
|
33
|
+
setHidden: hidden => {
|
|
34
|
+
RCTStatusBarManagerCompat.setHidden(hidden);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Define a function to apply the monkey patch
|
|
39
|
+
export const applyMonkeyPatch = () => {
|
|
40
|
+
Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Define a function to revert changes back to the original state
|
|
44
|
+
export const revertMonkeyPatch = () => {
|
|
45
|
+
Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=monkey-patch.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeAndroidManager","RCTStatusBarManagerCompat","require","default","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","Object","assign","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\r\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\r\n\r\nconst RCTStatusBarManagerCompat =\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n require(\"./specs/NativeStatusBarManagerCompat\").default;\r\n\r\n// Copy original default manager to keep its original state and methods\r\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\r\n\r\n// Create a new object that modifies the necessary methods\r\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\r\n// in order to use library on all available platforms we have to monkey patch\r\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\r\nconst ModifiedNativeAndroidManager = {\r\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\r\n setColor: (color: number, animated: boolean): void => {\r\n RCTStatusBarManagerCompat.setColor(color, animated);\r\n },\r\n setTranslucent: (translucent: boolean): void => {\r\n RCTStatusBarManagerCompat.setTranslucent(translucent);\r\n },\r\n /**\r\n * - statusBarStyles can be:\r\n * - 'default'\r\n * - 'dark-content'\r\n */\r\n setStyle: (statusBarStyle?: string): void => {\r\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\r\n },\r\n setHidden: (hidden: boolean): void => {\r\n RCTStatusBarManagerCompat.setHidden(hidden);\r\n },\r\n};\r\n\r\n// Define a function to apply the monkey patch\r\nexport const applyMonkeyPatch = () => {\r\n Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);\r\n};\r\n\r\n// Define a function to revert changes back to the original state\r\nexport const revertMonkeyPatch = () => {\r\n Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);\r\n};\r\n"],"mappings":"AAAA;AACA,OAAO,KAAKA,oBAAoB,MAAM,2EAA2E;AAEjH,MAAMC,yBAAyB;AAC7B;AACAC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;;AAEzD;AACA,MAAMC,4BAA4B,GAAG;EAAE,GAAGJ,oBAAoB,CAACG;AAAQ,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAME,4BAA4B,GAAG;EACnC,GAAGL,oBAAoB,CAACG,OAAO;EAAE;EACjCG,QAAQ,EAAEA,CAACC,KAAa,EAAEC,QAAiB,KAAW;IACpDP,yBAAyB,CAACK,QAAQ,CAACC,KAAK,EAAEC,QAAQ,CAAC;EACrD,CAAC;EACDC,cAAc,EAAGC,WAAoB,IAAW;IAC9CT,yBAAyB,CAACQ,cAAc,CAACC,WAAW,CAAC;EACvD,CAAC;EACD;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAGC,cAAuB,IAAW;IAC3CX,yBAAyB,CAACU,QAAQ,CAACC,cAAc,CAAC;EACpD,CAAC;EACDC,SAAS,EAAGC,MAAe,IAAW;IACpCb,yBAAyB,CAACY,SAAS,CAACC,MAAM,CAAC;EAC7C;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpCC,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEE,4BAA4B,CAAC;AAC3E,CAAC;;AAED;AACA,OAAO,MAAMa,iBAAiB,GAAGA,CAAA,KAAM;EACrCF,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEC,4BAA4B,CAAC;AAC3E,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NOOP","applyMonkeyPatch","revertMonkeyPatch"],"sources":["monkey-patch.ts"],"sourcesContent":["// stub for all platforms\r\nconst NOOP = () => {};\r\nexport const applyMonkeyPatch = NOOP;\r\nexport const revertMonkeyPatch = NOOP;\r\n"],"mappings":"AAAA;AACA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,OAAO,MAAMC,gBAAgB,GAAGD,IAAI;AACpC,OAAO,MAAME,iBAAiB,GAAGF,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const NOOP = () => () => {};
|
|
2
|
+
export const useAnimatedKeyboardHandler = NOOP;
|
|
3
|
+
export const useFocusedInputLayoutHandler = NOOP;
|
|
4
|
+
export const useFocusedInputTextHandler = NOOP;
|
|
5
|
+
export const useFocusedInputSelectionHandler = NOOP;
|
|
6
|
+
//# sourceMappingURL=reanimated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NOOP","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputTextHandler","useFocusedInputSelectionHandler"],"sources":["reanimated.ts"],"sourcesContent":["import 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\nconst NOOP = () => () => {};\r\nexport const useAnimatedKeyboardHandler: KeyboardHandlerHook<\r\n Record<string, unknown>,\r\n EventWithName<NativeEvent>\r\n> = NOOP;\r\nexport const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<\r\n Record<string, unknown>,\r\n EventWithName<FocusedInputLayoutChangedEvent>\r\n> = NOOP;\r\nexport const useFocusedInputTextHandler: FocusedInputTextHandlerHook<\r\n Record<string, unknown>,\r\n EventWithName<FocusedInputTextChangedEvent>\r\n> = NOOP;\r\nexport const useFocusedInputSelectionHandler: FocusedInputSelectionHandlerHook<\r\n Record<string, unknown>,\r\n EventWithName<FocusedInputSelectionChangedEvent>\r\n> = NOOP;\r\n"],"mappings":"AAYA,MAAMA,IAAI,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAC3B,OAAO,MAAMC,0BAGZ,GAAGD,IAAI;AACR,OAAO,MAAME,4BAGZ,GAAGF,IAAI;AACR,OAAO,MAAMG,0BAGZ,GAAGH,IAAI;AACR,OAAO,MAAMI,+BAGZ,GAAGJ,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useEvent, useHandler } from "react-native-reanimated";
|
|
2
|
+
export const useAnimatedKeyboardHandler = (handlers, dependencies) => {
|
|
3
|
+
const {
|
|
4
|
+
context,
|
|
5
|
+
doDependenciesDiffer
|
|
6
|
+
} = useHandler(handlers, dependencies);
|
|
7
|
+
return useEvent(event => {
|
|
8
|
+
"worklet";
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
onKeyboardMoveStart,
|
|
12
|
+
onKeyboardMove,
|
|
13
|
+
onKeyboardMoveEnd,
|
|
14
|
+
onKeyboardMoveInteractive
|
|
15
|
+
} = handlers;
|
|
16
|
+
if (onKeyboardMoveStart && event.eventName.endsWith("onKeyboardMoveStart")) {
|
|
17
|
+
onKeyboardMoveStart(event, context);
|
|
18
|
+
}
|
|
19
|
+
if (onKeyboardMove && event.eventName.endsWith("onKeyboardMove")) {
|
|
20
|
+
onKeyboardMove(event, context);
|
|
21
|
+
}
|
|
22
|
+
if (onKeyboardMoveEnd && event.eventName.endsWith("onKeyboardMoveEnd")) {
|
|
23
|
+
onKeyboardMoveEnd(event, context);
|
|
24
|
+
}
|
|
25
|
+
if (onKeyboardMoveInteractive && event.eventName.endsWith("onKeyboardMoveInteractive")) {
|
|
26
|
+
onKeyboardMoveInteractive(event, context);
|
|
27
|
+
}
|
|
28
|
+
}, ["onKeyboardMoveStart", "onKeyboardMove", "onKeyboardMoveEnd", "onKeyboardMoveInteractive"], doDependenciesDiffer);
|
|
29
|
+
};
|
|
30
|
+
export const useFocusedInputLayoutHandler = (handlers, dependencies) => {
|
|
31
|
+
const {
|
|
32
|
+
context,
|
|
33
|
+
doDependenciesDiffer
|
|
34
|
+
} = useHandler(handlers, dependencies);
|
|
35
|
+
return useEvent(event => {
|
|
36
|
+
"worklet";
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
onFocusedInputLayoutChanged
|
|
40
|
+
} = handlers;
|
|
41
|
+
if (onFocusedInputLayoutChanged && event.eventName.endsWith("onFocusedInputLayoutChanged")) {
|
|
42
|
+
onFocusedInputLayoutChanged(event, context);
|
|
43
|
+
}
|
|
44
|
+
}, ["onFocusedInputLayoutChanged"], doDependenciesDiffer);
|
|
45
|
+
};
|
|
46
|
+
export const useFocusedInputTextHandler = (handlers, dependencies) => {
|
|
47
|
+
const {
|
|
48
|
+
context,
|
|
49
|
+
doDependenciesDiffer
|
|
50
|
+
} = useHandler(handlers, dependencies);
|
|
51
|
+
return useEvent(event => {
|
|
52
|
+
"worklet";
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
onFocusedInputTextChanged
|
|
56
|
+
} = handlers;
|
|
57
|
+
if (onFocusedInputTextChanged && event.eventName.endsWith("onFocusedInputTextChanged")) {
|
|
58
|
+
onFocusedInputTextChanged(event, context);
|
|
59
|
+
}
|
|
60
|
+
}, ["onFocusedInputTextChanged"], doDependenciesDiffer);
|
|
61
|
+
};
|
|
62
|
+
export const useFocusedInputSelectionHandler = (handlers, dependencies) => {
|
|
63
|
+
const {
|
|
64
|
+
context,
|
|
65
|
+
doDependenciesDiffer
|
|
66
|
+
} = useHandler(handlers, dependencies);
|
|
67
|
+
return useEvent(event => {
|
|
68
|
+
"worklet";
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
onFocusedInputSelectionChanged
|
|
72
|
+
} = handlers;
|
|
73
|
+
if (onFocusedInputSelectionChanged && event.eventName.endsWith("onFocusedInputSelectionChanged")) {
|
|
74
|
+
onFocusedInputSelectionChanged(event, context);
|
|
75
|
+
}
|
|
76
|
+
}, ["onFocusedInputSelectionChanged"], doDependenciesDiffer);
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=reanimated.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEvent","useHandler","useAnimatedKeyboardHandler","handlers","dependencies","context","doDependenciesDiffer","event","onKeyboardMoveStart","onKeyboardMove","onKeyboardMoveEnd","onKeyboardMoveInteractive","eventName","endsWith","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,SAASA,QAAQ,EAAEC,UAAU,QAAQ,yBAAyB;AAgB9D,OAAO,MAAMC,0BAGZ,GAAGA,CAACC,QAAQ,EAAEC,YAAY,KAAK;EAC9B,MAAM;IAAEC,OAAO;IAAEC;EAAqB,CAAC,GAAGL,UAAU,CAACE,QAAQ,EAAEC,YAAY,CAAC;EAE5E,OAAOJ,QAAQ,CACZO,KAAK,IAAK;IACT,SAAS;;IACT,MAAM;MACJC,mBAAmB;MACnBC,cAAc;MACdC,iBAAiB;MACjBC;IACF,CAAC,GAAGR,QAAQ;IAEZ,IACEK,mBAAmB,IACnBD,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,qBAAqB,CAAC,EAC/C;MACAL,mBAAmB,CAACD,KAAK,EAAEF,OAAO,CAAC;IACrC;IAEA,IAAII,cAAc,IAAIF,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;MAChEJ,cAAc,CAACF,KAAK,EAAEF,OAAO,CAAC;IAChC;IAEA,IAAIK,iBAAiB,IAAIH,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;MACtEH,iBAAiB,CAACH,KAAK,EAAEF,OAAO,CAAC;IACnC;IAEA,IACEM,yBAAyB,IACzBJ,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,2BAA2B,CAAC,EACrD;MACAF,yBAAyB,CAACJ,KAAK,EAAEF,OAAO,CAAC;IAC3C;EACF,CAAC,EACD,CACE,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,2BAA2B,CAC5B,EACDC,oBACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMQ,4BAGZ,GAAGA,CAACX,QAAQ,EAAEC,YAAY,KAAK;EAC9B,MAAM;IAAEC,OAAO;IAAEC;EAAqB,CAAC,GAAGL,UAAU,CAACE,QAAQ,EAAEC,YAAY,CAAC;EAE5E,OAAOJ,QAAQ,CACZO,KAAK,IAAK;IACT,SAAS;;IACT,MAAM;MAAEQ;IAA4B,CAAC,GAAGZ,QAAQ;IAEhD,IACEY,2BAA2B,IAC3BR,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,6BAA6B,CAAC,EACvD;MACAE,2BAA2B,CAACR,KAAK,EAAEF,OAAO,CAAC;IAC7C;EACF,CAAC,EACD,CAAC,6BAA6B,CAAC,EAC/BC,oBACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMU,0BAGZ,GAAGA,CAACb,QAAQ,EAAEC,YAAY,KAAK;EAC9B,MAAM;IAAEC,OAAO;IAAEC;EAAqB,CAAC,GAAGL,UAAU,CAACE,QAAQ,EAAEC,YAAY,CAAC;EAE5E,OAAOJ,QAAQ,CACZO,KAAK,IAAK;IACT,SAAS;;IACT,MAAM;MAAEU;IAA0B,CAAC,GAAGd,QAAQ;IAE9C,IACEc,yBAAyB,IACzBV,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,2BAA2B,CAAC,EACrD;MACAI,yBAAyB,CAACV,KAAK,EAAEF,OAAO,CAAC;IAC3C;EACF,CAAC,EACD,CAAC,2BAA2B,CAAC,EAC7BC,oBACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMY,+BAGZ,GAAGA,CAACf,QAAQ,EAAEC,YAAY,KAAK;EAC9B,MAAM;IAAEC,OAAO;IAAEC;EAAqB,CAAC,GAAGL,UAAU,CAACE,QAAQ,EAAEC,YAAY,CAAC;EAE5E,OAAOJ,QAAQ,CACZO,KAAK,IAAK;IACT,SAAS;;IACT,MAAM;MAAEY;IAA+B,CAAC,GAAGhB,QAAQ;IAEnD,IACEgB,8BAA8B,IAC9BZ,KAAK,CAACK,SAAS,CAACC,QAAQ,CAAC,gCAAgC,CAAC,EAC1D;MACAM,8BAA8B,CAACZ,KAAK,EAAEF,OAAO,CAAC;IAChD;EACF,CAAC,EACD,CAAC,gCAAgC,CAAC,EAClCC,oBACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["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,OAAOA,sBAAsB,MAAM,yDAAyD;AAmE5F,eAAeA,sBAAsB,CACnC,0BACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["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,OAAOA,sBAAsB,MAAM,yDAAyD;AAY5F,eAAeA,sBAAsB,CAAc,uBAAuB,EAAE;EAC1EC,iBAAiB,EAAE,CAAC,KAAK;AAC3B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["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,SAASA,mBAAmB,QAAQ,cAAc;AAkBlD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["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,SAASA,mBAAmB,QAAQ,cAAc;AAalD,eAAeA,mBAAmB,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"],"sources":["utils.ts"],"sourcesContent":["export const uuid = () => Math.random().toString(36).slice(-6);\r\n"],"mappings":"AAAA,OAAO,MAAMA,IAAI,GAAGA,CAAA,KAAMC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type KeyboardProviderProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Set the value to `true`, if you use translucent status bar on Android.
|
|
6
|
+
* If you already control status bar translucency via `react-native-screens`
|
|
7
|
+
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
8
|
+
* Defaults to `false`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
11
|
+
* @platform android
|
|
12
|
+
*/
|
|
13
|
+
statusBarTranslucent?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
16
|
+
* Defaults to `false`.
|
|
17
|
+
*
|
|
18
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
19
|
+
* @platform android
|
|
20
|
+
*/
|
|
21
|
+
navigationBarTranslucent?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state,
|
|
24
|
+
* i. e. if you try to change this prop after component mount it will not have any effect.
|
|
25
|
+
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
26
|
+
* Defaults to `true`.
|
|
27
|
+
*/
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare const KeyboardProvider: ({ children, statusBarTranslucent, navigationBarTranslucent, enabled: initiallyEnabled, }: KeyboardProviderProps) => React.JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FocusedInputEventsModule, KeyboardControllerModule, KeyboardControllerProps, KeyboardEventsModule, KeyboardGestureAreaProps, WindowDimensionsEventsModule } from "./types";
|
|
3
|
+
export declare const KeyboardController: KeyboardControllerModule;
|
|
4
|
+
export declare const KeyboardEvents: KeyboardEventsModule;
|
|
5
|
+
/**
|
|
6
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
7
|
+
* Use it with cautious.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FocusedInputEvents: FocusedInputEventsModule;
|
|
10
|
+
export declare const WindowDimensionsEvents: WindowDimensionsEventsModule;
|
|
11
|
+
export declare const KeyboardControllerView: import("react").FC<KeyboardControllerProps>;
|
|
12
|
+
export declare const KeyboardGestureArea: import("react").FC<KeyboardGestureAreaProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FocusedInputEventsModule, KeyboardControllerModule, KeyboardControllerProps, KeyboardEventsModule, KeyboardGestureAreaProps, WindowDimensionsEventsModule } from "./types";
|
|
3
|
+
export declare const KeyboardController: KeyboardControllerModule;
|
|
4
|
+
export declare const KeyboardEvents: KeyboardEventsModule;
|
|
5
|
+
/**
|
|
6
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
7
|
+
* Use it with cautious.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FocusedInputEvents: FocusedInputEventsModule;
|
|
10
|
+
export declare const WindowDimensionsEvents: WindowDimensionsEventsModule;
|
|
11
|
+
export declare const KeyboardControllerView: React.FC<KeyboardControllerProps>;
|
|
12
|
+
export declare const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const useKeyboardAnimation: () => {
|
|
2
|
+
height: import("react-native-reanimated").SharedValue<number>;
|
|
3
|
+
progress: import("react-native-reanimated").SharedValue<number>;
|
|
4
|
+
heightWhenOpened: import("react-native-reanimated").SharedValue<number>;
|
|
5
|
+
isClosed: import("react-native-reanimated").SharedValue<boolean>;
|
|
6
|
+
};
|