@react-native-ohos/react-native-keyboard-controller 1.12.8-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +19 -0
- package/harmony/keyboard_controller/BuildProfile.ets +17 -0
- package/harmony/keyboard_controller/Index.ets +30 -0
- package/harmony/keyboard_controller/ResourceTable.txt +9 -0
- package/harmony/keyboard_controller/build-profile.json5 +31 -0
- package/harmony/keyboard_controller/consumer-rules.txt +0 -0
- package/harmony/keyboard_controller/hvigorfile.ts +6 -0
- package/harmony/keyboard_controller/obfuscation-rules.txt +18 -0
- package/harmony/keyboard_controller/oh-package-lock.json5 +19 -0
- package/harmony/keyboard_controller/oh-package.json5 +11 -0
- package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +111 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +98 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +274 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +101 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +85 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +110 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +84 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +46 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +64 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +77 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +64 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +77 -0
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +67 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +70 -0
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +245 -0
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +119 -0
- package/harmony/keyboard_controller/src/main/ets/Type.ts +62 -0
- package/harmony/keyboard_controller/src/main/module.json +29 -0
- package/harmony/keyboard_controller/src/main/module.json5 +11 -0
- package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/keyboard_controller/ts.ets +30 -0
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +188 -0
- package/lib/commonjs/animated.js.map +1 -0
- package/lib/commonjs/bindings.js +38 -0
- package/lib/commonjs/bindings.js.map +1 -0
- package/lib/commonjs/bindings.native.js +37 -0
- package/lib/commonjs/bindings.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
- package/lib/commonjs/components/index.js +42 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/constants.js +27 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context.js +42 -0
- package/lib/commonjs/context.js.map +1 -0
- package/lib/commonjs/hooks/index.js +104 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/commonjs/index.js +116 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal.js +73 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/monkey-patch.android.js +57 -0
- package/lib/commonjs/monkey-patch.android.js.map +1 -0
- package/lib/commonjs/monkey-patch.js +11 -0
- package/lib/commonjs/monkey-patch.js.map +1 -0
- package/lib/commonjs/reanimated.js +12 -0
- package/lib/commonjs/reanimated.js.map +1 -0
- package/lib/commonjs/reanimated.native.js +88 -0
- package/lib/commonjs/reanimated.native.js.map +1 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +9 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/animated.js +180 -0
- package/lib/module/animated.js.map +1 -0
- package/lib/module/bindings.js +32 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/bindings.native.js +31 -0
- package/lib/module/bindings.native.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
- package/lib/module/components/KeyboardStickyView/index.js +33 -0
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Button.js +62 -0
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.js +15 -0
- package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
- package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +140 -0
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/types.js +2 -0
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
- package/lib/module/components/hooks/useColorScheme.js +4 -0
- package/lib/module/components/hooks/useColorScheme.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/constants.js +21 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context.js +35 -0
- package/lib/module/context.js.map +1 -0
- package/lib/module/hooks/index.js +68 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
- package/lib/module/hooks/useWindowDimensions/index.js +2 -0
- package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal.js +66 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/monkey-patch.android.js +47 -0
- package/lib/module/monkey-patch.android.js.map +1 -0
- package/lib/module/monkey-patch.js +5 -0
- package/lib/module/monkey-patch.js.map +1 -0
- package/lib/module/reanimated.js +6 -0
- package/lib/module/reanimated.js.map +1 -0
- package/lib/module/reanimated.native.js +78 -0
- package/lib/module/reanimated.native.js.map +1 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js +3 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +2 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/animated.d.ts +31 -0
- package/lib/typescript/bindings.d.ts +12 -0
- package/lib/typescript/bindings.native.d.ts +12 -0
- package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
- package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
- package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
- package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
- package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
- package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
- package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
- package/lib/typescript/components/index.d.ts +8 -0
- package/lib/typescript/constants.d.ts +16 -0
- package/lib/typescript/context.d.ts +23 -0
- package/lib/typescript/hooks/index.d.ts +17 -0
- package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
- package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/internal.d.ts +30 -0
- package/lib/typescript/monkey-patch.android.d.ts +2 -0
- package/lib/typescript/monkey-patch.d.ts +2 -0
- package/lib/typescript/reanimated.d.ts +5 -0
- package/lib/typescript/reanimated.native.d.ts +7 -0
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
- package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
- package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
- package/lib/typescript/types.d.ts +133 -0
- package/lib/typescript/utils.d.ts +1 -0
- package/package.json +178 -0
- package/react-native-keyboard-controller.podspec +61 -0
- package/src/animated.tsx +253 -0
- package/src/bindings.native.ts +57 -0
- package/src/bindings.ts +38 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
- package/src/components/KeyboardAvoidingView/index.tsx +156 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
- package/src/components/KeyboardStickyView/index.tsx +57 -0
- package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
- package/src/components/KeyboardToolbar/Button.tsx +98 -0
- package/src/components/KeyboardToolbar/colors.native.ts +37 -0
- package/src/components/KeyboardToolbar/colors.ts +16 -0
- package/src/components/KeyboardToolbar/index.tsx +211 -0
- package/src/components/KeyboardToolbar/types.ts +40 -0
- package/src/components/hooks/useColorScheme.ts +5 -0
- package/src/components/index.ts +11 -0
- package/src/constants.ts +19 -0
- package/src/context.ts +65 -0
- package/src/hooks/index.ts +90 -0
- package/src/hooks/useWindowDimensions/index.android.ts +33 -0
- package/src/hooks/useWindowDimensions/index.ts +1 -0
- package/src/index.ts +21 -0
- package/src/internal.ts +84 -0
- package/src/monkey-patch.android.ts +44 -0
- package/src/monkey-patch.ts +4 -0
- package/src/reanimated.native.ts +132 -0
- package/src/reanimated.ts +29 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
- package/src/specs/NativeKeyboardController.ts +19 -0
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
- package/src/types.ts +211 -0
- package/src/utils.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeReanimated","_hooks","IS_ANDROID_ELEVEN_OR_HIGHER","Platform","OS","Version","IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS","TELEGRAM_ANDROID_TIMING_CONFIG","duration","easing","Easing","bezier","useSmoothKeyboardHandler","handler","deps","target","useSharedValue","height","persistedHeight","animatedKeyboardHeight","useAnimatedReaction","value","event","progress","evt","_handler$onMove","onMove","call","_handler$onEnd","onEnd","useKeyboardHandler","onStart","e","_handler$onStart2","_handler$onStart","_handler$onEnd2","withTiming","_handler$onMove2","_handler$onEnd3","exports"],"sources":["useSmoothKeyboardHandler.ts"],"sourcesContent":["import { Platform } from \"react-native\";\r\nimport {\r\n Easing,\r\n useAnimatedReaction,\r\n useSharedValue,\r\n withTiming,\r\n} from \"react-native-reanimated\";\r\n\r\nimport { useKeyboardHandler } from \"../../hooks\";\r\n\r\nconst IS_ANDROID_ELEVEN_OR_HIGHER =\r\n Platform.OS === \"android\" && Platform.Version >= 30;\r\n// on these platforms keyboard transitions will be smooth\r\nconst IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS =\r\n IS_ANDROID_ELEVEN_OR_HIGHER || Platform.OS === \"ios\" || Platform.OS as string === 'harmony';\r\n// on Android Telegram is not using androidx.core values and uses custom interpolation\r\n// duration is taken from here: https://github.com/DrKLO/Telegram/blob/e9a35cea54c06277c69d41b8e25d94b5d7ede065/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AdjustPanLayoutHelper.java#L39\r\n// and bezier is taken from: https://github.com/DrKLO/Telegram/blob/e9a35cea54c06277c69d41b8e25d94b5d7ede065/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java#L40\r\nconst TELEGRAM_ANDROID_TIMING_CONFIG = {\r\n duration: 250,\r\n easing: Easing.bezier(\r\n 0.19919472913616398,\r\n 0.010644531250000006,\r\n 0.27920937042459737,\r\n 0.91025390625,\r\n ),\r\n};\r\n\r\n/**\r\n * Hook that uses default transitions for iOS and Android > 11, and uses\r\n * custom interpolation on Android < 11 to achieve more smooth animation\r\n */\r\nexport const useSmoothKeyboardHandler: typeof useKeyboardHandler = (\r\n handler,\r\n deps,\r\n) => {\r\n const target = useSharedValue(-1);\r\n const height = useSharedValue(0);\r\n const persistedHeight = useSharedValue(0);\r\n const animatedKeyboardHeight = useSharedValue(0);\r\n\r\n useAnimatedReaction(\r\n () => {\r\n if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n return;\r\n }\r\n if (persistedHeight.value === 0) {\r\n return;\r\n }\r\n const event = {\r\n // it'll be always `TELEGRAM_ANDROID_TIMING_CONFIG.duration`, since we're running animation via `withTiming`\r\n duration: TELEGRAM_ANDROID_TIMING_CONFIG.duration,\r\n target: target.value,\r\n height: animatedKeyboardHeight.value,\r\n progress: animatedKeyboardHeight.value / persistedHeight.value,\r\n };\r\n return event;\r\n },\r\n (evt) => {\r\n if (!evt) {\r\n return;\r\n }\r\n handler.onMove?.(evt);\r\n\r\n // dispatch `onEnd`\r\n if (evt.height === height.value) {\r\n handler.onEnd?.(evt);\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n persistedHeight.value = height.value;\r\n }\r\n },\r\n // REA uses own version of `DependencyList` and it's not compatible with the same type from React\r\n deps as unknown[],\r\n );\r\n\r\n useKeyboardHandler(\r\n {\r\n onStart: (e) => {\r\n \"worklet\";\r\n\r\n // immediately dispatch onStart/onEnd events if onStart dispatched with the same height\r\n // and don't wait for animation 250ms\r\n if (\r\n !IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS &&\r\n e.height === persistedHeight.value\r\n ) {\r\n handler.onStart?.(e);\r\n handler.onEnd?.(e);\r\n\r\n return;\r\n }\r\n\r\n target.value = e.target;\r\n height.value = e.height;\r\n\r\n if (e.height > 0) {\r\n persistedHeight.value = e.height;\r\n }\r\n // if we are running on Android < 9, then we are using custom interpolation\r\n // to achieve smoother animation and use `animatedKeyboardHeight` as animation\r\n // driver\r\n if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n animatedKeyboardHeight.value = withTiming(\r\n e.height,\r\n TELEGRAM_ANDROID_TIMING_CONFIG,\r\n );\r\n }\r\n\r\n handler.onStart?.({\r\n ...e,\r\n duration: IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS\r\n ? e.duration\r\n : TELEGRAM_ANDROID_TIMING_CONFIG.duration,\r\n });\r\n },\r\n onMove: (e) => {\r\n \"worklet\";\r\n\r\n if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n handler.onMove?.(e);\r\n }\r\n },\r\n onEnd: (e) => {\r\n \"worklet\";\r\n\r\n if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {\r\n handler.onEnd?.(e);\r\n }\r\n },\r\n },\r\n deps,\r\n );\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,2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,eAAfA,iBAAA,CAAAN,IAAA,CAAAd,OAAO,EAAW;QAChB,GAAGmB,CAAC;QACJxB,QAAQ,EAAEF,kCAAkC,GACxC0B,CAAC,CAACxB,QAAQ,GACVD,8BAA8B,CAACC;MACrC,CAAC,CAAC;IACJ,CAAC;IACDkB,MAAM,EAAGM,CAAC,IAAK;MACb,SAAS;;MAET,IAAI1B,kCAAkC,EAAE;QAAA,IAAA+B,gBAAA;QACtC,CAAAA,gBAAA,GAAAxB,OAAO,CAACa,MAAM,cAAAW,gBAAA,eAAdA,gBAAA,CAAAV,IAAA,CAAAd,OAAO,EAAUmB,CAAC,CAAC;MACrB;IACF,CAAC;IACDH,KAAK,EAAGG,CAAC,IAAK;MACZ,SAAS;;MAET,IAAI1B,kCAAkC,EAAE;QAAA,IAAAgC,eAAA;QACtC,CAAAA,eAAA,GAAAzB,OAAO,CAACgB,KAAK,cAAAS,eAAA,eAAbA,eAAA,CAAAX,IAAA,CAAAd,OAAO,EAASmB,CAAC,CAAC;MACpB;IACF;EACF,CAAC,EACDlB,IACF,CAAC;AACH,CAAC;AAACyB,OAAA,CAAA3B,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.scrollDistanceWithRespectToSnapPoints = exports.debounce = void 0;
|
|
7
|
+
const debounce = (worklet, wait = 0) => {
|
|
8
|
+
"worklet";
|
|
9
|
+
|
|
10
|
+
const value = {
|
|
11
|
+
time: 0
|
|
12
|
+
};
|
|
13
|
+
return (...args) => {
|
|
14
|
+
"worklet";
|
|
15
|
+
|
|
16
|
+
const t = Date.now();
|
|
17
|
+
const now = t - value.time;
|
|
18
|
+
if (now < wait) {
|
|
19
|
+
value.time = t;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
value.time = t;
|
|
23
|
+
return worklet(...args);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.debounce = debounce;
|
|
27
|
+
const scrollDistanceWithRespectToSnapPoints = (defaultScrollValue, snapPoints) => {
|
|
28
|
+
"worklet";
|
|
29
|
+
|
|
30
|
+
let snapPoint;
|
|
31
|
+
if (snapPoints) {
|
|
32
|
+
snapPoint = snapPoints.find(offset => offset >= defaultScrollValue);
|
|
33
|
+
}
|
|
34
|
+
return snapPoint ?? defaultScrollValue;
|
|
35
|
+
};
|
|
36
|
+
exports.scrollDistanceWithRespectToSnapPoints = scrollDistanceWithRespectToSnapPoints;
|
|
37
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["debounce","worklet","wait","value","time","args","t","Date","now","exports","scrollDistanceWithRespectToSnapPoints","defaultScrollValue","snapPoints","snapPoint","find","offset"],"sources":["utils.ts"],"sourcesContent":["export const debounce = <F extends (...args: Parameters<F>) => ReturnType<F>>(\r\n worklet: F,\r\n wait = 0,\r\n) => {\r\n \"worklet\";\r\n\r\n const value = {\r\n time: 0,\r\n };\r\n\r\n return (...args: Parameters<F>): ReturnType<F> | void => {\r\n \"worklet\";\r\n\r\n const t = Date.now();\r\n const now = t - value.time;\r\n\r\n if (now < wait) {\r\n value.time = t;\r\n return;\r\n }\r\n\r\n value.time = t;\r\n\r\n return worklet(...args);\r\n };\r\n};\r\n\r\nexport const scrollDistanceWithRespectToSnapPoints = (\r\n defaultScrollValue: number,\r\n snapPoints?: number[],\r\n) => {\r\n \"worklet\";\r\n\r\n let snapPoint: number | undefined;\r\n\r\n if (snapPoints) {\r\n snapPoint = snapPoints.find((offset) => offset >= defaultScrollValue);\r\n }\r\n\r\n return snapPoint ?? defaultScrollValue;\r\n};\r\n"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAGA,CACtBC,OAAU,EACVC,IAAI,GAAG,CAAC,KACL;EACH,SAAS;;EAET,MAAMC,KAAK,GAAG;IACZC,IAAI,EAAE;EACR,CAAC;EAED,OAAO,CAAC,GAAGC,IAAmB,KAA2B;IACvD,SAAS;;IAET,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IACpB,MAAMA,GAAG,GAAGF,CAAC,GAAGH,KAAK,CAACC,IAAI;IAE1B,IAAII,GAAG,GAAGN,IAAI,EAAE;MACdC,KAAK,CAACC,IAAI,GAAGE,CAAC;MACd;IACF;IAEAH,KAAK,CAACC,IAAI,GAAGE,CAAC;IAEd,OAAOL,OAAO,CAAC,GAAGI,IAAI,CAAC;EACzB,CAAC;AACH,CAAC;AAACI,OAAA,CAAAT,QAAA,GAAAA,QAAA;AAEK,MAAMU,qCAAqC,GAAGA,CACnDC,kBAA0B,EAC1BC,UAAqB,KAClB;EACH,SAAS;;EAET,IAAIC,SAA6B;EAEjC,IAAID,UAAU,EAAE;IACdC,SAAS,GAAGD,UAAU,CAACE,IAAI,CAAEC,MAAM,IAAKA,MAAM,IAAIJ,kBAAkB,CAAC;EACvE;EAEA,OAAOE,SAAS,IAAIF,kBAAkB;AACxC,CAAC;AAACF,OAAA,CAAAC,qCAAA,GAAAA,qCAAA","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
9
|
+
var _hooks = require("../../hooks");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
const KeyboardStickyView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
13
|
+
children,
|
|
14
|
+
offset: {
|
|
15
|
+
closed = 0,
|
|
16
|
+
opened = 0
|
|
17
|
+
} = {},
|
|
18
|
+
style,
|
|
19
|
+
...props
|
|
20
|
+
}, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
height,
|
|
23
|
+
progress
|
|
24
|
+
} = (0, _hooks.useReanimatedKeyboardAnimation)();
|
|
25
|
+
const stickyViewStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
26
|
+
const offset = (0, _reactNativeReanimated.interpolate)(progress.value, [0, 1], [closed, opened]);
|
|
27
|
+
return {
|
|
28
|
+
transform: [{
|
|
29
|
+
translateY: height.value + offset
|
|
30
|
+
}]
|
|
31
|
+
};
|
|
32
|
+
}, [closed, opened]);
|
|
33
|
+
const styles = (0, _react.useMemo)(() => [style, stickyViewStyle], [style, stickyViewStyle]);
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, _extends({
|
|
35
|
+
ref: ref,
|
|
36
|
+
style: styles
|
|
37
|
+
}, props), children);
|
|
38
|
+
});
|
|
39
|
+
var _default = exports.default = KeyboardStickyView;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","KeyboardStickyView","forwardRef","children","offset","closed","opened","style","props","ref","height","progress","useReanimatedKeyboardAnimation","stickyViewStyle","useAnimatedStyle","interpolate","value","transform","translateY","styles","useMemo","createElement","View","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from \"react\";\r\nimport Reanimated, {\r\n interpolate,\r\n useAnimatedStyle,\r\n} from \"react-native-reanimated\";\r\n\r\nimport { useReanimatedKeyboardAnimation } from \"../../hooks\";\r\n\r\nimport type { View, ViewProps } from \"react-native\";\r\n\r\nexport type KeyboardStickyViewProps = {\r\n /**\r\n * Specify additional offset to the view for given keyboard state.\r\n */\r\n offset?: {\r\n /**\r\n * Adds additional `translateY` when keyboard is close. By default `0`.\r\n */\r\n closed?: number;\r\n /**\r\n * Adds additional `translateY` when keyboard is open. By default `0`.\r\n */\r\n opened?: number;\r\n };\r\n} & ViewProps;\r\n\r\nconst KeyboardStickyView = forwardRef<\r\n View,\r\n React.PropsWithChildren<KeyboardStickyViewProps>\r\n>(\r\n (\r\n { children, offset: { closed = 0, opened = 0 } = {}, style, ...props },\r\n ref,\r\n ) => {\r\n const { height, progress } = useReanimatedKeyboardAnimation();\r\n const stickyViewStyle = useAnimatedStyle(() => {\r\n const offset = interpolate(progress.value, [0, 1], [closed, opened]);\r\n\r\n return {\r\n transform: [{ translateY: height.value + offset }],\r\n };\r\n }, [closed, opened]);\r\n\r\n const styles = useMemo(\r\n () => [style, stickyViewStyle],\r\n [style, stickyViewStyle],\r\n );\r\n\r\n return (\r\n <Reanimated.View ref={ref} style={styles} {...props}>\r\n {children}\r\n </Reanimated.View>\r\n );\r\n },\r\n);\r\n\r\nexport default KeyboardStickyView;\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAKA,IAAAE,MAAA,GAAAF,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|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _useColorScheme = _interopRequireDefault(require("../hooks/useColorScheme"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
const ArrowComponent = ({
|
|
13
|
+
type,
|
|
14
|
+
disabled,
|
|
15
|
+
theme
|
|
16
|
+
}) => {
|
|
17
|
+
const colorScheme = (0, _useColorScheme.default)();
|
|
18
|
+
const color = (0, _react.useMemo)(() => ({
|
|
19
|
+
backgroundColor: disabled ? theme[colorScheme].disabled : theme[colorScheme].primary
|
|
20
|
+
}), [disabled, theme, colorScheme]);
|
|
21
|
+
const left = (0, _react.useMemo)(() => [styles.arrowLeftLine, color], [color]);
|
|
22
|
+
const right = (0, _react.useMemo)(() => [styles.arrowRightLine, color], [color]);
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
24
|
+
style: type === "next" ? styles.arrowDownContainer : styles.arrowUpContainer
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
26
|
+
style: styles.arrow
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
28
|
+
style: left
|
|
29
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
30
|
+
style: right
|
|
31
|
+
})));
|
|
32
|
+
};
|
|
33
|
+
const arrowLine = {
|
|
34
|
+
width: 13,
|
|
35
|
+
height: 2,
|
|
36
|
+
borderRadius: 1
|
|
37
|
+
};
|
|
38
|
+
const arrowUpContainer = {
|
|
39
|
+
marginHorizontal: 5,
|
|
40
|
+
width: 30,
|
|
41
|
+
height: 30,
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
alignItems: "center"
|
|
44
|
+
};
|
|
45
|
+
const styles = _reactNative.StyleSheet.create({
|
|
46
|
+
arrowUpContainer: arrowUpContainer,
|
|
47
|
+
arrowDownContainer: {
|
|
48
|
+
...arrowUpContainer,
|
|
49
|
+
transform: [{
|
|
50
|
+
rotate: "180deg"
|
|
51
|
+
}]
|
|
52
|
+
},
|
|
53
|
+
arrow: {
|
|
54
|
+
width: 20,
|
|
55
|
+
height: 20,
|
|
56
|
+
flexDirection: "row",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
justifyContent: "space-between"
|
|
59
|
+
},
|
|
60
|
+
arrowLeftLine: {
|
|
61
|
+
...arrowLine,
|
|
62
|
+
transform: [{
|
|
63
|
+
rotate: "-45deg"
|
|
64
|
+
}],
|
|
65
|
+
left: -0.5
|
|
66
|
+
},
|
|
67
|
+
arrowRightLine: {
|
|
68
|
+
...arrowLine,
|
|
69
|
+
transform: [{
|
|
70
|
+
rotate: "45deg"
|
|
71
|
+
}],
|
|
72
|
+
left: -5.5
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var _default = exports.default = ArrowComponent;
|
|
76
|
+
//# sourceMappingURL=Arrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useColorScheme","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ArrowComponent","type","disabled","theme","colorScheme","useColorScheme","color","useMemo","backgroundColor","primary","left","styles","arrowLeftLine","right","arrowRightLine","createElement","View","style","arrowDownContainer","arrowUpContainer","arrow","Animated","arrowLine","width","height","borderRadius","marginHorizontal","justifyContent","alignItems","StyleSheet","create","transform","rotate","flexDirection","_default","exports"],"sources":["Arrow.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\r\nimport { Animated, StyleSheet, View } from \"react-native\";\r\n\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport type { KeyboardToolbarTheme } from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\ntype ArrowProps = {\r\n type: \"prev\" | \"next\";\r\n disabled?: boolean;\r\n theme: KeyboardToolbarTheme;\r\n};\r\n\r\nconst ArrowComponent: React.FC<ArrowProps> = ({ type, disabled, theme }) => {\r\n const colorScheme = useColorScheme();\r\n\r\n const color = useMemo(\r\n () => ({\r\n backgroundColor: disabled\r\n ? theme[colorScheme].disabled\r\n : theme[colorScheme].primary,\r\n }),\r\n [disabled, theme, colorScheme],\r\n );\r\n const left = useMemo(() => [styles.arrowLeftLine, color], [color]);\r\n const right = useMemo(() => [styles.arrowRightLine, color], [color]);\r\n\r\n return (\r\n <View\r\n style={\r\n type === \"next\" ? styles.arrowDownContainer : styles.arrowUpContainer\r\n }\r\n >\r\n <View style={styles.arrow}>\r\n <Animated.View style={left} />\r\n <Animated.View style={right} />\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nconst arrowLine: ViewStyle = {\r\n width: 13,\r\n height: 2,\r\n borderRadius: 1,\r\n};\r\nconst arrowUpContainer: ViewStyle = {\r\n marginHorizontal: 5,\r\n width: 30,\r\n height: 30,\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n};\r\nconst styles = StyleSheet.create({\r\n arrowUpContainer: arrowUpContainer,\r\n arrowDownContainer: {\r\n ...arrowUpContainer,\r\n transform: [{ rotate: \"180deg\" }],\r\n },\r\n arrow: {\r\n width: 20,\r\n height: 20,\r\n flexDirection: \"row\",\r\n alignItems: \"center\",\r\n justifyContent: \"space-between\",\r\n },\r\n arrowLeftLine: {\r\n ...arrowLine,\r\n transform: [{ rotate: \"-45deg\" }],\r\n left: -0.5,\r\n },\r\n arrowRightLine: {\r\n ...arrowLine,\r\n transform: [{ rotate: \"45deg\" }],\r\n left: -5.5,\r\n },\r\n});\r\n\r\nexport default ArrowComponent;\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAqD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAK,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,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ict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _useColorScheme = _interopRequireDefault(require("../hooks/useColorScheme"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
const ButtonIOS = ({
|
|
13
|
+
children,
|
|
14
|
+
onPress,
|
|
15
|
+
disabled,
|
|
16
|
+
accessibilityLabel,
|
|
17
|
+
accessibilityHint,
|
|
18
|
+
testID,
|
|
19
|
+
style
|
|
20
|
+
}) => {
|
|
21
|
+
// immediately switch to plain view to avoid animation flickering
|
|
22
|
+
// when fade out animation happens and view becomes disabled
|
|
23
|
+
const Container = disabled ? _reactNative.View : _reactNative.TouchableOpacity;
|
|
24
|
+
const accessibilityState = (0, _react.useMemo)(() => ({
|
|
25
|
+
disabled
|
|
26
|
+
}), [disabled]);
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(Container, {
|
|
28
|
+
accessibilityState: accessibilityState,
|
|
29
|
+
accessibilityRole: "button",
|
|
30
|
+
accessibilityLabel: accessibilityLabel,
|
|
31
|
+
accessibilityHint: accessibilityHint,
|
|
32
|
+
onPress: onPress,
|
|
33
|
+
style: style,
|
|
34
|
+
testID: testID
|
|
35
|
+
}, children);
|
|
36
|
+
};
|
|
37
|
+
const ButtonAndroid = ({
|
|
38
|
+
children,
|
|
39
|
+
onPress,
|
|
40
|
+
disabled,
|
|
41
|
+
accessibilityLabel,
|
|
42
|
+
accessibilityHint,
|
|
43
|
+
testID,
|
|
44
|
+
rippleRadius = 18,
|
|
45
|
+
style,
|
|
46
|
+
theme
|
|
47
|
+
}) => {
|
|
48
|
+
const colorScheme = (0, _useColorScheme.default)();
|
|
49
|
+
const accessibilityState = (0, _react.useMemo)(() => ({
|
|
50
|
+
disabled
|
|
51
|
+
}), [disabled]);
|
|
52
|
+
const ripple = (0, _react.useMemo)(() => _reactNative.TouchableNativeFeedback.Ripple(theme[colorScheme].ripple, true, rippleRadius), [colorScheme, rippleRadius, theme]);
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableNativeFeedback, {
|
|
54
|
+
accessibilityState: accessibilityState,
|
|
55
|
+
accessibilityRole: "button",
|
|
56
|
+
accessibilityLabel: accessibilityLabel,
|
|
57
|
+
accessibilityHint: accessibilityHint,
|
|
58
|
+
onPress: onPress,
|
|
59
|
+
background: ripple,
|
|
60
|
+
testID: testID,
|
|
61
|
+
style: style
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
63
|
+
style: style
|
|
64
|
+
}, children));
|
|
65
|
+
};
|
|
66
|
+
var _default = exports.default = _reactNative.Platform.select({
|
|
67
|
+
android: ButtonAndroid,
|
|
68
|
+
default: ButtonIOS
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useColorScheme","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ButtonIOS","children","onPress","disabled","accessibilityLabel","accessibilityHint","testID","style","Container","View","TouchableOpacity","accessibilityState","useMemo","createElement","accessibilityRole","ButtonAndroid","rippleRadius","theme","colorScheme","useColorScheme","ripple","TouchableNativeFeedback","Ripple","background","_default","exports","Platform","select","android"],"sources":["Button.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\r\nimport {\r\n Platform,\r\n TouchableNativeFeedback,\r\n TouchableOpacity,\r\n View,\r\n} from \"react-native\";\r\n\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport type { KeyboardToolbarTheme } from \"./types\";\r\nimport type { PropsWithChildren } from \"react\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\ntype ButtonProps = {\r\n disabled?: boolean;\r\n onPress: () => void;\r\n accessibilityLabel: string;\r\n accessibilityHint: string;\r\n testID: string;\r\n rippleRadius?: number;\r\n style?: ViewStyle;\r\n theme: KeyboardToolbarTheme;\r\n};\r\n\r\nconst ButtonIOS = ({\r\n children,\r\n onPress,\r\n disabled,\r\n accessibilityLabel,\r\n accessibilityHint,\r\n testID,\r\n style,\r\n}: PropsWithChildren<ButtonProps>) => {\r\n // immediately switch to plain view to avoid animation flickering\r\n // when fade out animation happens and view becomes disabled\r\n const Container = disabled\r\n ? (View as unknown as typeof TouchableOpacity)\r\n : TouchableOpacity;\r\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\r\n\r\n return (\r\n <Container\r\n accessibilityState={accessibilityState}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel}\r\n accessibilityHint={accessibilityHint}\r\n onPress={onPress}\r\n style={style}\r\n testID={testID}\r\n >\r\n {children}\r\n </Container>\r\n );\r\n};\r\nconst ButtonAndroid = ({\r\n children,\r\n onPress,\r\n disabled,\r\n accessibilityLabel,\r\n accessibilityHint,\r\n testID,\r\n rippleRadius = 18,\r\n style,\r\n theme,\r\n}: PropsWithChildren<ButtonProps>) => {\r\n const colorScheme = useColorScheme();\r\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\r\n const ripple = useMemo(\r\n () =>\r\n TouchableNativeFeedback.Ripple(\r\n theme[colorScheme].ripple,\r\n true,\r\n rippleRadius,\r\n ),\r\n [colorScheme, rippleRadius, theme],\r\n );\r\n\r\n return (\r\n <TouchableNativeFeedback\r\n accessibilityState={accessibilityState}\r\n accessibilityRole=\"button\"\r\n accessibilityLabel={accessibilityLabel}\r\n accessibilityHint={accessibilityHint}\r\n onPress={onPress}\r\n background={ripple}\r\n testID={testID}\r\n style={style}\r\n >\r\n <View style={style}>{children}</View>\r\n </TouchableNativeFeedback>\r\n );\r\n};\r\n\r\nexport default Platform.select({\r\n android: ButtonAndroid,\r\n default: ButtonIOS,\r\n});\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAqD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAK,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gB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AMR,kBAAkB,GAAG,IAAAC,cAAO,EAAC,OAAO;IAAET;EAAS,CAAC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EACpE,MAAMiB,MAAM,GAAG,IAAAR,cAAO,EACpB,MACES,oCAAuB,CAACC,MAAM,CAC5BL,KAAK,CAACC,WAAW,CAAC,CAACE,MAAM,EACzB,IAAI,EACJJ,YACF,CAAC,EACH,CAACE,WAAW,EAAEF,YAAY,EAAEC,KAAK,CACnC,CAAC;EAED,oBACE1C,MAAA,CAAAQ,OAAA,CAAA8B,aAAA,CAACnC,YAAA,CAAA2C,uBAAuB;IACtBV,kBAAkB,EAAEA,kBAAmB;IACvCG,iBAAiB,EAAC,QAAQ;IAC1BV,kBAAkB,EAAEA,kBAAmB;IACvCC,iBAAiB,EAAEA,iBAAkB;IACrCH,OAAO,EAAEA,OAAQ;IACjBqB,UAAU,EAAEH,MAAO;IACnBd,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA;EAAM,gBAEbhC,MAAA,CAAAQ,OAAA,CAAA8B,aAAA,CAACnC,YAAA,CAAA+B,IAAI;IAACF,KAAK,EAAEA;EAAM,GAAEN,QAAe,CACb,CAAC;AAE9B,CAAC;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAA1C,OAAA,GAEa2C,qBAAQ,CAACC,MAAM,CAAC;EAC7BC,OAAO,EAAEb,aAAa;EACtBhC,OAAO,EAAEiB;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.colors = void 0;
|
|
7
|
+
const colors = exports.colors = {
|
|
8
|
+
light: {
|
|
9
|
+
primary: "#2c2c2c",
|
|
10
|
+
disabled: "#B0BEC5",
|
|
11
|
+
background: "#f3f3f4",
|
|
12
|
+
ripple: "#bcbcbcbc"
|
|
13
|
+
},
|
|
14
|
+
dark: {
|
|
15
|
+
primary: "#fafafa",
|
|
16
|
+
disabled: "#707070",
|
|
17
|
+
background: "#2C2C2E",
|
|
18
|
+
ripple: "#F8F8F888"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["colors","exports","light","primary","disabled","background","ripple","dark"],"sources":["colors.ts"],"sourcesContent":["import type { KeyboardToolbarTheme } from \"./types\";\r\n\r\nexport const colors: KeyboardToolbarTheme = {\r\n light: {\r\n primary: \"#2c2c2c\",\r\n disabled: \"#B0BEC5\",\r\n background: \"#f3f3f4\",\r\n ripple: \"#bcbcbcbc\",\r\n },\r\n dark: {\r\n primary: \"#fafafa\",\r\n disabled: \"#707070\",\r\n background: \"#2C2C2E\",\r\n ripple: \"#F8F8F888\",\r\n },\r\n};\r\n"],"mappings":";;;;;;AAEO,MAAMA,MAA4B,GAAAC,OAAA,CAAAD,MAAA,GAAG;EAC1CE,KAAK,EAAE;IACLC,OAAO,EAAE,SAAS;IAClBC,QAAQ,EAAE,SAAS;IACnBC,UAAU,EAAE,SAAS;IACrBC,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJJ,OAAO,EAAE,SAAS;IAClBC,QAAQ,EAAE,SAAS;IACnBC,UAAU,EAAE,SAAS;IACrBC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.colors = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const colors = exports.colors = {
|
|
9
|
+
light: {
|
|
10
|
+
primary: _reactNative.Platform.select({
|
|
11
|
+
ios: (0, _reactNative.PlatformColor)("link"),
|
|
12
|
+
default: "#2c2c2c"
|
|
13
|
+
}),
|
|
14
|
+
disabled: _reactNative.Platform.select({
|
|
15
|
+
ios: (0, _reactNative.PlatformColor)("systemGray4"),
|
|
16
|
+
default: "#B0BEC5"
|
|
17
|
+
}),
|
|
18
|
+
background: _reactNative.Platform.select({
|
|
19
|
+
ios: "#F8F8F8",
|
|
20
|
+
default: "#f3f3f4"
|
|
21
|
+
}),
|
|
22
|
+
ripple: "#bcbcbcbc"
|
|
23
|
+
},
|
|
24
|
+
dark: {
|
|
25
|
+
primary: _reactNative.Platform.select({
|
|
26
|
+
ios: (0, _reactNative.PlatformColor)("label"),
|
|
27
|
+
default: "#fafafa"
|
|
28
|
+
}),
|
|
29
|
+
disabled: _reactNative.Platform.select({
|
|
30
|
+
ios: (0, _reactNative.PlatformColor)("systemGray"),
|
|
31
|
+
default: "#707070"
|
|
32
|
+
}),
|
|
33
|
+
background: _reactNative.Platform.select({
|
|
34
|
+
ios: "#555756",
|
|
35
|
+
default: "#2C2C2E"
|
|
36
|
+
}),
|
|
37
|
+
ripple: "#F8F8F888"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=colors.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","colors","exports","light","primary","Platform","select","ios","PlatformColor","default","disabled","background","ripple","dark"],"sources":["colors.native.ts"],"sourcesContent":["import { Platform, PlatformColor } from \"react-native\";\r\n\r\nimport type { KeyboardToolbarTheme } from \"./types\";\r\nimport type { ColorValue } from \"react-native\";\r\n\r\nexport const colors: KeyboardToolbarTheme = {\r\n light: {\r\n primary: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"link\"),\r\n default: \"#2c2c2c\",\r\n }),\r\n disabled: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"systemGray4\"),\r\n default: \"#B0BEC5\",\r\n }),\r\n background: Platform.select({\r\n ios: \"#F8F8F8\",\r\n default: \"#f3f3f4\",\r\n }),\r\n ripple: \"#bcbcbcbc\",\r\n },\r\n dark: {\r\n primary: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"label\"),\r\n default: \"#fafafa\",\r\n }),\r\n disabled: Platform.select<ColorValue>({\r\n ios: PlatformColor(\"systemGray\"),\r\n default: \"#707070\",\r\n }),\r\n background: Platform.select({\r\n ios: \"#555756\",\r\n default: \"#2C2C2E\",\r\n }),\r\n ripple: \"#F8F8F888\",\r\n },\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAKO,MAAMC,MAA4B,GAAAC,OAAA,CAAAD,MAAA,GAAG;EAC1CE,KAAK,EAAE;IACLC,OAAO,EAAEC,qBAAQ,CAACC,MAAM,CAAa;MACnCC,GAAG,EAAE,IAAAC,0BAAa,EAAC,MAAM,CAAC;MAC1BC,OAAO,EAAE;IACX,CAAC,CAAC;IACFC,QAAQ,EAAEL,qBAAQ,CAACC,MAAM,CAAa;MACpCC,GAAG,EAAE,IAAAC,0BAAa,EAAC,aAAa,CAAC;MACjCC,OAAO,EAAE;IACX,CAAC,CAAC;IACFE,UAAU,EAAEN,qBAAQ,CAACC,MAAM,CAAC;MAC1BC,GAAG,EAAE,SAAS;MACdE,OAAO,EAAE;IACX,CAAC,CAAC;IACFG,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJT,OAAO,EAAEC,qBAAQ,CAACC,MAAM,CAAa;MACnCC,GAAG,EAAE,IAAAC,0BAAa,EAAC,OAAO,CAAC;MAC3BC,OAAO,EAAE;IACX,CAAC,CAAC;IACFC,QAAQ,EAAEL,qBAAQ,CAACC,MAAM,CAAa;MACpCC,GAAG,EAAE,IAAAC,0BAAa,EAAC,YAAY,CAAC;MAChCC,OAAO,EAAE;IACX,CAAC,CAAC;IACFE,UAAU,EAAEN,qBAAQ,CAACC,MAAM,CAAC;MAC1BC,GAAG,EAAE,SAAS;MACdE,OAAO,EAAE;IACX,CAAC,CAAC;IACFG,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _colors.colors;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
var _bindings = require("../../bindings");
|
|
16
|
+
var _KeyboardStickyView = _interopRequireDefault(require("../KeyboardStickyView"));
|
|
17
|
+
var _useColorScheme = _interopRequireDefault(require("../hooks/useColorScheme"));
|
|
18
|
+
var _Arrow = _interopRequireDefault(require("./Arrow"));
|
|
19
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
20
|
+
var _colors = require("./colors");
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
23
|
+
const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
|
|
24
|
+
const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
|
|
25
|
+
const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;
|
|
26
|
+
const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;
|
|
27
|
+
const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
|
|
28
|
+
const KEYBOARD_TOOLBAR_HEIGHT = 42;
|
|
29
|
+
const DEFAULT_OPACITY = "FF";
|
|
30
|
+
const offset = {
|
|
31
|
+
closed: KEYBOARD_TOOLBAR_HEIGHT
|
|
32
|
+
};
|
|
33
|
+
const dismissKeyboard = () => _bindings.KeyboardController.dismiss();
|
|
34
|
+
const goToNextField = () => _bindings.KeyboardController.setFocusTo("next");
|
|
35
|
+
const goToPrevField = () => _bindings.KeyboardController.setFocusTo("prev");
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
|
|
39
|
+
* `Done` buttons.
|
|
40
|
+
*/
|
|
41
|
+
const KeyboardToolbar = ({
|
|
42
|
+
content,
|
|
43
|
+
theme = _colors.colors,
|
|
44
|
+
doneText,
|
|
45
|
+
button,
|
|
46
|
+
icon,
|
|
47
|
+
showArrows = true,
|
|
48
|
+
onNextCallback,
|
|
49
|
+
onPrevCallback,
|
|
50
|
+
onDoneCallback,
|
|
51
|
+
blur = null,
|
|
52
|
+
opacity = DEFAULT_OPACITY
|
|
53
|
+
}) => {
|
|
54
|
+
const colorScheme = (0, _useColorScheme.default)();
|
|
55
|
+
const [inputs, setInputs] = (0, _react.useState)({
|
|
56
|
+
current: 0,
|
|
57
|
+
count: 0
|
|
58
|
+
});
|
|
59
|
+
const isPrevDisabled = inputs.current === 0;
|
|
60
|
+
const isNextDisabled = inputs.current === inputs.count - 1;
|
|
61
|
+
(0, _react.useEffect)(() => {
|
|
62
|
+
const subscription = _bindings.FocusedInputEvents.addListener("focusDidSet", e => {
|
|
63
|
+
setInputs(e);
|
|
64
|
+
});
|
|
65
|
+
return subscription.remove;
|
|
66
|
+
}, []);
|
|
67
|
+
const doneStyle = (0, _react.useMemo)(() => [styles.doneButton, {
|
|
68
|
+
color: theme[colorScheme].primary
|
|
69
|
+
}], [colorScheme, theme]);
|
|
70
|
+
const toolbarStyle = (0, _react.useMemo)(() => [styles.toolbar, {
|
|
71
|
+
backgroundColor: `${theme[colorScheme].background}${opacity}`
|
|
72
|
+
}], [colorScheme, opacity, theme]);
|
|
73
|
+
const ButtonContainer = button || _Button.default;
|
|
74
|
+
const IconContainer = icon || _Arrow.default;
|
|
75
|
+
const onPressNext = (0, _react.useCallback)(() => {
|
|
76
|
+
goToNextField();
|
|
77
|
+
onNextCallback === null || onNextCallback === void 0 || onNextCallback();
|
|
78
|
+
}, [onNextCallback]);
|
|
79
|
+
const onPressPrev = (0, _react.useCallback)(() => {
|
|
80
|
+
goToPrevField();
|
|
81
|
+
onPrevCallback === null || onPrevCallback === void 0 || onPrevCallback();
|
|
82
|
+
}, [onPrevCallback]);
|
|
83
|
+
const onPressDone = (0, _react.useCallback)(() => {
|
|
84
|
+
dismissKeyboard();
|
|
85
|
+
onDoneCallback === null || onDoneCallback === void 0 || onDoneCallback();
|
|
86
|
+
}, [onDoneCallback]);
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_KeyboardStickyView.default, {
|
|
88
|
+
offset: offset
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
90
|
+
style: toolbarStyle,
|
|
91
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR
|
|
92
|
+
}, blur, showArrows && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ButtonContainer, {
|
|
93
|
+
accessibilityLabel: "Previous",
|
|
94
|
+
accessibilityHint: "Will move focus to previous field",
|
|
95
|
+
disabled: isPrevDisabled,
|
|
96
|
+
onPress: onPressPrev,
|
|
97
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,
|
|
98
|
+
theme: theme
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(IconContainer, {
|
|
100
|
+
disabled: isPrevDisabled,
|
|
101
|
+
type: "prev",
|
|
102
|
+
theme: theme
|
|
103
|
+
})), /*#__PURE__*/_react.default.createElement(ButtonContainer, {
|
|
104
|
+
accessibilityLabel: "Next",
|
|
105
|
+
accessibilityHint: "Will move focus to next field",
|
|
106
|
+
disabled: isNextDisabled,
|
|
107
|
+
onPress: onPressNext,
|
|
108
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_NEXT,
|
|
109
|
+
theme: theme
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(IconContainer, {
|
|
111
|
+
disabled: isNextDisabled,
|
|
112
|
+
type: "next",
|
|
113
|
+
theme: theme
|
|
114
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
115
|
+
style: styles.flex,
|
|
116
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_CONTENT
|
|
117
|
+
}, content), /*#__PURE__*/_react.default.createElement(ButtonContainer, {
|
|
118
|
+
accessibilityLabel: "Done",
|
|
119
|
+
accessibilityHint: "Will close the keyboard",
|
|
120
|
+
onPress: onPressDone,
|
|
121
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
|
|
122
|
+
rippleRadius: 28,
|
|
123
|
+
style: styles.doneButtonContainer,
|
|
124
|
+
theme: theme
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
126
|
+
style: doneStyle,
|
|
127
|
+
maxFontSizeMultiplier: 1.3
|
|
128
|
+
}, doneText || "Done"))));
|
|
129
|
+
};
|
|
130
|
+
const styles = _reactNative.StyleSheet.create({
|
|
131
|
+
flex: {
|
|
132
|
+
flex: 1
|
|
133
|
+
},
|
|
134
|
+
toolbar: {
|
|
135
|
+
position: "absolute",
|
|
136
|
+
bottom: 0,
|
|
137
|
+
alignItems: "center",
|
|
138
|
+
width: "100%",
|
|
139
|
+
flexDirection: "row",
|
|
140
|
+
height: KEYBOARD_TOOLBAR_HEIGHT,
|
|
141
|
+
paddingHorizontal: 8
|
|
142
|
+
},
|
|
143
|
+
doneButton: {
|
|
144
|
+
fontWeight: "600",
|
|
145
|
+
fontSize: 15
|
|
146
|
+
},
|
|
147
|
+
doneButtonContainer: {
|
|
148
|
+
marginRight: 8
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
var _default = exports.default = KeyboardToolbar;
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_KeyboardStickyView","_interopRequireDefault","_useColorScheme","_Arrow","_Button","_colors","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TEST_ID_KEYBOARD_TOOLBAR","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","offset","closed","dismissKeyboard","KeyboardController","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","colorScheme","useColorScheme","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","useEffect","subscription","FocusedInputEvents","addListener","remove","doneStyle","useMemo","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","ButtonContainer","Button","IconContainer","Arrow","onPressNext","useCallback","onPressPrev","onPressDone","createElement","View","style","testID","Fragment","accessibilityLabel","accessibilityHint","disabled","onPress","type","flex","rippleRadius","doneButtonContainer","Text","maxFontSizeMultiplier","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","paddingHorizontal","fontWeight","fontSize","marginRight","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\r\nimport { StyleSheet, Text, View } from \"react-native\";\r\n\r\nimport {\r\n FocusedInputEvents,\r\n} from \"../../bindings\";\r\nimport KeyboardStickyView from \"../KeyboardStickyView\"\r\nimport { KeyboardController } from \"../../bindings\";\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport Arrow from \"./Arrow\";\r\nimport Button from \"./Button\";\r\nimport { colors } from \"./colors\";\r\n\r\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\r\nimport type { ReactNode } from \"react\";\r\n\r\nexport type KeyboardToolbarProps = {\r\n /** An element that is shown in the middle of the toolbar. */\r\n content?: JSX.Element | null;\r\n /** A set of dark/light colors consumed by toolbar component. */\r\n theme?: KeyboardToolbarTheme;\r\n /** Custom text for done button. */\r\n doneText?: ReactNode;\r\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\r\n button?: typeof Button;\r\n /** Custom icon component used to display next/prev buttons. */\r\n icon?: typeof Arrow;\r\n /**\r\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\r\n * and want to show only `Done` button. Default to `true`.\r\n */\r\n showArrows?: boolean;\r\n /**\r\n * A callback that is called when the user presses the next button along with the default action.\r\n */\r\n onNextCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the previous button along with the default action.\r\n */\r\n onPrevCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the done button along with the default action.\r\n */\r\n onDoneCallback?: () => void;\r\n /**\r\n * A component that applies blur effect to the toolbar.\r\n */\r\n blur?: JSX.Element | null;\r\n /**\r\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\r\n */\r\n opacity?: HEX;\r\n};\r\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\r\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\r\n\r\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\r\nconst DEFAULT_OPACITY: HEX = \"FF\";\r\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\r\n\r\nconst dismissKeyboard = () => KeyboardController.dismiss();\r\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\r\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\r\n\r\n/**\r\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\r\n * `Done` buttons.\r\n */\r\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\r\n content,\r\n theme = colors,\r\n doneText,\r\n button,\r\n icon,\r\n showArrows = true,\r\n onNextCallback,\r\n onPrevCallback,\r\n onDoneCallback,\r\n blur = null,\r\n opacity = DEFAULT_OPACITY,\r\n}) => {\r\n const colorScheme = useColorScheme();\r\n const [inputs, setInputs] = useState({\r\n current: 0,\r\n count: 0,\r\n });\r\n const isPrevDisabled = inputs.current === 0;\r\n const isNextDisabled = inputs.current === inputs.count - 1;\r\n\r\n useEffect(() => {\r\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\r\n setInputs(e);\r\n });\r\n\r\n return subscription.remove;\r\n }, []);\r\n const doneStyle = useMemo(\r\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\r\n [colorScheme, theme],\r\n );\r\n const toolbarStyle = useMemo(\r\n () => [\r\n styles.toolbar,\r\n {\r\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\r\n },\r\n ],\r\n [colorScheme, opacity, theme],\r\n );\r\n const ButtonContainer = button || Button;\r\n const IconContainer = icon || Arrow;\r\n\r\n const onPressNext = useCallback(() => {\r\n goToNextField();\r\n onNextCallback?.();\r\n }, [onNextCallback]);\r\n const onPressPrev = useCallback(() => {\r\n goToPrevField();\r\n onPrevCallback?.();\r\n }, [onPrevCallback]);\r\n const onPressDone = useCallback(() => {\r\n dismissKeyboard();\r\n onDoneCallback?.();\r\n }, [onDoneCallback]);\r\n\r\n return (\r\n <KeyboardStickyView offset={offset}>\r\n <View style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\r\n {blur}\r\n {showArrows && (\r\n <>\r\n <ButtonContainer\r\n accessibilityLabel=\"Previous\"\r\n accessibilityHint=\"Will move focus to previous field\"\r\n disabled={isPrevDisabled}\r\n onPress={onPressPrev}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isPrevDisabled}\r\n type=\"prev\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n <ButtonContainer\r\n accessibilityLabel=\"Next\"\r\n accessibilityHint=\"Will move focus to next field\"\r\n disabled={isNextDisabled}\r\n onPress={onPressNext}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isNextDisabled}\r\n type=\"next\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n </>\r\n )}\r\n\r\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\r\n {content}\r\n </View>\r\n <ButtonContainer\r\n accessibilityLabel=\"Done\"\r\n accessibilityHint=\"Will close the keyboard\"\r\n onPress={onPressDone}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\r\n rippleRadius={28}\r\n style={styles.doneButtonContainer}\r\n theme={theme}\r\n >\r\n <Text style={doneStyle} maxFontSizeMultiplier={1.3}>\r\n {doneText || \"Done\"}\r\n </Text>\r\n </ButtonContainer>\r\n </View>\r\n </KeyboardStickyView>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n flex: {\r\n flex: 1,\r\n },\r\n toolbar: {\r\n position: \"absolute\",\r\n bottom: 0,\r\n alignItems: \"center\",\r\n width: \"100%\",\r\n flexDirection: \"row\",\r\n height: KEYBOARD_TOOLBAR_HEIGHT,\r\n paddingHorizontal: 8,\r\n },\r\n doneButton: {\r\n fontWeight: \"600\",\r\n fontSize: 15,\r\n },\r\n doneButtonContainer: {\r\n marginRight: 8,\r\n },\r\n});\r\n\r\nexport { colors as DefaultKeyboardToolbarTheme };\r\nexport default KeyboardToolbar;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,MAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAAkC,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAU,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA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IAC/B8E,iBAAiB,EAAE;EACrB,CAAC;EACDtC,UAAU,EAAE;IACVuC,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBc,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAGYgC,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue } from \"react-native\";\r\n\r\ntype Theme = {\r\n /** Color for arrow when it's enabled */\r\n primary: ColorValue;\r\n /** Color for arrow when it's disabled */\r\n disabled: ColorValue;\r\n /** Keyboard toolbar background color */\r\n background: string;\r\n /** Color for ripple effect (on button touch) on Android */\r\n ripple: ColorValue;\r\n};\r\nexport type KeyboardToolbarTheme = {\r\n light: Theme;\r\n dark: Theme;\r\n};\r\ntype HexSymbol =\r\n | \"0\"\r\n | \"1\"\r\n | \"2\"\r\n | \"3\"\r\n | \"4\"\r\n | \"5\"\r\n | \"6\"\r\n | \"7\"\r\n | \"8\"\r\n | \"9\"\r\n | \"A\"\r\n | \"B\"\r\n | \"C\"\r\n | \"D\"\r\n | \"E\"\r\n | \"F\"\r\n | \"a\"\r\n | \"b\"\r\n | \"c\"\r\n | \"d\"\r\n | \"e\"\r\n | \"f\";\r\nexport type HEX = `${HexSymbol}${HexSymbol}`;\r\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const useColorScheme = () => (0, _reactNative.useColorScheme)() || "light";
|
|
9
|
+
var _default = exports.default = useColorScheme;
|
|
10
|
+
//# sourceMappingURL=useColorScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","useColorScheme","useColorSchemeRN","_default","exports","default"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\r\n\r\nconst useColorScheme = () => useColorSchemeRN() || \"light\";\r\n\r\nexport default useColorScheme;\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,CAAA,KAAM,IAAAC,2BAAgB,EAAC,CAAC,IAAI,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE5CJ,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _KeyboardToolbar.DefaultKeyboardToolbarTheme;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "KeyboardAvoidingView", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _KeyboardAvoidingView.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "KeyboardAwareScrollView", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _KeyboardAwareScrollView.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "KeyboardStickyView", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _KeyboardStickyView.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "KeyboardToolbar", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _KeyboardToolbar.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _KeyboardAvoidingView = _interopRequireDefault(require("./KeyboardAvoidingView"));
|
|
37
|
+
var _KeyboardStickyView = _interopRequireDefault(require("./KeyboardStickyView"));
|
|
38
|
+
var _KeyboardAwareScrollView = _interopRequireDefault(require("./KeyboardAwareScrollView"));
|
|
39
|
+
var _KeyboardToolbar = _interopRequireWildcard(require("./KeyboardToolbar"));
|
|
40
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
41
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
|
+
//# sourceMappingURL=index.js.map
|