react-native-keyboard-controller 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +0 -40
- package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardAnimationCallback.kt +8 -4
- package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +44 -8
- package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManagerImpl.kt +6 -3
- package/android/src/main/java/com/reactnativekeyboardcontroller/events/KeyboardTransitionEvent.kt +2 -6
- package/ios/.swiftlint.yml +4 -0
- package/ios/KeyboardController.xcodeproj/project.pbxproj +2 -2
- package/ios/KeyboardControllerModule.mm +1 -1
- package/ios/KeyboardControllerView.mm +28 -10
- package/ios/KeyboardControllerViewManager.mm +2 -0
- package/ios/KeyboardControllerViewManager.swift +4 -1
- package/ios/KeyboardMoveEvent.h +1 -0
- package/ios/KeyboardMoveEvent.m +2 -1
- package/ios/KeyboardMovementObserver.swift +89 -4
- package/lib/commonjs/animated.js +44 -63
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/context.js +29 -0
- package/lib/commonjs/context.js.map +1 -0
- package/lib/commonjs/hooks.js +64 -0
- package/lib/commonjs/hooks.js.map +1 -0
- package/lib/commonjs/index.js +39 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +91 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/monkey-patch.js +3 -3
- package/lib/commonjs/monkey-patch.js.map +1 -1
- package/lib/commonjs/native.js +24 -21
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/replicas.js +2 -2
- package/lib/commonjs/replicas.js.map +1 -1
- package/lib/commonjs/{KeyboardControllerViewNativeComponent.js → specs/KeyboardControllerViewNativeComponent.js} +0 -0
- package/lib/commonjs/{KeyboardControllerViewNativeComponent.js.map → specs/KeyboardControllerViewNativeComponent.js.map} +1 -1
- package/lib/commonjs/{NativeKeyboardController.js → specs/NativeKeyboardController.js} +0 -0
- package/lib/commonjs/{NativeKeyboardController.js.map → specs/NativeKeyboardController.js.map} +0 -0
- package/lib/commonjs/{NativeStatusBarManagerCompat.js → specs/NativeStatusBarManagerCompat.js} +0 -0
- package/lib/commonjs/{NativeStatusBarManagerCompat.js.map → specs/NativeStatusBarManagerCompat.js.map} +0 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +11 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/animated.js +43 -55
- package/lib/module/animated.js.map +1 -1
- package/lib/module/context.js +19 -0
- package/lib/module/context.js.map +1 -0
- package/lib/module/hooks.js +39 -0
- package/lib/module/hooks.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +80 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/monkey-patch.js +4 -3
- package/lib/module/monkey-patch.js.map +1 -1
- package/lib/module/native.js +23 -17
- package/lib/module/native.js.map +1 -1
- package/lib/module/replicas.js +1 -1
- package/lib/module/replicas.js.map +1 -1
- package/lib/module/{KeyboardControllerViewNativeComponent.js → specs/KeyboardControllerViewNativeComponent.js} +0 -0
- package/lib/module/{KeyboardControllerViewNativeComponent.js.map → specs/KeyboardControllerViewNativeComponent.js.map} +1 -1
- package/lib/module/{NativeKeyboardController.js → specs/NativeKeyboardController.js} +0 -0
- package/lib/module/{NativeKeyboardController.js.map → specs/NativeKeyboardController.js.map} +0 -0
- package/lib/module/{NativeStatusBarManagerCompat.js → specs/NativeStatusBarManagerCompat.js} +0 -0
- package/lib/module/{NativeStatusBarManagerCompat.js.map → specs/NativeStatusBarManagerCompat.js.map} +0 -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 +1 -17
- package/lib/typescript/context.d.ts +18 -0
- package/lib/typescript/hooks.d.ts +8 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/internal.d.ts +21 -0
- package/lib/typescript/native.d.ts +14 -26
- package/lib/typescript/{KeyboardControllerViewNativeComponent.d.ts → specs/KeyboardControllerViewNativeComponent.d.ts} +2 -0
- package/lib/typescript/{NativeKeyboardController.d.ts → specs/NativeKeyboardController.d.ts} +0 -0
- package/lib/typescript/{NativeStatusBarManagerCompat.d.ts → specs/NativeStatusBarManagerCompat.d.ts} +0 -0
- package/lib/typescript/types.d.ts +32 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/package.json +17 -20
- package/react-native-keyboard-controller.podspec +2 -1
- package/src/animated.tsx +42 -78
- package/src/context.ts +31 -0
- package/src/hooks.ts +56 -0
- package/src/index.ts +3 -0
- package/src/internal.ts +87 -0
- package/src/{monkey-patch.tsx → monkey-patch.ts} +3 -6
- package/src/native.ts +37 -66
- package/src/replicas.ts +1 -1
- package/src/{KeyboardControllerViewNativeComponent.ts → specs/KeyboardControllerViewNativeComponent.ts} +4 -0
- package/src/{NativeKeyboardController.ts → specs/NativeKeyboardController.ts} +0 -0
- package/src/{NativeStatusBarManagerCompat.ts → specs/NativeStatusBarManagerCompat.ts} +0 -0
- package/src/types.ts +60 -0
- package/src/utils.ts +1 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerComponentsRegistry.kt +0 -31
- package/android/src/main/jni/Android.mk +0 -42
- package/android/src/main/jni/KeyboardControllerComponentsRegistry.cpp +0 -71
- package/android/src/main/jni/KeyboardControllerComponentsRegistry.h +0 -35
- package/android/src/main/jni/OnLoad.cpp +0 -9
- package/lib/commonjs/architecture.js +0 -13
- package/lib/commonjs/architecture.js.map +0 -1
- package/lib/module/architecture.js +0 -5
- package/lib/module/architecture.js.map +0 -1
- package/lib/typescript/architecture.d.ts +0 -2
- package/src/architecture.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","
|
|
1
|
+
{"version":3,"names":["KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","KeyboardProvider","children","statusBarTranslucent","progress","useRef","Value","current","height","progressSV","useSharedValue","heightSV","setHandlers","broadcast","useSharedHandlers","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","Platform","OS","value","handler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","undefined"],"sources":["animated.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport { Animated, Platform, StyleSheet, ViewStyle } from 'react-native';\nimport Reanimated, { useSharedValue } from 'react-native-reanimated';\n\nimport { KeyboardContext } from './context';\nimport { useAnimatedKeyboardHandler, useSharedHandlers } from './internal';\nimport { KeyboardControllerView } from './native';\n\nimport type {\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from './types';\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView\n ) as React.FC<KeyboardControllerProps>\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nexport const styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: 'none',\n position: 'absolute',\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n};\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n}: KeyboardProviderProps) => {\n // animated values\n const progress = useRef(new Animated.Value(0)).current;\n const height = useRef(new Animated.Value(0)).current;\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const { setHandlers, broadcast } = useSharedHandlers<KeyboardHandler>();\n // memo\n const context = useMemo(\n () => ({\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n setHandlers,\n }),\n []\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n []\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver: true }\n ),\n []\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n 'worklet';\n\n if (platforms.includes(Platform.OS)) {\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const handler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n 'worklet';\n\n broadcast('onStart', event);\n updateSharedValues(event, ['ios']);\n },\n onKeyboardMove: (event: NativeEvent) => {\n 'worklet';\n\n broadcast('onMove', event);\n updateSharedValues(event, ['android']);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n 'worklet';\n\n broadcast('onEnd', event);\n },\n },\n []\n );\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n onKeyboardMoveReanimated={handler}\n onKeyboardMoveStart={Platform.OS === 'ios' ? onKeyboardMove : undefined}\n onKeyboardMove={Platform.OS === 'android' ? onKeyboardMove : undefined}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\n >\n <>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n {children}\n </>\n </KeyboardControllerViewAnimated>\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAQA,MAAMA,8BAA8B,GAAGC,8BAAA,CAAWC,uBAAX,CACrCC,qBAAA,CAASD,uBAAT,CACEE,8BADF,CADqC,CAAvC;;AAWO,MAAMC,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAA0B;EAC9CC,SAAS,EAAE;IACTC,IAAI,EAAE;EADG,CADmC;EAI9CC,MAAM,EAAE;IACNC,OAAO,EAAE,MADH;IAENC,QAAQ,EAAE;EAFJ;AAJsC,CAA1B,CAAf;;;;AAwBA,MAAMC,gBAAgB,GAAG,QAGH;EAAA,IAHI;IAC/BC,QAD+B;IAE/BC;EAF+B,CAGJ;EAC3B;EACA,MAAMC,QAAQ,GAAG,IAAAC,aAAA,EAAO,IAAId,qBAAA,CAASe,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAA/C;EACA,MAAMC,MAAM,GAAG,IAAAH,aAAA,EAAO,IAAId,qBAAA,CAASe,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAA7C,CAH2B,CAI3B;;EACA,MAAME,UAAU,GAAG,IAAAC,qCAAA,EAAe,CAAf,CAAnB;EACA,MAAMC,QAAQ,GAAG,IAAAD,qCAAA,EAAe,CAAf,CAAjB;EACA,MAAM;IAAEE,WAAF;IAAeC;EAAf,IAA6B,IAAAC,2BAAA,GAAnC,CAP2B,CAQ3B;;EACA,MAAMC,OAAO,GAAG,IAAAC,cAAA,EACd,OAAO;IACLC,QAAQ,EAAE;MAAEb,QAAQ,EAAEA,QAAZ;MAAsBI,MAAM,EAAEjB,qBAAA,CAAS2B,QAAT,CAAkBV,MAAlB,EAA0B,CAAC,CAA3B;IAA9B,CADL;IAELW,UAAU,EAAE;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EAZ,SAAS,CAAC,OAAD,EAAUY,KAAV,CAAT;IACD;EAjBH,CADc,EAoBd,EApBc,CAAhB;EAuBA,oBACE,6BAAC,wBAAD,CAAiB,QAAjB;IAA0B,KAAK,EAAEV;EAAjC,gBACE,6BAAC,8BAAD;IACE,wBAAwB,EAAEmB,OAD5B;IAEE,mBAAmB,EAAEH,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwBR,cAAxB,GAAyCc,SAFhE;IAGE,cAAc,EAAEP,qBAAA,CAASC,EAAT,KAAgB,SAAhB,GAA4BR,cAA5B,GAA6Cc,SAH/D;IAIE,oBAAoB,EAAEnC,oBAJxB;IAKE,KAAK,EAAEV,MAAM,CAACG;EALhB,gBAOE,yEACE,6BAAC,qBAAD,CAAU,IAAV;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,KAAK,EAAEwB;EATT,EADF,EAYGlB,QAZH,CAPF,CADF,CADF;AA0BD,CApGM"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.KeyboardContext = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
const defaultContext = {
|
|
13
|
+
animated: {
|
|
14
|
+
progress: new _reactNative.Animated.Value(0),
|
|
15
|
+
height: new _reactNative.Animated.Value(0)
|
|
16
|
+
},
|
|
17
|
+
reanimated: {
|
|
18
|
+
progress: {
|
|
19
|
+
value: 0
|
|
20
|
+
},
|
|
21
|
+
height: {
|
|
22
|
+
value: 0
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
setHandlers: () => {}
|
|
26
|
+
};
|
|
27
|
+
const KeyboardContext = /*#__PURE__*/(0, _react.createContext)(defaultContext);
|
|
28
|
+
exports.KeyboardContext = KeyboardContext;
|
|
29
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultContext","animated","progress","Animated","Value","height","reanimated","value","setHandlers","KeyboardContext","createContext"],"sources":["context.ts"],"sourcesContent":["import { createContext } from 'react';\nimport { Animated } from 'react-native';\n\nimport type { SharedValue } from 'react-native-reanimated';\nimport type { KeyboardHandlers } from './types';\n\nexport type AnimatedContext = {\n progress: Animated.Value;\n height: Animated.AnimatedMultiplication<number>;\n};\nexport type ReanimatedContext = {\n progress: SharedValue<number>;\n height: SharedValue<number>;\n};\nexport type KeyboardAnimationContext = {\n animated: AnimatedContext;\n reanimated: ReanimatedContext;\n setHandlers: (handlers: KeyboardHandlers) => void;\n};\nconst defaultContext: KeyboardAnimationContext = {\n animated: {\n progress: new Animated.Value(0),\n height: new Animated.Value(0),\n },\n reanimated: {\n progress: { value: 0 },\n height: { value: 0 },\n },\n setHandlers: () => {},\n};\nexport const KeyboardContext = createContext(defaultContext);\n"],"mappings":";;;;;;;AAAA;;AACA;;AAkBA,MAAMA,cAAwC,GAAG;EAC/CC,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIC,qBAAA,CAASC,KAAb,CAAmB,CAAnB,CADF;IAERC,MAAM,EAAE,IAAIF,qBAAA,CAASC,KAAb,CAAmB,CAAnB;EAFA,CADqC;EAK/CE,UAAU,EAAE;IACVJ,QAAQ,EAAE;MAAEK,KAAK,EAAE;IAAT,CADA;IAEVF,MAAM,EAAE;MAAEE,KAAK,EAAE;IAAT;EAFE,CALmC;EAS/CC,WAAW,EAAE,MAAM,CAAE;AAT0B,CAAjD;AAWO,MAAMC,eAAe,gBAAG,IAAAC,oBAAA,EAAcV,cAAd,CAAxB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useGenericKeyboardHandler = useGenericKeyboardHandler;
|
|
7
|
+
exports.useKeyboardAnimation = void 0;
|
|
8
|
+
exports.useKeyboardHandler = useKeyboardHandler;
|
|
9
|
+
exports.useResizeMode = exports.useReanimatedKeyboardAnimation = void 0;
|
|
10
|
+
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
|
|
13
|
+
var _context = require("./context");
|
|
14
|
+
|
|
15
|
+
var _native = require("./native");
|
|
16
|
+
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
|
|
19
|
+
const useResizeMode = () => {
|
|
20
|
+
(0, _react.useEffect)(() => {
|
|
21
|
+
_native.KeyboardController.setInputMode(_native.AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
|
|
22
|
+
|
|
23
|
+
return () => _native.KeyboardController.setDefaultMode();
|
|
24
|
+
}, []);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.useResizeMode = useResizeMode;
|
|
28
|
+
|
|
29
|
+
const useKeyboardAnimation = () => {
|
|
30
|
+
useResizeMode();
|
|
31
|
+
const context = (0, _react.useContext)(_context.KeyboardContext);
|
|
32
|
+
return context.animated;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.useKeyboardAnimation = useKeyboardAnimation;
|
|
36
|
+
|
|
37
|
+
const useReanimatedKeyboardAnimation = () => {
|
|
38
|
+
useResizeMode();
|
|
39
|
+
const context = (0, _react.useContext)(_context.KeyboardContext);
|
|
40
|
+
return context.reanimated;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.useReanimatedKeyboardAnimation = useReanimatedKeyboardAnimation;
|
|
44
|
+
|
|
45
|
+
function useGenericKeyboardHandler(handler, deps) {
|
|
46
|
+
const context = (0, _react.useContext)(_context.KeyboardContext);
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
const key = (0, _utils.uuid)();
|
|
49
|
+
context.setHandlers({
|
|
50
|
+
[key]: handler
|
|
51
|
+
});
|
|
52
|
+
return () => {
|
|
53
|
+
context.setHandlers({
|
|
54
|
+
[key]: undefined
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}, deps);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function useKeyboardHandler(handler, deps) {
|
|
61
|
+
useResizeMode();
|
|
62
|
+
useGenericKeyboardHandler(handler, deps);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useContext","KeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","uuid","setHandlers","undefined","useKeyboardHandler"],"sources":["hooks.ts"],"sourcesContent":["import { DependencyList, useContext, useEffect } from 'react';\n\nimport { AnimatedContext, KeyboardContext, ReanimatedContext } from './context';\nimport { AndroidSoftInputModes, KeyboardController } from './native';\nimport { uuid } from './utils';\n\nimport type { KeyboardHandler } from './types';\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useContext(KeyboardContext);\n\n return context.animated;\n};\n\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useContext(KeyboardContext);\n\n return context.reanimated;\n};\n\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList\n) {\n const context = useContext(KeyboardContext);\n\n useEffect(() => {\n const key = uuid();\n\n context.setHandlers({ [key]: handler });\n\n return () => {\n context.setHandlers({ [key]: undefined });\n };\n }, deps);\n}\n\nexport function useKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList\n) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n"],"mappings":";;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAIO,MAAMA,aAAa,GAAG,MAAM;EACjC,IAAAC,gBAAA,EAAU,MAAM;IACdC,0BAAA,CAAmBC,YAAnB,CACEC,6BAAA,CAAsBC,wBADxB;;IAIA,OAAO,MAAMH,0BAAA,CAAmBI,cAAnB,EAAb;EACD,CAND,EAMG,EANH;AAOD,CARM;;;;AAUA,MAAMC,oBAAoB,GAAG,MAAuB;EACzDP,aAAa;EACb,MAAMQ,OAAO,GAAG,IAAAC,iBAAA,EAAWC,wBAAX,CAAhB;EAEA,OAAOF,OAAO,CAACG,QAAf;AACD,CALM;;;;AAOA,MAAMC,8BAA8B,GAAG,MAAyB;EACrEZ,aAAa;EACb,MAAMQ,OAAO,GAAG,IAAAC,iBAAA,EAAWC,wBAAX,CAAhB;EAEA,OAAOF,OAAO,CAACK,UAAf;AACD,CALM;;;;AAOA,SAASC,yBAAT,CACLC,OADK,EAELC,IAFK,EAGL;EACA,MAAMR,OAAO,GAAG,IAAAC,iBAAA,EAAWC,wBAAX,CAAhB;EAEA,IAAAT,gBAAA,EAAU,MAAM;IACd,MAAMgB,GAAG,GAAG,IAAAC,WAAA,GAAZ;IAEAV,OAAO,CAACW,WAAR,CAAoB;MAAE,CAACF,GAAD,GAAOF;IAAT,CAApB;IAEA,OAAO,MAAM;MACXP,OAAO,CAACW,WAAR,CAAoB;QAAE,CAACF,GAAD,GAAOG;MAAT,CAApB;IACD,CAFD;EAGD,CARD,EAQGJ,IARH;AASD;;AAEM,SAASK,kBAAT,CACLN,OADK,EAELC,IAFK,EAGL;EACAhB,aAAa;EACbc,yBAAyB,CAACC,OAAD,EAAUC,IAAV,CAAzB;AACD"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -44,4 +44,43 @@ Object.keys(_replicas).forEach(function (key) {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
var _context = require("./context");
|
|
49
|
+
|
|
50
|
+
Object.keys(_context).forEach(function (key) {
|
|
51
|
+
if (key === "default" || key === "__esModule") return;
|
|
52
|
+
if (key in exports && exports[key] === _context[key]) return;
|
|
53
|
+
Object.defineProperty(exports, key, {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return _context[key];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
var _hooks = require("./hooks");
|
|
62
|
+
|
|
63
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
64
|
+
if (key === "default" || key === "__esModule") return;
|
|
65
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
66
|
+
Object.defineProperty(exports, key, {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _hooks[key];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
var _types = require("./types");
|
|
75
|
+
|
|
76
|
+
Object.keys(_types).forEach(function (key) {
|
|
77
|
+
if (key === "default" || key === "__esModule") return;
|
|
78
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
79
|
+
Object.defineProperty(exports, key, {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _types[key];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
47
86
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import './monkey-patch';\n\nexport * from './native';\nexport * from './animated';\nexport * from './replicas';\n"],"mappings":";;;;;;AAAA;;AAEA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import './monkey-patch';\n\nexport * from './native';\nexport * from './animated';\nexport * from './replicas';\nexport * from './context';\nexport * from './hooks';\nexport * from './types';\n"],"mappings":";;;;;;AAAA;;AAEA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAnimatedKeyboardHandler = useAnimatedKeyboardHandler;
|
|
7
|
+
exports.useSharedHandlers = useSharedHandlers;
|
|
8
|
+
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
|
|
11
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
12
|
+
|
|
13
|
+
function useAnimatedKeyboardHandler(handlers, dependencies) {
|
|
14
|
+
const {
|
|
15
|
+
context,
|
|
16
|
+
doDependenciesDiffer
|
|
17
|
+
} = (0, _reactNativeReanimated.useHandler)(handlers, dependencies);
|
|
18
|
+
return (0, _reactNativeReanimated.useEvent)(event => {
|
|
19
|
+
'worklet';
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
onKeyboardMoveStart,
|
|
23
|
+
onKeyboardMove,
|
|
24
|
+
onKeyboardMoveEnd
|
|
25
|
+
} = handlers;
|
|
26
|
+
|
|
27
|
+
if (onKeyboardMoveStart && event.eventName.endsWith('onKeyboardMoveStart')) {
|
|
28
|
+
onKeyboardMoveStart(event, context);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (onKeyboardMove && event.eventName.endsWith('onKeyboardMove')) {
|
|
32
|
+
onKeyboardMove(event, context);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (onKeyboardMoveEnd && event.eventName.endsWith('onKeyboardMoveEnd')) {
|
|
36
|
+
onKeyboardMoveEnd(event, context);
|
|
37
|
+
}
|
|
38
|
+
}, ['onKeyboardMoveStart', 'onKeyboardMove', 'onKeyboardMoveEnd'], doDependenciesDiffer);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Hook for storing worklet handlers (objects with keys, where values are worklets).
|
|
42
|
+
* Returns methods for setting handlers and broadcasting events in them.
|
|
43
|
+
*
|
|
44
|
+
* T is a generic that looks like:
|
|
45
|
+
* @example
|
|
46
|
+
* {
|
|
47
|
+
* onEvent: () => {},
|
|
48
|
+
* onEvent2: () => {},
|
|
49
|
+
* }
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
function useSharedHandlers() {
|
|
54
|
+
const handlers = (0, _reactNativeReanimated.useSharedValue)({});
|
|
55
|
+
const jsHandlers = (0, _react.useRef)({}); // since js -> worklet -> js call is asynchronous, we can not write handlers
|
|
56
|
+
// straight into shared variable (using current shared value as a previous result),
|
|
57
|
+
// since there may be a race condition in a call, and closure may have out-of-dated
|
|
58
|
+
// values. As a result, some of handlers may be not written to "all handlers" object.
|
|
59
|
+
// Below we are writing all handlers to `ref` and afterwards synchronize them with
|
|
60
|
+
// shared value (since `refs` are not referring to actual value in worklets).
|
|
61
|
+
// This approach allow us to update synchronously handlers in js thread (and it assures,
|
|
62
|
+
// that it will have all of them) and then update them in worklet thread (calls are
|
|
63
|
+
// happening in FIFO order, so we will always have actual value).
|
|
64
|
+
|
|
65
|
+
const updateSharedHandlers = () => {
|
|
66
|
+
handlers.value = jsHandlers.current;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const setHandlers = (0, _react.useCallback)(handler => {
|
|
70
|
+
jsHandlers.current = { ...jsHandlers.current,
|
|
71
|
+
...handler
|
|
72
|
+
};
|
|
73
|
+
updateSharedHandlers();
|
|
74
|
+
}, []);
|
|
75
|
+
|
|
76
|
+
const broadcast = (type, event) => {
|
|
77
|
+
'worklet';
|
|
78
|
+
|
|
79
|
+
Object.keys(handlers.value).forEach(key => {
|
|
80
|
+
var _handlers$value$key, _handlers$value$key$t;
|
|
81
|
+
|
|
82
|
+
return (_handlers$value$key = handlers.value[key]) === null || _handlers$value$key === void 0 ? void 0 : (_handlers$value$key$t = _handlers$value$key[type]) === null || _handlers$value$key$t === void 0 ? void 0 : _handlers$value$key$t.call(_handlers$value$key, event);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
setHandlers,
|
|
88
|
+
broadcast
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useAnimatedKeyboardHandler","handlers","dependencies","context","doDependenciesDiffer","useHandler","useEvent","event","onKeyboardMoveStart","onKeyboardMove","onKeyboardMoveEnd","eventName","endsWith","useSharedHandlers","useSharedValue","jsHandlers","useRef","updateSharedHandlers","value","current","setHandlers","useCallback","handler","broadcast","type","Object","keys","forEach","key"],"sources":["internal.ts"],"sourcesContent":["import { useCallback, useRef } from 'react';\nimport { useEvent, useHandler, useSharedValue } from 'react-native-reanimated';\n\nimport type { EventWithName, Handlers, NativeEvent } from './types';\n\nexport function useAnimatedKeyboardHandler<\n TContext extends Record<string, unknown>\n>(\n handlers: {\n onKeyboardMoveStart?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMove?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMoveEnd?: (e: NativeEvent, context: TContext) => void;\n },\n dependencies?: ReadonlyArray<unknown>\n) {\n const { context, doDependenciesDiffer } = useHandler(handlers, dependencies);\n\n return useEvent(\n (event: EventWithName<NativeEvent>) => {\n 'worklet';\n const { onKeyboardMoveStart, onKeyboardMove, onKeyboardMoveEnd } =\n handlers;\n\n if (\n onKeyboardMoveStart &&\n event.eventName.endsWith('onKeyboardMoveStart')\n ) {\n onKeyboardMoveStart(event, context);\n }\n\n if (onKeyboardMove && event.eventName.endsWith('onKeyboardMove')) {\n onKeyboardMove(event, context);\n }\n\n if (onKeyboardMoveEnd && event.eventName.endsWith('onKeyboardMoveEnd')) {\n onKeyboardMoveEnd(event, context);\n }\n },\n ['onKeyboardMoveStart', 'onKeyboardMove', 'onKeyboardMoveEnd'],\n doDependenciesDiffer\n );\n}\n\n/**\n * Hook for storing worklet handlers (objects with keys, where values are worklets).\n * Returns methods for setting handlers and broadcasting events in them.\n *\n * T is a generic that looks like:\n * @example\n * {\n * onEvent: () => {},\n * onEvent2: () => {},\n * }\n */\nexport function useSharedHandlers<T extends Record<string, Function>>() {\n const handlers = useSharedValue<Handlers<T>>({});\n const jsHandlers = useRef<Handlers<T>>({});\n\n // since js -> worklet -> js call is asynchronous, we can not write handlers\n // straight into shared variable (using current shared value as a previous result),\n // since there may be a race condition in a call, and closure may have out-of-dated\n // values. As a result, some of handlers may be not written to \"all handlers\" object.\n // Below we are writing all handlers to `ref` and afterwards synchronize them with\n // shared value (since `refs` are not referring to actual value in worklets).\n // This approach allow us to update synchronously handlers in js thread (and it assures,\n // that it will have all of them) and then update them in worklet thread (calls are\n // happening in FIFO order, so we will always have actual value).\n const updateSharedHandlers = () => {\n handlers.value = jsHandlers.current;\n };\n const setHandlers = useCallback((handler: Handlers<T>) => {\n jsHandlers.current = {\n ...jsHandlers.current,\n ...handler,\n };\n updateSharedHandlers();\n }, []);\n const broadcast = (type: keyof T, event: NativeEvent) => {\n 'worklet';\n\n Object.keys(handlers.value).forEach((key) =>\n handlers.value[key]?.[type]?.(event)\n );\n };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,IAAAC,kBAAA,EAAaC,OAAD,IAA0B;IACxDP,UAAU,CAACI,OAAX,GAAqB,EACnB,GAAGJ,UAAU,CAACI,OADK;MAEnB,GAAGG;IAFgB,CAArB;IAIAL,oBAAoB;EACrB,CANmB,EAMjB,EANiB,CAApB;;EAOA,MAAMM,SAAS,GAAG,CAACC,IAAD,EAAgBjB,KAAhB,KAAuC;IACvD;;IAEAkB,MAAM,CAACC,IAAP,CAAYzB,QAAQ,CAACiB,KAArB,EAA4BS,OAA5B,CAAqCC,GAAD;MAAA;;MAAA,8BAClC3B,QAAQ,CAACiB,KAAT,CAAeU,GAAf,CADkC,iFAClC,oBAAsBJ,IAAtB,CADkC,0DAClC,gDAA8BjB,KAA9B,CADkC;IAAA,CAApC;EAGD,CAND;;EAQA,OAAO;IAAEa,WAAF;IAAeG;EAAf,CAAP;AACD"}
|
|
@@ -4,18 +4,18 @@ var _reactNative = require("react-native");
|
|
|
4
4
|
|
|
5
5
|
var NativeAndroidManager = _interopRequireWildcard(require("react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid"));
|
|
6
6
|
|
|
7
|
-
var _architecture = require("./architecture");
|
|
8
|
-
|
|
9
7
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
8
|
|
|
11
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
10
|
|
|
13
11
|
// @ts-expect-error because there is no corresponding type definition
|
|
14
12
|
const getConstants = NativeAndroidManager.default.getConstants;
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
const RCTStatusBarManagerCompat = require('./specs/NativeStatusBarManagerCompat').default; // On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
|
|
16
15
|
// in order to use library on all available platforms we have to monkey patch
|
|
17
16
|
// default RN implementation and use modern `WindowInsetsControllerCompat`.
|
|
18
17
|
|
|
18
|
+
|
|
19
19
|
if (_reactNative.Platform.OS === 'android') {
|
|
20
20
|
NativeAndroidManager.default = {
|
|
21
21
|
getConstants,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getConstants","NativeAndroidManager","default","RCTStatusBarManagerCompat","
|
|
1
|
+
{"version":3,"names":["getConstants","NativeAndroidManager","default","RCTStatusBarManagerCompat","require","Platform","OS","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden"],"sources":["monkey-patch.ts"],"sourcesContent":["import { Platform } from 'react-native';\n// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from 'react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid';\n\nconst getConstants = NativeAndroidManager.default.getConstants;\n\nconst RCTStatusBarManagerCompat =\n require('./specs/NativeStatusBarManagerCompat').default;\n\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nif (Platform.OS === 'android') {\n NativeAndroidManager.default = {\n getConstants,\n setColor(color: number, animated: boolean): void {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n\n setTranslucent(translucent: boolean): void {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n\n /**\n * - statusBarStyles can be:\n * - 'default'\n * - 'dark-content'\n */\n setStyle(statusBarStyle?: string): void {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n\n setHidden(hidden: boolean): void {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n };\n}\n"],"mappings":";;AAAA;;AAEA;;;;;;AADA;AAGA,MAAMA,YAAY,GAAGC,oBAAoB,CAACC,OAArB,CAA6BF,YAAlD;;AAEA,MAAMG,yBAAyB,GAC7BC,OAAO,CAAC,sCAAD,CAAP,CAAgDF,OADlD,C,CAGA;AACA;AACA;;;AACA,IAAIG,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;EAC7BL,oBAAoB,CAACC,OAArB,GAA+B;IAC7BF,YAD6B;;IAE7BO,QAAQ,CAACC,KAAD,EAAgBC,QAAhB,EAAyC;MAC/CN,yBAAyB,CAACI,QAA1B,CAAmCC,KAAnC,EAA0CC,QAA1C;IACD,CAJ4B;;IAM7BC,cAAc,CAACC,WAAD,EAA6B;MACzCR,yBAAyB,CAACO,cAA1B,CAAyCC,WAAzC;IACD,CAR4B;;IAU7B;AACJ;AACA;AACA;AACA;IACIC,QAAQ,CAACC,cAAD,EAAgC;MACtCV,yBAAyB,CAACS,QAA1B,CAAmCC,cAAnC;IACD,CAjB4B;;IAmB7BC,SAAS,CAACC,MAAD,EAAwB;MAC/BZ,yBAAyB,CAACW,SAA1B,CAAoCC,MAApC;IACD;;EArB4B,CAA/B;AAuBD"}
|
package/lib/commonjs/native.js
CHANGED
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
6
|
+
exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardController = exports.AndroidSoftInputModes = void 0;
|
|
9
7
|
|
|
10
8
|
var _reactNative = require("react-native");
|
|
11
9
|
|
|
12
|
-
var _architecture = require("./architecture");
|
|
13
|
-
|
|
14
10
|
const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
15
11
|
ios: "- You have run 'pod install'\n",
|
|
16
12
|
default: ''
|
|
17
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo
|
|
13
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n'; // copied from `android.view.WindowManager.LayoutParams`
|
|
14
|
+
|
|
18
15
|
let AndroidSoftInputModes;
|
|
19
16
|
exports.AndroidSoftInputModes = AndroidSoftInputModes;
|
|
20
17
|
|
|
@@ -23,28 +20,34 @@ exports.AndroidSoftInputModes = AndroidSoftInputModes;
|
|
|
23
20
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_PAN"] = 32] = "SOFT_INPUT_ADJUST_PAN";
|
|
24
21
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_RESIZE"] = 16] = "SOFT_INPUT_ADJUST_RESIZE";
|
|
25
22
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_UNSPECIFIED"] = 0] = "SOFT_INPUT_ADJUST_UNSPECIFIED";
|
|
23
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_IS_FORWARD_NAVIGATION"] = 256] = "SOFT_INPUT_IS_FORWARD_NAVIGATION";
|
|
24
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_ADJUST"] = 240] = "SOFT_INPUT_MASK_ADJUST";
|
|
25
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_STATE"] = 15] = "SOFT_INPUT_MASK_STATE";
|
|
26
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MODE_CHANGED"] = 512] = "SOFT_INPUT_MODE_CHANGED";
|
|
27
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_HIDDEN"] = 3] = "SOFT_INPUT_STATE_ALWAYS_HIDDEN";
|
|
28
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_VISIBLE"] = 5] = "SOFT_INPUT_STATE_ALWAYS_VISIBLE";
|
|
29
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_HIDDEN"] = 2] = "SOFT_INPUT_STATE_HIDDEN";
|
|
30
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNCHANGED"] = 1] = "SOFT_INPUT_STATE_UNCHANGED";
|
|
31
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNSPECIFIED"] = 0] = "SOFT_INPUT_STATE_UNSPECIFIED";
|
|
32
|
+
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
|
|
26
33
|
})(AndroidSoftInputModes || (exports.AndroidSoftInputModes = AndroidSoftInputModes = {}));
|
|
27
34
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const KeyboardController = RCTKeyboardController
|
|
35
|
+
const RCTKeyboardController = require('./specs/NativeKeyboardController').default;
|
|
36
|
+
|
|
37
|
+
const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
|
|
38
|
+
get() {
|
|
39
|
+
throw new Error(LINKING_ERROR);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
});
|
|
31
43
|
exports.KeyboardController = KeyboardController;
|
|
32
|
-
const eventEmitter = new _reactNative.NativeEventEmitter(
|
|
44
|
+
const eventEmitter = new _reactNative.NativeEventEmitter(KeyboardController);
|
|
33
45
|
const KeyboardEvents = {
|
|
34
46
|
addListener: (name, cb) => eventEmitter.addListener('KeyboardController::' + name, cb)
|
|
35
47
|
};
|
|
36
48
|
exports.KeyboardEvents = KeyboardEvents;
|
|
37
|
-
const KeyboardControllerView = _architecture.isFabricEnabled ? require('./KeyboardControllerViewNativeComponent').default : _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
|
|
38
|
-
throw new Error(LINKING_ERROR);
|
|
39
|
-
};
|
|
40
|
-
exports.KeyboardControllerView = KeyboardControllerView;
|
|
41
49
|
|
|
42
|
-
const
|
|
43
|
-
(0, _react.useEffect)(() => {
|
|
44
|
-
KeyboardController.setInputMode(AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
|
|
45
|
-
return () => KeyboardController.setDefaultMode();
|
|
46
|
-
}, []);
|
|
47
|
-
};
|
|
50
|
+
const KeyboardControllerView = require('./specs/KeyboardControllerViewNativeComponent').default;
|
|
48
51
|
|
|
49
|
-
exports.
|
|
52
|
+
exports.KeyboardControllerView = KeyboardControllerView;
|
|
50
53
|
//# sourceMappingURL=native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","AndroidSoftInputModes","
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","AndroidSoftInputModes","RCTKeyboardController","require","KeyboardController","Proxy","get","Error","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","KeyboardControllerView"],"sources":["native.ts"],"sourcesContent":["import { Platform, NativeEventEmitter } from 'react-native';\n\nimport type {\n KeyboardControllerEvents,\n KeyboardControllerModule,\n KeyboardEventData,\n} from './types';\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\n// copied from `android.view.WindowManager.LayoutParams`\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\n SOFT_INPUT_MASK_ADJUST = 240,\n SOFT_INPUT_MASK_STATE = 15,\n SOFT_INPUT_MODE_CHANGED = 512,\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\n SOFT_INPUT_STATE_HIDDEN = 2,\n SOFT_INPUT_STATE_UNCHANGED = 1,\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\n SOFT_INPUT_STATE_VISIBLE = 4,\n}\n\nconst RCTKeyboardController =\n require('./specs/NativeKeyboardController').default;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n )\n) as KeyboardControllerModule;\n\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents = {\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEventData) => void\n ) => eventEmitter.addListener('KeyboardController::' + name, cb),\n};\nexport const KeyboardControllerView =\n require('./specs/KeyboardControllerViewNativeComponent').default;\n"],"mappings":";;;;;;;AAAA;;AAQA,MAAMA,aAAa,GAChB,2FAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,+BAJF,C,CAMA;;IACYC,qB;;;WAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,qCAAAA,qB;;AAiBZ,MAAMC,qBAAqB,GACzBC,OAAO,CAAC,kCAAD,CAAP,CAA4CH,OAD9C;;AAEO,MAAMI,kBAAkB,GAC7BF,qBAAqB,GACjBA,qBADiB,GAEjB,IAAIG,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUX,aAAV,CAAN;EACD;;AAHH,CAFF,CAHC;;AAaP,MAAMY,YAAY,GAAG,IAAIC,+BAAJ,CAAuBL,kBAAvB,CAArB;AAEO,MAAMM,cAAc,GAAG;EAC5BC,WAAW,EAAE,CACXC,IADW,EAEXC,EAFW,KAGRL,YAAY,CAACG,WAAb,CAAyB,yBAAyBC,IAAlD,EAAwDC,EAAxD;AAJuB,CAAvB;;;AAMA,MAAMC,sBAAsB,GACjCX,OAAO,CAAC,+CAAD,CAAP,CAAyDH,OADpD"}
|
package/lib/commonjs/replicas.js
CHANGED
|
@@ -11,7 +11,7 @@ var _reactNative = require("react-native");
|
|
|
11
11
|
|
|
12
12
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _hooks = require("./hooks");
|
|
15
15
|
|
|
16
16
|
var _native = require("./native");
|
|
17
17
|
|
|
@@ -133,6 +133,6 @@ const useReanimatedKeyboardAnimationReplica = () => {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
exports.useReanimatedKeyboardAnimationReplica = useReanimatedKeyboardAnimationReplica;
|
|
136
|
-
const useGradualKeyboardAnimation = _reactNative.Platform.OS === 'ios' ? useReanimatedKeyboardAnimationReplica :
|
|
136
|
+
const useGradualKeyboardAnimation = _reactNative.Platform.OS === 'ios' ? useReanimatedKeyboardAnimationReplica : _hooks.useReanimatedKeyboardAnimation;
|
|
137
137
|
exports.useGradualKeyboardAnimation = useGradualKeyboardAnimation;
|
|
138
138
|
//# sourceMappingURL=replicas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["availableOSEventType","Platform","OS","defaultAndroidEasing","Easing","bezier","useKeyboardAnimationReplica","height","useRef","Animated","Value","progress","animation","useMemo","current","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","listener","Keyboard","addListener","e","timing","toValue","endCoordinates","duration","easing","useNativeDriver","start","remove","IOS_SPRING_CONFIG","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","useReanimatedKeyboardAnimationReplica","useSharedValue","heightEvent","useDerivedValue","value","handler","useWorkletCallback","_height","useAnimatedReaction","_keyboardHeight","result","_previousResult","_previousKeyboardHeight","withSpring","show","runOnUI","hide","useGradualKeyboardAnimation","useReanimatedKeyboardAnimation"],"sources":["replicas.ts"],"sourcesContent":["import { useRef, useEffect, useMemo } from 'react';\nimport { Animated, Easing, Keyboard, Platform } from 'react-native';\nimport {\n runOnUI,\n useAnimatedReaction,\n useDerivedValue,\n useSharedValue,\n useWorkletCallback,\n withSpring,\n} from 'react-native-reanimated';\nimport { useReanimatedKeyboardAnimation } from './
|
|
1
|
+
{"version":3,"names":["availableOSEventType","Platform","OS","defaultAndroidEasing","Easing","bezier","useKeyboardAnimationReplica","height","useRef","Animated","Value","progress","animation","useMemo","current","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","listener","Keyboard","addListener","e","timing","toValue","endCoordinates","duration","easing","useNativeDriver","start","remove","IOS_SPRING_CONFIG","damping","stiffness","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","useReanimatedKeyboardAnimationReplica","useSharedValue","heightEvent","useDerivedValue","value","handler","useWorkletCallback","_height","useAnimatedReaction","_keyboardHeight","result","_previousResult","_previousKeyboardHeight","withSpring","show","runOnUI","hide","useGradualKeyboardAnimation","useReanimatedKeyboardAnimation"],"sources":["replicas.ts"],"sourcesContent":["import { useRef, useEffect, useMemo } from 'react';\nimport { Animated, Easing, Keyboard, Platform } from 'react-native';\nimport {\n runOnUI,\n useAnimatedReaction,\n useDerivedValue,\n useSharedValue,\n useWorkletCallback,\n withSpring,\n} from 'react-native-reanimated';\nimport { useReanimatedKeyboardAnimation } from './hooks';\n\nimport { AndroidSoftInputModes, KeyboardController } from './native';\n\nconst availableOSEventType = Platform.OS === 'ios' ? 'Will' : 'Did';\n\n// cubic-bezier(.17,.67,.34,.94)\nexport const defaultAndroidEasing = Easing.bezier(0.4, 0.0, 0.2, 1);\ntype KeyboardAnimation = {\n progress: Animated.Value;\n height: Animated.Value;\n};\n\n/**\n * An experimental implementation of tracing keyboard appearance.\n * Switch an input mode to adjust resize mode. In this case all did* events\n * are triggering before keyboard appears, and using some approximations\n * it tries to mimicries a native transition.\n *\n * @returns {Animated.Value}\n */\nexport const useKeyboardAnimationReplica = (): KeyboardAnimation => {\n const height = useRef(new Animated.Value(0));\n const progress = useRef(new Animated.Value(0));\n const animation = useMemo(\n () => ({\n height: height.current,\n progress: progress.current,\n }),\n []\n );\n\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n useEffect(() => {\n const listener = Keyboard.addListener(\n `keyboard${availableOSEventType}Show`,\n (e) => {\n Animated.timing(height.current, {\n toValue: -e.endCoordinates.height,\n duration: e.duration !== 0 ? e.duration : 300,\n easing: Easing.bezier(0.4, 0.0, 0.2, 1),\n useNativeDriver: true,\n }).start();\n\n return () => listener.remove();\n }\n );\n }, []);\n useEffect(() => {\n const listener = Keyboard.addListener(\n `keyboard${availableOSEventType}Hide`,\n (e) => {\n Animated.timing(height.current, {\n toValue: 0,\n duration: e.duration !== 0 ? e.duration : 300,\n easing: Easing.bezier(0.4, 0.0, 0.2, 1),\n useNativeDriver: true,\n }).start();\n\n return () => listener.remove();\n }\n );\n }, []);\n\n return animation;\n};\n\nconst IOS_SPRING_CONFIG = {\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n};\n\n/**\n * A close replica to native iOS keyboard animation. The problem is that\n * iOS (unlike Android) can not fire events for each keyboard frame movement.\n * As a result we can not get gradual values (for example, for progress it always\n * will be 1 or 0). So if you want to rely on gradual values you will need to use\n * this replica.\n *\n * The transition is hardcoded and may vary from one to another OS versions. But it\n * seems like last time it has been changed in iOS 7. Since RN supports at least iOS\n * 11 it doesn't make sense to replicate iOS 7 behavior. If it changes in next OS\n * versions, then this implementation should be revisited and reflect necessary changes.\n *\n * @returns {height, progress} - animated values\n */\nexport const useReanimatedKeyboardAnimationReplica = () => {\n const height = useSharedValue(0);\n const heightEvent = useSharedValue(0);\n\n const progress = useDerivedValue(() => height.value / heightEvent.value);\n\n const handler = useWorkletCallback((_height: number) => {\n heightEvent.value = _height;\n }, []);\n\n useAnimatedReaction(\n () => ({\n _keyboardHeight: heightEvent.value,\n }),\n (result, _previousResult) => {\n const { _keyboardHeight } = result;\n const _previousKeyboardHeight = _previousResult?._keyboardHeight;\n\n if (_keyboardHeight !== _previousKeyboardHeight) {\n height.value = withSpring(_keyboardHeight, IOS_SPRING_CONFIG);\n }\n },\n []\n );\n\n useEffect(() => {\n const show = Keyboard.addListener('keyboardWillShow', (e) => {\n runOnUI(handler)(-e.endCoordinates.height);\n });\n const hide = Keyboard.addListener('keyboardWillHide', () => {\n runOnUI(handler)(0);\n });\n\n return () => {\n show.remove();\n hide.remove();\n };\n }, []);\n\n return { height, progress };\n};\n\nexport const useGradualKeyboardAnimation =\n Platform.OS === 'ios'\n ? useReanimatedKeyboardAnimationReplica\n : useReanimatedKeyboardAnimation;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAQA;;AAEA;;AAEA,MAAMA,oBAAoB,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB,MAAxB,GAAiC,KAA9D,C,CAEA;;A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IACtDL,WAAW,CAACE,KAAZ,GAAoBG,OAApB;EACD,CAFe,EAEb,EAFa,CAAhB;EAIA,IAAAC,0CAAA,EACE,OAAO;IACLC,eAAe,EAAEP,WAAW,CAACE;EADxB,CAAP,CADF,EAIE,CAACM,MAAD,EAASC,eAAT,KAA6B;IAC3B,MAAM;MAAEF;IAAF,IAAsBC,MAA5B;;IACA,MAAME,uBAAuB,GAAGD,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAEF,eAAjD;;IAEA,IAAIA,eAAe,KAAKG,uBAAxB,EAAiD;MAC/C7C,MAAM,CAACqC,KAAP,GAAe,IAAAS,iCAAA,EAAWJ,eAAX,EAA4BhB,iBAA5B,CAAf;IACD;EACF,CAXH,EAYE,EAZF;EAeA,IAAAlB,gBAAA,EAAU,MAAM;IACd,MAAMuC,IAAI,GAAGhC,qBAAA,CAASC,WAAT,CAAqB,kBAArB,EAA0CC,CAAD,IAAO;MAC3D,IAAA+B,8BAAA,EAAQV,OAAR,EAAiB,CAACrB,CAAC,CAACG,cAAF,CAAiBpB,MAAnC;IACD,CAFY,CAAb;;IAGA,MAAMiD,IAAI,GAAGlC,qBAAA,CAASC,WAAT,CAAqB,kBAArB,EAAyC,MAAM;MAC1D,IAAAgC,8BAAA,EAAQV,OAAR,EAAiB,CAAjB;IACD,CAFY,CAAb;;IAIA,OAAO,MAAM;MACXS,IAAI,CAACtB,MAAL;MACAwB,IAAI,CAACxB,MAAL;IACD,CAHD;EAID,CAZD,EAYG,EAZH;EAcA,OAAO;IAAEzB,MAAF;IAAUI;EAAV,CAAP;AACD,CAxCM;;;AA0CA,MAAM8C,2BAA2B,GACtCxD,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GACIsC,qCADJ,GAEIkB,qCAHC"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sources":["KeyboardControllerViewNativeComponent.ts"],"sourcesContent":["import type { HostComponent } from 'react-native';\n// @ts-expect-error - no type definition\nimport type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';\nimport type {\n DirectEventHandler,\n Float,\n Int32,\n} from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\n\ntype KeyboardMoveEvent = Readonly<{\n height: Int32;\n progress: Float;\n}>;\n\nexport interface NativeProps extends ViewProps {\n statusBarTranslucent?: boolean;\n onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n 'KeyboardControllerView'\n) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;;AAQA;;;;AAPA;
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent"],"sources":["KeyboardControllerViewNativeComponent.ts"],"sourcesContent":["import type { HostComponent } from 'react-native';\n// @ts-expect-error - no type definition\nimport type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';\nimport type {\n DirectEventHandler,\n Float,\n Int32,\n} from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\n\ntype KeyboardMoveEvent = Readonly<{\n height: Int32;\n progress: Float;\n}>;\n\nexport interface NativeProps extends ViewProps {\n // props\n statusBarTranslucent?: boolean;\n // callbacks\n onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;\n onKeyboardMoveStart?: DirectEventHandler<KeyboardMoveEvent>;\n onKeyboardMoveEnd?: DirectEventHandler<KeyboardMoveEvent>;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n 'KeyboardControllerView'\n) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;;AAQA;;;;AAPA;eAuBe,IAAAA,+BAAA,EACb,wBADa,C"}
|
|
File without changes
|
package/lib/commonjs/{NativeKeyboardController.js.map → specs/NativeKeyboardController.js.map}
RENAMED
|
File without changes
|
package/lib/commonjs/{NativeStatusBarManagerCompat.js → specs/NativeStatusBarManagerCompat.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { NativeSyntheticEvent, ViewProps } from 'react-native';\n\n// DirectEventHandler events declaration\n\nexport type NativeEvent = {\n progress: number;\n height: number;\n};\nexport type EventWithName<T> = {\n eventName: string;\n} & T;\n\n// native View/Module declarations\n\nexport type KeyboardControllerProps = {\n onKeyboardMoveStart?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>\n ) => void;\n onKeyboardMove?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>\n ) => void;\n onKeyboardMoveEnd?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>\n ) => void;\n // fake prop used to activate reanimated bindings\n onKeyboardMoveReanimated: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>\n ) => void;\n statusBarTranslucent?: boolean;\n} & ViewProps;\n\nexport type KeyboardControllerModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n\n// Event module declarations\n\nexport type KeyboardControllerEvents =\n | 'keyboardWillShow'\n | 'keyboardDidShow'\n | 'keyboardWillHide'\n | 'keyboardDidHide';\nexport type KeyboardEventData = {\n height: number;\n};\n\n// package types\n\nexport type Handlers<T> = Record<string, T | undefined>;\nexport type KeyboardHandler = {\n onStart?: (e: NativeEvent) => void;\n onMove?: (e: NativeEvent) => void;\n onEnd?: (e: NativeEvent) => void;\n};\nexport type KeyboardHandlers = Handlers<KeyboardHandler>;\n"],"mappings":""}
|
|
@@ -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);\n"],"mappings":";;;;;;;AAAO,MAAMA,IAAI,GAAG,MAAMC,IAAI,CAACC,MAAL,GAAcC,QAAd,CAAuB,EAAvB,EAA2BC,KAA3B,CAAiC,CAAC,CAAlC,CAAnB"}
|