@react-native-ohos/react-native-keyboard-controller 1.16.8 → 1.17.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/README.OpenSource +2 -2
- package/README.md +105 -29
- package/harmony/keyboard_controller/BuildProfile.ets +1 -1
- package/harmony/keyboard_controller/Index.ets +1 -0
- package/harmony/keyboard_controller/oh-package-lock.json5 +7 -7
- package/harmony/keyboard_controller/oh-package.json5 +1 -1
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentDescriptor.h +86 -0
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.cpp +104 -0
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewJSIBinder.h +60 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +8 -1
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +2 -2
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentDescriptor.h +46 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.cpp +37 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.h +32 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewJSIBinder.h +23 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +58 -1
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +20 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +65 -44
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +22 -3
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +17 -4
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +9 -1
- package/harmony/keyboard_controller/src/main/ets/{RNKeyboardControllerPackage.ts → RNKeyboardControllerPackage.ets} +9 -5
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +29 -5
- package/harmony/keyboard_controller/src/main/ets/Type.ts +2 -1
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +20 -9
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/architecture.js +8 -0
- package/lib/commonjs/architecture.js.map +1 -0
- package/lib/commonjs/bindings.js +37 -2
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +25 -2
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/compat.js +50 -0
- package/lib/commonjs/compat.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +21 -15
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +36 -11
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +51 -16
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +2 -2
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/hooks.js +13 -0
- package/lib/commonjs/components/KeyboardChatScrollView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/index.js +122 -0
- package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/types.js +6 -0
- package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +221 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +149 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +240 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js +40 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +92 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js +13 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js +25 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js +58 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js +49 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js +49 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js +42 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js +6 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/context.js +17 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/context.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/constants.js +17 -0
- package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +95 -84
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +120 -0
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -0
- package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js +15 -0
- package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
- package/lib/commonjs/components/hooks/useColorScheme.js +1 -1
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
- package/lib/commonjs/components/hooks/useCombinedRef.js +24 -0
- package/lib/commonjs/components/hooks/useCombinedRef.js.map +1 -0
- package/lib/commonjs/components/hooks/useScrollState.js +62 -0
- package/lib/commonjs/components/hooks/useScrollState.js.map +1 -0
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/constants.js +3 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/context.js +1 -0
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks/index.js +14 -1
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardState/index.js +39 -0
- package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -0
- package/lib/commonjs/index.js +27 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +36 -0
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/module.js +21 -12
- package/lib/commonjs/module.js.map +1 -1
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +12 -0
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +8 -2
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/findNodeHandle/index.js +9 -0
- package/lib/commonjs/utils/findNodeHandle/index.js.map +1 -0
- package/lib/commonjs/utils/findNodeHandle/index.native.js +13 -0
- package/lib/commonjs/utils/findNodeHandle/index.native.js.map +1 -0
- package/lib/commonjs/views/KeyboardExtender/index.js +30 -0
- package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
- package/lib/commonjs/views/index.js +7 -0
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/animated.js +22 -11
- package/lib/module/animated.js.map +1 -1
- package/lib/module/architecture.js +2 -0
- package/lib/module/architecture.js.map +1 -0
- package/lib/module/bindings.js +36 -2
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +24 -2
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/compat.js +43 -0
- package/lib/module/compat.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +22 -16
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +35 -11
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +54 -19
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +2 -2
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/hooks.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/index.js +115 -0
- package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/types.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +207 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +143 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +234 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useEndVisible.js +33 -0
- package/lib/module/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +87 -0
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/Button.js +2 -2
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/compound/components/Background.js +6 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Content.js +18 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Done.js +50 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Next.js +41 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Prev.js +41 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/index.js +6 -0
- package/lib/module/components/KeyboardToolbar/compound/components/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/types.js +2 -0
- package/lib/module/components/KeyboardToolbar/compound/components/types.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/context.js +10 -0
- package/lib/module/components/KeyboardToolbar/compound/context.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/constants.js +11 -0
- package/lib/module/components/KeyboardToolbar/constants.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +95 -85
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/module/components/ScrollViewWithBottomPadding/index.js +112 -0
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -0
- package/lib/module/components/ScrollViewWithBottomPadding/styles.js +9 -0
- package/lib/module/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
- package/lib/module/components/hooks/useColorScheme.js +1 -1
- package/lib/module/components/hooks/useColorScheme.js.map +1 -1
- package/lib/module/components/hooks/useCombinedRef.js +18 -0
- package/lib/module/components/hooks/useCombinedRef.js.map +1 -0
- package/lib/module/components/hooks/useScrollState.js +56 -0
- package/lib/module/components/hooks/useScrollState.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/constants.js +3 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/context.js +1 -0
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js +3 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useKeyboardState/index.js +33 -0
- package/lib/module/hooks/useKeyboardState/index.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +35 -0
- package/lib/module/internal.js.map +1 -1
- package/lib/module/module.js +21 -12
- package/lib/module/module.js.map +1 -1
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +6 -0
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +7 -1
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +2 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/findNodeHandle/index.js +2 -0
- package/lib/module/utils/findNodeHandle/index.js.map +1 -0
- package/lib/module/utils/findNodeHandle/index.native.js +3 -0
- package/lib/module/utils/findNodeHandle/index.native.js.map +1 -0
- package/lib/module/views/KeyboardExtender/index.js +23 -0
- package/lib/module/views/KeyboardExtender/index.js.map +1 -0
- package/lib/module/views/index.js +1 -0
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/animated.d.ts +2 -38
- package/lib/typescript/architecture.d.ts +1 -0
- package/lib/typescript/bindings.d.ts +15 -1
- package/lib/typescript/bindings.native.d.ts +10 -1
- package/lib/typescript/compat.d.ts +12 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +5 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +4 -1
- package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
- package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +17 -0
- package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +113 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +132 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +18 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +37 -0
- package/lib/typescript/components/KeyboardChatScrollView/useEndVisible.d.ts +17 -0
- package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +45 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +2 -2
- package/lib/typescript/components/KeyboardToolbar/compound/components/Background.d.ts +6 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Content.d.ts +7 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Done.d.ts +7 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Next.d.ts +4 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Prev.d.ts +4 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/index.d.ts +5 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/types.d.ts +14 -0
- package/lib/typescript/components/KeyboardToolbar/compound/context.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/constants.d.ts +10 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +12 -45
- package/lib/typescript/components/KeyboardToolbar/types.d.ts +24 -1
- package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +30 -0
- package/lib/typescript/components/ScrollViewWithBottomPadding/styles.d.ts +7 -0
- package/lib/typescript/components/hooks/useCombinedRef.d.ts +3 -0
- package/lib/typescript/components/hooks/useScrollState.d.ts +17 -0
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/constants.d.ts +1 -0
- package/lib/typescript/context.d.ts +1 -0
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/useKeyboardState/index.d.ts +4 -0
- package/lib/typescript/index.d.ts +4 -3
- package/lib/typescript/internal.d.ts +4 -0
- package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +4 -0
- package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +6 -2
- package/lib/typescript/types.d.ts +80 -5
- package/lib/typescript/utils/findNodeHandle/index.d.ts +4 -0
- package/lib/typescript/utils/findNodeHandle/index.native.d.ts +2 -0
- package/lib/typescript/views/KeyboardExtender/index.d.ts +5 -0
- package/lib/typescript/views/index.d.ts +1 -0
- package/package.json +15 -9
- package/src/animated.tsx +41 -48
- package/src/architecture.ts +1 -0
- package/src/bindings.native.ts +37 -2
- package/src/bindings.ts +40 -1
- package/src/compat.ts +44 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +24 -17
- package/src/components/KeyboardAvoidingView/index.tsx +62 -18
- package/src/components/KeyboardAwareScrollView/index.tsx +75 -20
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +2 -2
- package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
- package/src/components/KeyboardChatScrollView/index.tsx +164 -0
- package/src/components/KeyboardChatScrollView/types.ts +117 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +268 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +260 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +374 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
- package/src/components/KeyboardChatScrollView/useEndVisible.ts +66 -0
- package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +149 -0
- package/src/components/KeyboardToolbar/Arrow.tsx +2 -2
- package/src/components/KeyboardToolbar/Button.tsx +4 -4
- package/src/components/KeyboardToolbar/compound/components/Background.tsx +9 -0
- package/src/components/KeyboardToolbar/compound/components/Content.tsx +25 -0
- package/src/components/KeyboardToolbar/compound/components/Done.tsx +57 -0
- package/src/components/KeyboardToolbar/compound/components/Next.tsx +49 -0
- package/src/components/KeyboardToolbar/compound/components/Prev.tsx +49 -0
- package/src/components/KeyboardToolbar/compound/components/index.ts +5 -0
- package/src/components/KeyboardToolbar/compound/components/types.ts +15 -0
- package/src/components/KeyboardToolbar/compound/context.ts +25 -0
- package/src/components/KeyboardToolbar/constants.ts +14 -0
- package/src/components/KeyboardToolbar/index.tsx +143 -146
- package/src/components/KeyboardToolbar/types.ts +33 -1
- package/src/components/ScrollViewWithBottomPadding/index.tsx +216 -0
- package/src/components/ScrollViewWithBottomPadding/styles.ts +10 -0
- package/src/components/hooks/useColorScheme.ts +2 -1
- package/src/components/hooks/useCombinedRef.ts +22 -0
- package/src/components/hooks/useScrollState.ts +81 -0
- package/src/components/index.ts +3 -0
- package/src/constants.ts +4 -0
- package/src/context.ts +2 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useKeyboardState/index.ts +52 -0
- package/src/index.ts +5 -1
- package/src/internal.ts +62 -0
- package/src/module.ts +21 -9
- package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +19 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +14 -3
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +1 -0
- package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
- package/src/specs/NativeKeyboardController.ts +6 -2
- package/src/types.ts +91 -5
- package/src/utils/findNodeHandle/index.native.ts +3 -0
- package/src/utils/findNodeHandle/index.ts +6 -0
- package/src/views/KeyboardExtender/index.tsx +30 -0
- package/src/views/index.ts +1 -0
- package/lib/commonjs/monkey-patch.android.js +0 -57
- package/lib/commonjs/monkey-patch.android.js.map +0 -1
- package/lib/commonjs/monkey-patch.js +0 -11
- package/lib/commonjs/monkey-patch.js.map +0 -1
- package/lib/module/monkey-patch.android.js +0 -47
- package/lib/module/monkey-patch.android.js.map +0 -1
- package/lib/module/monkey-patch.js +0 -5
- package/lib/module/monkey-patch.js.map +0 -1
- package/lib/typescript/monkey-patch.android.d.ts +0 -2
- package/lib/typescript/monkey-patch.d.ts +0 -2
- package/src/monkey-patch.android.ts +0 -44
- package/src/monkey-patch.ts +0 -4
- /package/harmony/keyboard_controller/{ts.ts → ts.ets} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Animated","StyleSheet","View","
|
|
1
|
+
{"version":3,"names":["React","useMemo","Animated","StyleSheet","View","useKeyboardState","ArrowComponent","type","disabled","theme","colorScheme","state","appearance","color","backgroundColor","primary","left","styles","arrowLeftLine","right","arrowRightLine","createElement","style","arrowDownContainer","arrowUpContainer","arrow","arrowLine","width","height","borderRadius","marginHorizontal","justifyContent","alignItems","create","transform","rotate","flexDirection"],"sources":["Arrow.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Animated, StyleSheet, View } from \"react-native\";\n\nimport { useKeyboardState } from \"../../hooks\";\n\nimport type { KeyboardToolbarTheme } from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\ntype ArrowProps = {\n type: \"prev\" | \"next\";\n disabled?: boolean;\n theme: KeyboardToolbarTheme;\n};\n\nconst ArrowComponent: React.FC<ArrowProps> = ({ type, disabled, theme }) => {\n const colorScheme = useKeyboardState((state) => state.appearance);\n\n const color = useMemo(\n () => ({\n backgroundColor: disabled\n ? theme[colorScheme].disabled\n : theme[colorScheme].primary,\n }),\n [disabled, theme, colorScheme],\n );\n const left = useMemo(() => [styles.arrowLeftLine, color], [color]);\n const right = useMemo(() => [styles.arrowRightLine, color], [color]);\n\n return (\n <View\n style={\n type === \"next\" ? styles.arrowDownContainer : styles.arrowUpContainer\n }\n >\n <View style={styles.arrow}>\n <Animated.View style={left} />\n <Animated.View style={right} />\n </View>\n </View>\n );\n};\n\nconst arrowLine: ViewStyle = {\n width: 13,\n height: 2,\n borderRadius: 1,\n};\nconst arrowUpContainer: ViewStyle = {\n marginHorizontal: 5,\n width: 30,\n height: 30,\n justifyContent: \"center\",\n alignItems: \"center\",\n};\nconst styles = StyleSheet.create({\n arrowUpContainer: arrowUpContainer,\n arrowDownContainer: {\n ...arrowUpContainer,\n transform: [{ rotate: \"180deg\" }],\n },\n arrow: {\n width: 20,\n height: 20,\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n arrowLeftLine: {\n ...arrowLine,\n transform: [{ rotate: \"-45deg\" }],\n left: -0.5,\n },\n arrowRightLine: {\n ...arrowLine,\n transform: [{ rotate: \"45deg\" }],\n left: -5.5,\n },\n});\n\nexport default ArrowComponent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,SAASC,gBAAgB,QAAQ,aAAa;AAW9C,MAAMC,cAAoC,GAAGA,CAAC;EAAEC,IAAI;EAAEC,QAAQ;EAAEC;AAAM,CAAC,KAAK;EAC1E,MAAMC,WAAW,GAAGL,gBAAgB,CAAEM,KAAK,IAAKA,KAAK,CAACC,UAAU,CAAC;EAEjE,MAAMC,KAAK,GAAGZ,OAAO,CACnB,OAAO;IACLa,eAAe,EAAEN,QAAQ,GACrBC,KAAK,CAACC,WAAW,CAAC,CAACF,QAAQ,GAC3BC,KAAK,CAACC,WAAW,CAAC,CAACK;EACzB,CAAC,CAAC,EACF,CAACP,QAAQ,EAAEC,KAAK,EAAEC,WAAW,CAC/B,CAAC;EACD,MAAMM,IAAI,GAAGf,OAAO,CAAC,MAAM,CAACgB,MAAM,CAACC,aAAa,EAAEL,KAAK,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAClE,MAAMM,KAAK,GAAGlB,OAAO,CAAC,MAAM,CAACgB,MAAM,CAACG,cAAc,EAAEP,KAAK,CAAC,EAAE,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AGM,SAAS;IACZQ,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAQ,CAAC,CAAC;IAChCnB,IAAI,EAAE,CAAC;EACT;AACF,CAAC,CAAC;AAEF,eAAeV,cAAc","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { Platform, TouchableNativeFeedback, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import
|
|
3
|
+
import { useKeyboardState } from "../../hooks";
|
|
4
4
|
const ButtonIOS = ({
|
|
5
5
|
children,
|
|
6
6
|
onPress,
|
|
@@ -37,7 +37,7 @@ const ButtonAndroid = ({
|
|
|
37
37
|
style,
|
|
38
38
|
theme
|
|
39
39
|
}) => {
|
|
40
|
-
const colorScheme =
|
|
40
|
+
const colorScheme = useKeyboardState(state => state.appearance);
|
|
41
41
|
const accessibilityState = useMemo(() => ({
|
|
42
42
|
disabled
|
|
43
43
|
}), [disabled]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Platform","TouchableNativeFeedback","TouchableOpacity","View","
|
|
1
|
+
{"version":3,"names":["React","useMemo","Platform","TouchableNativeFeedback","TouchableOpacity","View","useKeyboardState","ButtonIOS","children","onPress","disabled","accessibilityLabel","accessibilityHint","testID","style","Container","accessibilityState","createElement","accessibilityRole","ButtonAndroid","rippleRadius","theme","colorScheme","state","appearance","ripple","Ripple","background","select","android","default"],"sources":["Button.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport {\n Platform,\n TouchableNativeFeedback,\n TouchableOpacity,\n View,\n} from \"react-native\";\n\nimport { useKeyboardState } from \"../../hooks\";\n\nimport type { KeyboardToolbarTheme } from \"./types\";\nimport type { PropsWithChildren } from \"react\";\nimport type { GestureResponderEvent, ViewStyle } from \"react-native\";\n\ntype ButtonProps = {\n disabled?: boolean;\n onPress: (event: GestureResponderEvent) => void;\n accessibilityLabel: string;\n accessibilityHint: string;\n testID: string;\n rippleRadius?: number;\n style?: ViewStyle;\n theme: KeyboardToolbarTheme;\n};\n\nconst ButtonIOS = ({\n children,\n onPress,\n disabled,\n accessibilityLabel,\n accessibilityHint,\n testID,\n style,\n}: PropsWithChildren<ButtonProps>) => {\n // immediately switch to plain view to avoid animation flickering\n // when fade out animation happens and view becomes disabled\n const Container = disabled\n ? (View as unknown as typeof TouchableOpacity)\n : TouchableOpacity;\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\n\n return (\n <Container\n accessibilityState={accessibilityState}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n onPress={onPress}\n style={style}\n testID={testID}\n >\n {children}\n </Container>\n );\n};\nconst ButtonAndroid = ({\n children,\n onPress,\n disabled,\n accessibilityLabel,\n accessibilityHint,\n testID,\n rippleRadius = 18,\n style,\n theme,\n}: PropsWithChildren<ButtonProps>) => {\n const colorScheme = useKeyboardState((state) => state.appearance);\n const accessibilityState = useMemo(() => ({ disabled }), [disabled]);\n const ripple = useMemo(\n () =>\n TouchableNativeFeedback.Ripple(\n theme[colorScheme].ripple,\n true,\n rippleRadius,\n ),\n [colorScheme, rippleRadius, theme],\n );\n\n return (\n <TouchableNativeFeedback\n accessibilityState={accessibilityState}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n onPress={onPress}\n background={ripple}\n testID={testID}\n style={style}\n >\n <View style={style}>{children}</View>\n </TouchableNativeFeedback>\n );\n};\n\nexport default Platform.select({\n android: ButtonAndroid,\n default: ButtonIOS,\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SACEC,QAAQ,EACRC,uBAAuB,EACvBC,gBAAgB,EAChBC,IAAI,QACC,cAAc;AAErB,SAASC,gBAAgB,QAAQ,aAAa;AAiB9C,MAAMC,SAAS,GAAGA,CAAC;EACjBC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,kBAAkB;E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kB;IACrCH,OAAO,EAAEA,OAAQ;IACjBkB,UAAU,EAAEF,MAAO;IACnBZ,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA;EAAM,gBAEbd,KAAA,CAAAiB,aAAA,CAACZ,IAAI;IAACS,KAAK,EAAEA;EAAM,GAAEN,QAAe,CACb,CAAC;AAE9B,CAAC;AAED,eAAeN,QAAQ,CAAC0B,MAAM,CAAC;EAC7BC,OAAO,EAAEV,aAAa;EACtBW,OAAO,EAAEvB;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Background","children","createElement","Fragment"],"sources":["Background.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { ReactNode } from \"react\";\n\nconst Background: React.FC<{ children: ReactNode }> = ({ children }) => (\n <>{children}</>\n);\n\nexport default Background;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,MAAMC,UAA6C,GAAGA,CAAC;EAAEC;AAAS,CAAC,kBACjEF,KAAA,CAAAG,aAAA,CAAAH,KAAA,CAAAI,QAAA,QAAGF,QAAW,CACf;AAED,eAAeD,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import { TEST_ID_KEYBOARD_TOOLBAR_CONTENT } from "../../constants";
|
|
4
|
+
const Content = ({
|
|
5
|
+
children
|
|
6
|
+
}) => {
|
|
7
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
8
|
+
style: styles.flex,
|
|
9
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_CONTENT
|
|
10
|
+
}, children);
|
|
11
|
+
};
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
flex: {
|
|
14
|
+
flex: 1
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export default Content;
|
|
18
|
+
//# sourceMappingURL=Content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","Content","children","createElement","style","styles","flex","testID","create"],"sources":["Content.tsx"],"sourcesContent":["import React from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport { TEST_ID_KEYBOARD_TOOLBAR_CONTENT } from \"../../constants\";\n\nimport type { ReactNode } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nconst Content: React.FC<ViewProps & { children?: ReactNode }> = ({\n children,\n}) => {\n return (\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {children}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n});\n\nexport default Content;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,gCAAgC,QAAQ,iBAAiB;AAKlE,MAAMC,OAAuD,GAAGA,CAAC;EAC/DC;AACF,CAAC,KAAK;EACJ,oBACEL,KAAA,CAAAM,aAAA,CAACJ,IAAI;IAACK,KAAK,EAAEC,MAAM,CAACC,IAAK;IAACC,MAAM,EAAEP;EAAiC,GAChEE,QACG,CAAC;AAEX,CAAC;AAED,MAAMG,MAAM,GAAGP,UAAU,CAACU,MAAM,CAAC;EAC/BF,IAAI,EAAE;IACJA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAEF,eAAeL,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
|
+
import { StyleSheet, Text } from "react-native";
|
|
3
|
+
import { useKeyboardState } from "../../../../hooks";
|
|
4
|
+
import { KeyboardController } from "../../../../module";
|
|
5
|
+
import Button from "../../Button";
|
|
6
|
+
import { TEST_ID_KEYBOARD_TOOLBAR_DONE } from "../../constants";
|
|
7
|
+
import { useToolbarContext } from "../context";
|
|
8
|
+
const Done = ({
|
|
9
|
+
children,
|
|
10
|
+
onPress,
|
|
11
|
+
rippleRadius = 28,
|
|
12
|
+
text,
|
|
13
|
+
button: ButtonContainer = Button
|
|
14
|
+
}) => {
|
|
15
|
+
const colorScheme = useKeyboardState(state => state.appearance);
|
|
16
|
+
const {
|
|
17
|
+
theme
|
|
18
|
+
} = useToolbarContext();
|
|
19
|
+
const doneStyle = useMemo(() => [styles.doneButton, {
|
|
20
|
+
color: theme[colorScheme].primary
|
|
21
|
+
}], [colorScheme, theme]);
|
|
22
|
+
const onPressDone = useCallback(event => {
|
|
23
|
+
onPress === null || onPress === void 0 || onPress(event);
|
|
24
|
+
if (!event.isDefaultPrevented()) KeyboardController.dismiss();
|
|
25
|
+
}, [onPress]);
|
|
26
|
+
return /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
27
|
+
accessibilityHint: "Closes the keyboard",
|
|
28
|
+
accessibilityLabel: "Done",
|
|
29
|
+
rippleRadius: rippleRadius,
|
|
30
|
+
style: styles.doneButtonContainer,
|
|
31
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
|
|
32
|
+
theme: theme,
|
|
33
|
+
onPress: onPressDone
|
|
34
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
35
|
+
maxFontSizeMultiplier: 1.3,
|
|
36
|
+
style: doneStyle
|
|
37
|
+
}, children ?? text ?? "Done"));
|
|
38
|
+
};
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
doneButton: {
|
|
41
|
+
fontWeight: "600",
|
|
42
|
+
fontSize: 15
|
|
43
|
+
},
|
|
44
|
+
doneButtonContainer: {
|
|
45
|
+
marginRight: 16,
|
|
46
|
+
marginLeft: 8
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export default Done;
|
|
50
|
+
//# sourceMappingURL=Done.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","StyleSheet","Text","useKeyboardState","KeyboardController","Button","TEST_ID_KEYBOARD_TOOLBAR_DONE","useToolbarContext","Done","children","onPress","rippleRadius","text","button","ButtonContainer","colorScheme","state","appearance","theme","doneStyle","styles","doneButton","color","primary","onPressDone","event","isDefaultPrevented","dismiss","createElement","accessibilityHint","accessibilityLabel","style","doneButtonContainer","testID","maxFontSizeMultiplier","create","fontWeight","fontSize","marginRight","marginLeft"],"sources":["Done.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { StyleSheet, Text } from \"react-native\";\n\nimport { useKeyboardState } from \"../../../../hooks\";\nimport { KeyboardController } from \"../../../../module\";\nimport Button from \"../../Button\";\nimport { TEST_ID_KEYBOARD_TOOLBAR_DONE } from \"../../constants\";\nimport { useToolbarContext } from \"../context\";\n\nimport type { ButtonSubProps } from \"./types\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent } from \"react-native\";\n\nconst Done: React.FC<Omit<ButtonSubProps, \"icon\"> & { text?: ReactNode }> = ({\n children,\n onPress,\n rippleRadius = 28,\n text,\n button: ButtonContainer = Button,\n}) => {\n const colorScheme = useKeyboardState((state) => state.appearance);\n const { theme } = useToolbarContext();\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const onPressDone = useCallback(\n (event: GestureResponderEvent) => {\n onPress?.(event);\n if (!event.isDefaultPrevented()) KeyboardController.dismiss();\n },\n [onPress],\n );\n\n return (\n <ButtonContainer\n accessibilityHint=\"Closes the keyboard\"\n accessibilityLabel=\"Done\"\n rippleRadius={rippleRadius}\n style={styles.doneButtonContainer}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n theme={theme}\n onPress={onPressDone}\n >\n <Text maxFontSizeMultiplier={1.3} style={doneStyle}>\n {children ?? text ?? \"Done\"}\n </Text>\n </ButtonContainer>\n );\n};\n\nconst styles = StyleSheet.create({\n doneButton: { fontWeight: \"600\", fontSize: 15 },\n doneButtonContainer: { marginRight: 16, marginLeft: 8 },\n});\n\nexport default Done;\n"],"mapp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AAEA,KAAM;IACbR,OAAO,EAAEc;EAAY,gBAErB1B,KAAA,CAAA8B,aAAA,CAAC1B,IAAI;IAACgC,qBAAqB,EAAE,GAAI;IAACH,KAAK,EAAEZ;EAAU,GAChDV,QAAQ,IAAIG,IAAI,IAAI,MACjB,CACS,CAAC;AAEtB,CAAC;AAED,MAAMQ,MAAM,GAAGnB,UAAU,CAACkC,MAAM,CAAC;EAC/Bd,UAAU,EAAE;IAAEe,UAAU,EAAE,KAAK;IAAEC,QAAQ,EAAE;EAAG,CAAC;EAC/CL,mBAAmB,EAAE;IAAEM,WAAW,EAAE,EAAE;IAAEC,UAAU,EAAE;EAAE;AACxD,CAAC,CAAC;AAEF,eAAe/B,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { KeyboardController } from "../../../../module";
|
|
3
|
+
import Arrow from "../../Arrow";
|
|
4
|
+
import Button from "../../Button";
|
|
5
|
+
import { TEST_ID_KEYBOARD_TOOLBAR_NEXT } from "../../constants";
|
|
6
|
+
import { useToolbarContext } from "../context";
|
|
7
|
+
const Next = ({
|
|
8
|
+
children,
|
|
9
|
+
onPress,
|
|
10
|
+
disabled,
|
|
11
|
+
rippleRadius,
|
|
12
|
+
style,
|
|
13
|
+
button: ButtonContainer = Button,
|
|
14
|
+
icon: IconContainer = Arrow
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
theme,
|
|
18
|
+
isNextDisabled
|
|
19
|
+
} = useToolbarContext();
|
|
20
|
+
const isDisabled = disabled ?? isNextDisabled;
|
|
21
|
+
const onPressNext = useCallback(event => {
|
|
22
|
+
onPress === null || onPress === void 0 || onPress(event);
|
|
23
|
+
if (!event.isDefaultPrevented()) KeyboardController.setFocusTo("next");
|
|
24
|
+
}, [onPress]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
26
|
+
accessibilityHint: "Moves focus to the next field",
|
|
27
|
+
accessibilityLabel: "Next",
|
|
28
|
+
disabled: isDisabled,
|
|
29
|
+
rippleRadius: rippleRadius,
|
|
30
|
+
style: style,
|
|
31
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_NEXT,
|
|
32
|
+
theme: theme,
|
|
33
|
+
onPress: onPressNext
|
|
34
|
+
}, children ?? /*#__PURE__*/React.createElement(IconContainer, {
|
|
35
|
+
disabled: isDisabled,
|
|
36
|
+
theme: theme,
|
|
37
|
+
type: "next"
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
export default Next;
|
|
41
|
+
//# sourceMappingURL=Next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","KeyboardController","Arrow","Button","TEST_ID_KEYBOARD_TOOLBAR_NEXT","useToolbarContext","Next","children","onPress","disabled","rippleRadius","style","button","ButtonContainer","icon","IconContainer","theme","isNextDisabled","isDisabled","onPressNext","event","isDefaultPrevented","setFocusTo","createElement","accessibilityHint","accessibilityLabel","testID","type"],"sources":["Next.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\n\nimport { KeyboardController } from \"../../../../module\";\nimport Arrow from \"../../Arrow\";\nimport Button from \"../../Button\";\nimport { TEST_ID_KEYBOARD_TOOLBAR_NEXT } from \"../../constants\";\nimport { useToolbarContext } from \"../context\";\n\nimport type { ButtonSubProps } from \"./types\";\nimport type { GestureResponderEvent } from \"react-native\";\n\nconst Next: React.FC<ButtonSubProps> = ({\n children,\n onPress,\n disabled,\n rippleRadius,\n style,\n button: ButtonContainer = Button,\n icon: IconContainer = Arrow,\n}) => {\n const { theme, isNextDisabled } = useToolbarContext();\n const isDisabled = disabled ?? isNextDisabled;\n const onPressNext = useCallback(\n (event: GestureResponderEvent) => {\n onPress?.(event);\n if (!event.isDefaultPrevented()) KeyboardController.setFocusTo(\"next\");\n },\n [onPress],\n );\n\n return (\n <ButtonContainer\n accessibilityHint=\"Moves focus to the next field\"\n accessibilityLabel=\"Next\"\n disabled={isDisabled}\n rippleRadius={rippleRadius}\n style={style}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n onPress={onPressNext}\n >\n {children ?? (\n <IconContainer disabled={isDisabled} theme={theme} type=\"next\" />\n )}\n </ButtonContainer>\n );\n};\n\nexport default Next;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAE1C,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,6BAA6B,QAAQ,iBAAiB;AAC/D,SAASC,iBAAiB,QAAQ,YAAY;AAK9C,MAAMC,IAA8B,GAAGA,CAAC;EACtCC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,YAAY;EACZC,KAAK;EACLC,MAAM,EAAEC,eAAe,GAAGV,MAAM;EAChCW,IAAI,EAAEC,aAAa,GAAGb;AACxB,CAAC,KAAK;EACJ,MAAM;IAAEc,KAAK;IAAEC;EAAe,CAAC,GAAGZ,iBAAiB,CAAC,CAAC;EACrD,MAAMa,UAAU,GAAGT,QAAQ,IAAIQ,cAAc;EAC7C,MAAME,WAAW,GAAGnB,WAAW,CAC5BoB,KAA4B,IAAK;IAChCZ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAGY,KAAK,CAAC;IAChB,IAAI,CAACA,KAAK,CAACC,kBAAkB,CAAC,CAAC,EAAEpB,kBAAkB,CAACqB,UAAU,CAAC,MAAM,CAAC;EACxE,CAAC,EACD,CAACd,OAAO,CACV,CAAC;EAED,oBACET,KAAA,CAAAwB,aAAA,CAACV,eAAe;IACdW,iBAAiB,EAAC,+BAA+B;IACjDC,kBAAkB,EAAC,MAAM;IACzBhB,QAAQ,EAAES,UAAW;IACrBR,YAAY,EAAEA,YAAa;IAC3BC,KAAK,EAAEA,KAAM;IACbe,MAAM,EAAEtB,6BAA8B;IACtCY,KAAK,EAAEA,KAAM;IACbR,OAAO,EAAEW;EAAY,GAEpBZ,QAAQ,iBACPR,KAAA,CAAAwB,aAAA,CAACR,aAAa;IAACN,QAAQ,EAAES,UAAW;IAACF,KAAK,EAAEA,KAAM;IAACW,IAAI,EAAC;EAAM,CAAE,CAEnD,CAAC;AAEtB,CAAC;AAED,eAAerB,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { KeyboardController } from "../../../../module";
|
|
3
|
+
import Arrow from "../../Arrow";
|
|
4
|
+
import Button from "../../Button";
|
|
5
|
+
import { TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS } from "../../constants";
|
|
6
|
+
import { useToolbarContext } from "../context";
|
|
7
|
+
const Prev = ({
|
|
8
|
+
children,
|
|
9
|
+
onPress,
|
|
10
|
+
disabled,
|
|
11
|
+
rippleRadius,
|
|
12
|
+
style,
|
|
13
|
+
button: ButtonContainer = Button,
|
|
14
|
+
icon: IconContainer = Arrow
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
theme,
|
|
18
|
+
isPrevDisabled
|
|
19
|
+
} = useToolbarContext();
|
|
20
|
+
const isDisabled = disabled ?? isPrevDisabled;
|
|
21
|
+
const onPressPrev = useCallback(event => {
|
|
22
|
+
onPress === null || onPress === void 0 || onPress(event);
|
|
23
|
+
if (!event.isDefaultPrevented()) KeyboardController.setFocusTo("prev");
|
|
24
|
+
}, [onPress]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
26
|
+
accessibilityHint: "Moves focus to the previous field",
|
|
27
|
+
accessibilityLabel: "Previous",
|
|
28
|
+
disabled: isDisabled,
|
|
29
|
+
rippleRadius: rippleRadius,
|
|
30
|
+
style: style,
|
|
31
|
+
testID: TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,
|
|
32
|
+
theme: theme,
|
|
33
|
+
onPress: onPressPrev
|
|
34
|
+
}, children ?? /*#__PURE__*/React.createElement(IconContainer, {
|
|
35
|
+
disabled: isDisabled,
|
|
36
|
+
theme: theme,
|
|
37
|
+
type: "prev"
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
export default Prev;
|
|
41
|
+
//# sourceMappingURL=Prev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","KeyboardController","Arrow","Button","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","useToolbarContext","Prev","children","onPress","disabled","rippleRadius","style","button","ButtonContainer","icon","IconContainer","theme","isPrevDisabled","isDisabled","onPressPrev","event","isDefaultPrevented","setFocusTo","createElement","accessibilityHint","accessibilityLabel","testID","type"],"sources":["Prev.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\n\nimport { KeyboardController } from \"../../../../module\";\nimport Arrow from \"../../Arrow\";\nimport Button from \"../../Button\";\nimport { TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS } from \"../../constants\";\nimport { useToolbarContext } from \"../context\";\n\nimport type { ButtonSubProps } from \"./types\";\nimport type { GestureResponderEvent } from \"react-native\";\n\nconst Prev: React.FC<ButtonSubProps> = ({\n children,\n onPress,\n disabled,\n rippleRadius,\n style,\n button: ButtonContainer = Button,\n icon: IconContainer = Arrow,\n}) => {\n const { theme, isPrevDisabled } = useToolbarContext();\n const isDisabled = disabled ?? isPrevDisabled;\n const onPressPrev = useCallback(\n (event: GestureResponderEvent) => {\n onPress?.(event);\n if (!event.isDefaultPrevented()) KeyboardController.setFocusTo(\"prev\");\n },\n [onPress],\n );\n\n return (\n <ButtonContainer\n accessibilityHint=\"Moves focus to the previous field\"\n accessibilityLabel=\"Previous\"\n disabled={isDisabled}\n rippleRadius={rippleRadius}\n style={style}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n onPress={onPressPrev}\n >\n {children ?? (\n <IconContainer disabled={isDisabled} theme={theme} type=\"prev\" />\n )}\n </ButtonContainer>\n );\n};\n\nexport default Prev;\n"],"mappings":"AAAA,OAAOA,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@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Background } from "./Background";
|
|
2
|
+
export { default as Content } from "./Content";
|
|
3
|
+
export { default as Done } from "./Done";
|
|
4
|
+
export { default as Next } from "./Next";
|
|
5
|
+
export { default as Prev } from "./Prev";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","Background","Content","Done","Next","Prev"],"sources":["index.ts"],"sourcesContent":["export { default as Background } from \"./Background\";\nexport { default as Content } from \"./Content\";\nexport { default as Done } from \"./Done\";\nexport { default as Next } from \"./Next\";\nexport { default as Prev } from \"./Prev\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,OAAO,QAAQ,WAAW;AAC9C,SAASF,OAAO,IAAIG,IAAI,QAAQ,QAAQ;AACxC,SAASH,OAAO,IAAII,IAAI,QAAQ,QAAQ;AACxC,SAASJ,OAAO,IAAIK,IAAI,QAAQ,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type Arrow from \"../../Arrow\";\nimport type Button from \"../../Button\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent, ViewStyle } from \"react-native\";\n\nexport type ButtonSubProps = {\n children?: ReactNode;\n onPress?: (event: GestureResponderEvent) => void;\n disabled?: boolean;\n testID?: string;\n rippleRadius?: number;\n style?: ViewStyle;\n button?: typeof Button;\n icon?: typeof Arrow;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
export const ToolbarContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
+
export const useToolbarContext = () => {
|
|
4
|
+
const context = useContext(ToolbarContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("KeyboardToolbar.* component must be used inside <KeyboardToolbar>");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","ToolbarContext","undefined","useToolbarContext","context","Error"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nimport type { KeyboardToolbarTheme } from \"../types\";\n\ntype ToolbarContextType = {\n theme: KeyboardToolbarTheme;\n isPrevDisabled: boolean;\n isNextDisabled: boolean;\n};\n\nexport const ToolbarContext = createContext<ToolbarContextType | undefined>(\n undefined,\n);\n\nexport const useToolbarContext = () => {\n const context = useContext(ToolbarContext);\n\n if (!context) {\n throw new Error(\n \"KeyboardToolbar.* component must be used inside <KeyboardToolbar>\",\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAUjD,OAAO,MAAMC,cAAc,gBAAGF,aAAa,CACzCG,SACF,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACrC,MAAMC,OAAO,GAAGJ,UAAU,CAACC,cAAc,CAAC;EAE1C,IAAI,CAACG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CACb,mEACF,CAAC;EACH;EAEA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KEYBOARD_BORDER_RADIUS } from "../../constants";
|
|
2
|
+
export const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
|
|
3
|
+
export const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
|
|
4
|
+
export const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;
|
|
5
|
+
export const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;
|
|
6
|
+
export const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
|
|
7
|
+
export const KEYBOARD_TOOLBAR_HEIGHT = 42;
|
|
8
|
+
export const DEFAULT_OPACITY = "FF";
|
|
9
|
+
export const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;
|
|
10
|
+
export const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["KEYBOARD_BORDER_RADIUS","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","KEYBOARD_HAS_ROUNDED_CORNERS","OPENED_OFFSET"],"sources":["constants.ts"],"sourcesContent":["import { KEYBOARD_BORDER_RADIUS } from \"../../constants\";\n\nimport type { HEX } from \"./types\";\n\nexport const TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nexport const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nexport const KEYBOARD_TOOLBAR_HEIGHT = 42;\nexport const DEFAULT_OPACITY: HEX = \"FF\";\nexport const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;\nexport const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,iBAAiB;AAIxD,OAAO,MAAMC,wBAAwB,GAAG,kBAAkB;AAC1D,OAAO,MAAMC,iCAAiC,GAAG,GAAGD,wBAAwB,WAAW;AACvF,OAAO,MAAME,6BAA6B,GAAG,GAAGF,wBAAwB,OAAO;AAC/E,OAAO,MAAMG,gCAAgC,GAAG,GAAGH,wBAAwB,UAAU;AACrF,OAAO,MAAMI,6BAA6B,GAAG,GAAGJ,wBAAwB,OAAO;AAE/E,OAAO,MAAMK,uBAAuB,GAAG,EAAE;AACzC,OAAO,MAAMC,eAAoB,GAAG,IAAI;AACxC,OAAO,MAAMC,4BAA4B,GAAGR,sBAAsB,GAAG,CAAC;AACtE,OAAO,MAAMS,aAAa,GAAGD,4BAA4B,GAAG,CAAC,EAAE,GAAG,CAAC","ignoreList":[]}
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import React, {
|
|
3
|
-
import { StyleSheet,
|
|
4
|
-
import { FocusedInputEvents } from "../../bindings";
|
|
2
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
4
|
+
import { FocusedInputEvents, RCTKeyboardToolbarGroupView } from "../../bindings";
|
|
5
|
+
import { useKeyboardState } from "../../hooks";
|
|
5
6
|
import KeyboardStickyView from "../KeyboardStickyView";
|
|
6
|
-
import { KeyboardControllerNative } from "../../bindings";
|
|
7
|
-
import useColorScheme from "../hooks/useColorScheme";
|
|
8
7
|
import Arrow from "./Arrow";
|
|
9
8
|
import Button from "./Button";
|
|
10
9
|
import { colors } from "./colors";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;
|
|
15
|
-
const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
|
|
16
|
-
const KEYBOARD_TOOLBAR_HEIGHT = 42;
|
|
17
|
-
const DEFAULT_OPACITY = "FF";
|
|
18
|
-
const dismissKeyboard = () => KeyboardControllerNative.dismiss(false);
|
|
19
|
-
const goToNextField = () => KeyboardControllerNative.setFocusTo("next");
|
|
20
|
-
const goToPrevField = () => KeyboardControllerNative.setFocusTo("prev");
|
|
21
|
-
|
|
10
|
+
import { Background, Content, Done, Next, Prev } from "./compound/components";
|
|
11
|
+
import { ToolbarContext } from "./compound/context";
|
|
12
|
+
import { DEFAULT_OPACITY, KEYBOARD_HAS_ROUNDED_CORNERS, KEYBOARD_TOOLBAR_HEIGHT, OPENED_OFFSET, TEST_ID_KEYBOARD_TOOLBAR } from "./constants";
|
|
22
13
|
/**
|
|
23
14
|
* `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
|
|
24
15
|
* `Done` buttons.
|
|
25
16
|
*/
|
|
26
17
|
const KeyboardToolbar = ({
|
|
18
|
+
children,
|
|
27
19
|
content,
|
|
28
20
|
theme = colors,
|
|
29
|
-
doneText,
|
|
21
|
+
doneText = "Done",
|
|
30
22
|
button,
|
|
31
23
|
icon,
|
|
32
24
|
showArrows = true,
|
|
@@ -40,92 +32,103 @@ const KeyboardToolbar = ({
|
|
|
40
32
|
opened = 0
|
|
41
33
|
} = {},
|
|
42
34
|
enabled = true,
|
|
35
|
+
insets,
|
|
43
36
|
...rest
|
|
44
37
|
}) => {
|
|
45
|
-
const colorScheme =
|
|
38
|
+
const colorScheme = useKeyboardState(state => state.appearance);
|
|
46
39
|
const [inputs, setInputs] = useState({
|
|
47
40
|
current: 0,
|
|
48
41
|
count: 0
|
|
49
42
|
});
|
|
50
43
|
const isPrevDisabled = inputs.current === 0;
|
|
51
44
|
const isNextDisabled = inputs.current === inputs.count - 1;
|
|
45
|
+
const buttonContainer = button ?? Button;
|
|
46
|
+
const iconContainer = icon ?? Arrow;
|
|
52
47
|
useEffect(() => {
|
|
53
48
|
const subscription = FocusedInputEvents.addListener("focusDidSet", e => {
|
|
54
49
|
setInputs(e);
|
|
55
50
|
});
|
|
56
51
|
return subscription.remove;
|
|
57
52
|
}, []);
|
|
58
|
-
const doneStyle = useMemo(() => [styles.doneButton, {
|
|
59
|
-
color: theme[colorScheme].primary
|
|
60
|
-
}], [colorScheme, theme]);
|
|
61
53
|
const toolbarStyle = useMemo(() => [styles.toolbar, {
|
|
62
54
|
backgroundColor: `${theme[colorScheme].background}${opacity}`
|
|
63
|
-
}
|
|
55
|
+
}, !KEYBOARD_HAS_ROUNDED_CORNERS ? {
|
|
56
|
+
paddingLeft: insets === null || insets === void 0 ? void 0 : insets.left,
|
|
57
|
+
paddingRight: insets === null || insets === void 0 ? void 0 : insets.right
|
|
58
|
+
} : null, KEYBOARD_HAS_ROUNDED_CORNERS ? styles.floating : null], [colorScheme, opacity, theme, insets]);
|
|
59
|
+
const containerStyle = useMemo(() => [
|
|
60
|
+
// CRUCIAL: gives the native view real bounds
|
|
61
|
+
styles.sticky, KEYBOARD_HAS_ROUNDED_CORNERS ? {
|
|
62
|
+
left: ((insets === null || insets === void 0 ? void 0 : insets.left) ?? 0) + 16,
|
|
63
|
+
right: ((insets === null || insets === void 0 ? void 0 : insets.right) ?? 0) + 16
|
|
64
|
+
} : null], [insets]);
|
|
64
65
|
const offset = useMemo(() => ({
|
|
65
66
|
closed: closed + KEYBOARD_TOOLBAR_HEIGHT,
|
|
66
|
-
opened
|
|
67
|
+
opened: opened + OPENED_OFFSET
|
|
67
68
|
}), [closed, opened]);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
let backgroundElement = null;
|
|
70
|
+
let arrowsElement = null;
|
|
71
|
+
let contentContainer = null;
|
|
72
|
+
let doneElement = null;
|
|
73
|
+
if (children) {
|
|
74
|
+
let prevChild = null;
|
|
75
|
+
let nextChild = null;
|
|
76
|
+
let contentChild = null;
|
|
77
|
+
let doneChild = null;
|
|
78
|
+
let backgroundChild = null;
|
|
79
|
+
React.Children.forEach(children, child => {
|
|
80
|
+
if (! /*#__PURE__*/React.isValidElement(child)) return;
|
|
81
|
+
if (child.type === Background) backgroundChild = child;else if (child.type === Content) contentChild = child;else if (child.type === Prev) prevChild = child;else if (child.type === Next) nextChild = child;else if (child.type === Done) doneChild = child;
|
|
82
|
+
});
|
|
83
|
+
backgroundElement = backgroundChild;
|
|
84
|
+
doneElement = doneChild;
|
|
85
|
+
arrowsElement = prevChild || nextChild ? /*#__PURE__*/React.createElement(View, {
|
|
86
|
+
style: styles.arrows
|
|
87
|
+
}, prevChild, nextChild) : null;
|
|
88
|
+
contentContainer = contentChild ?? /*#__PURE__*/React.createElement(Content, null, contentChild);
|
|
89
|
+
} else {
|
|
90
|
+
backgroundElement = blur;
|
|
91
|
+
arrowsElement = showArrows ? /*#__PURE__*/React.createElement(View, {
|
|
92
|
+
style: styles.arrows
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Prev, {
|
|
94
|
+
button: buttonContainer,
|
|
95
|
+
icon: iconContainer,
|
|
96
|
+
onPress: onPrevCallback
|
|
97
|
+
}), /*#__PURE__*/React.createElement(Next, {
|
|
98
|
+
button: buttonContainer,
|
|
99
|
+
icon: iconContainer,
|
|
100
|
+
onPress: onNextCallback
|
|
101
|
+
})) : null;
|
|
102
|
+
contentContainer = /*#__PURE__*/React.createElement(Content, null, content);
|
|
103
|
+
doneElement = doneText ? /*#__PURE__*/React.createElement(Done, {
|
|
104
|
+
button: buttonContainer,
|
|
105
|
+
text: doneText,
|
|
106
|
+
onPress: onDoneCallback
|
|
107
|
+
}) : null;
|
|
108
|
+
}
|
|
109
|
+
const contextValue = useMemo(() => ({
|
|
110
|
+
theme,
|
|
111
|
+
isPrevDisabled,
|
|
112
|
+
isNextDisabled
|
|
113
|
+
}), [theme, isPrevDisabled, isNextDisabled]);
|
|
114
|
+
return /*#__PURE__*/React.createElement(ToolbarContext.Provider, {
|
|
115
|
+
value: contextValue
|
|
116
|
+
}, /*#__PURE__*/React.createElement(KeyboardStickyView, {
|
|
83
117
|
enabled: enabled,
|
|
84
|
-
offset: offset
|
|
118
|
+
offset: offset,
|
|
119
|
+
style: containerStyle
|
|
85
120
|
}, /*#__PURE__*/React.createElement(View, _extends({}, rest, {
|
|
86
121
|
style: toolbarStyle,
|
|
87
122
|
testID: TEST_ID_KEYBOARD_TOOLBAR
|
|
88
|
-
}),
|
|
89
|
-
accessibilityLabel: "Previous",
|
|
90
|
-
accessibilityHint: "Will move focus to previous field",
|
|
91
|
-
disabled: isPrevDisabled,
|
|
92
|
-
onPress: onPressPrev,
|
|
93
|
-
testID: TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,
|
|
94
|
-
theme: theme
|
|
95
|
-
}, /*#__PURE__*/React.createElement(IconContainer, {
|
|
96
|
-
disabled: isPrevDisabled,
|
|
97
|
-
type: "prev",
|
|
98
|
-
theme: theme
|
|
99
|
-
})), /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
100
|
-
accessibilityLabel: "Next",
|
|
101
|
-
accessibilityHint: "Will move focus to next field",
|
|
102
|
-
disabled: isNextDisabled,
|
|
103
|
-
onPress: onPressNext,
|
|
104
|
-
testID: TEST_ID_KEYBOARD_TOOLBAR_NEXT,
|
|
105
|
-
theme: theme
|
|
106
|
-
}, /*#__PURE__*/React.createElement(IconContainer, {
|
|
107
|
-
disabled: isNextDisabled,
|
|
108
|
-
type: "next",
|
|
109
|
-
theme: theme
|
|
110
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
111
|
-
style: styles.flex,
|
|
112
|
-
testID: TEST_ID_KEYBOARD_TOOLBAR_CONTENT
|
|
113
|
-
}, content), /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
114
|
-
accessibilityLabel: "Done",
|
|
115
|
-
accessibilityHint: "Will close the keyboard",
|
|
116
|
-
onPress: onPressDone,
|
|
117
|
-
testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
|
|
118
|
-
rippleRadius: 28,
|
|
119
|
-
style: styles.doneButtonContainer,
|
|
120
|
-
theme: theme
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
122
|
-
style: doneStyle,
|
|
123
|
-
maxFontSizeMultiplier: 1.3
|
|
124
|
-
}, doneText || "Done"))));
|
|
123
|
+
}), backgroundElement, arrowsElement, contentContainer, doneElement)));
|
|
125
124
|
};
|
|
126
125
|
const styles = StyleSheet.create({
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
sticky: {
|
|
127
|
+
position: "absolute",
|
|
128
|
+
left: 0,
|
|
129
|
+
right: 0,
|
|
130
|
+
bottom: 0,
|
|
131
|
+
height: KEYBOARD_TOOLBAR_HEIGHT
|
|
129
132
|
},
|
|
130
133
|
toolbar: {
|
|
131
134
|
position: "absolute",
|
|
@@ -133,17 +136,24 @@ const styles = StyleSheet.create({
|
|
|
133
136
|
alignItems: "center",
|
|
134
137
|
width: "100%",
|
|
135
138
|
flexDirection: "row",
|
|
136
|
-
height: KEYBOARD_TOOLBAR_HEIGHT
|
|
137
|
-
paddingHorizontal: 8
|
|
139
|
+
height: KEYBOARD_TOOLBAR_HEIGHT
|
|
138
140
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
arrows: {
|
|
142
|
+
flexDirection: "row",
|
|
143
|
+
paddingLeft: 8
|
|
142
144
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
floating: {
|
|
146
|
+
alignSelf: "center",
|
|
147
|
+
borderRadius: 20,
|
|
148
|
+
overflow: "hidden"
|
|
145
149
|
}
|
|
146
150
|
});
|
|
151
|
+
KeyboardToolbar.Background = Background;
|
|
152
|
+
KeyboardToolbar.Content = Content;
|
|
153
|
+
KeyboardToolbar.Prev = Prev;
|
|
154
|
+
KeyboardToolbar.Next = Next;
|
|
155
|
+
KeyboardToolbar.Done = Done;
|
|
156
|
+
KeyboardToolbar.Group = RCTKeyboardToolbarGroupView;
|
|
147
157
|
export { colors as DefaultKeyboardToolbarTheme };
|
|
148
158
|
export default KeyboardToolbar;
|
|
149
159
|
//# sourceMappingURL=index.js.map
|