@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,10 +1,14 @@
|
|
|
1
1
|
import type { TurboModule } from "react-native";
|
|
2
2
|
export interface Spec extends TurboModule {
|
|
3
|
-
readonly getConstants: () => {
|
|
3
|
+
readonly getConstants: () => {
|
|
4
|
+
keyboardBorderRadius: number;
|
|
5
|
+
};
|
|
4
6
|
setInputMode(mode: number): void;
|
|
5
7
|
setDefaultMode(): void;
|
|
6
|
-
|
|
8
|
+
preload(): void;
|
|
9
|
+
dismiss(keepFocus: boolean, animated: boolean): void;
|
|
7
10
|
setFocusTo(direction: string): void;
|
|
11
|
+
viewPositionInWindow(viewTag: number): Promise<object>;
|
|
8
12
|
addListener: (eventName: string) => void;
|
|
9
13
|
removeListeners: (count: number) => void;
|
|
10
14
|
}
|
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
2
|
import type { EmitterSubscription, NativeSyntheticEvent, TextInputProps, ViewProps } from "react-native";
|
|
3
|
+
export type KeyboardProviderProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Set the value to `true`, if you use translucent status bar on Android.
|
|
7
|
+
* If you already control status bar translucency via `react-native-screens`
|
|
8
|
+
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
9
|
+
* Defaults to `false`.
|
|
10
|
+
*
|
|
11
|
+
* @platform android
|
|
12
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
13
|
+
*/
|
|
14
|
+
statusBarTranslucent?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
17
|
+
* Defaults to `false`.
|
|
18
|
+
*
|
|
19
|
+
* @platform android
|
|
20
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
21
|
+
*/
|
|
22
|
+
navigationBarTranslucent?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
25
|
+
* Defaults to `false`.
|
|
26
|
+
*
|
|
27
|
+
* @platform android
|
|
28
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
29
|
+
*/
|
|
30
|
+
preserveEdgeToEdge?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
33
|
+
* (if you try to change this prop after component mount it will not have any effect).
|
|
34
|
+
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
35
|
+
* Defaults to `true`.
|
|
36
|
+
*/
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.
|
|
40
|
+
* Defaults to `true`.
|
|
41
|
+
*
|
|
42
|
+
* @platform ios
|
|
43
|
+
*/
|
|
44
|
+
preload?: boolean;
|
|
45
|
+
};
|
|
3
46
|
export type NativeEvent = {
|
|
4
47
|
progress: number;
|
|
5
48
|
height: number;
|
|
@@ -81,25 +124,54 @@ export type KeyboardGestureAreaProps = {
|
|
|
81
124
|
export type OverKeyboardViewProps = PropsWithChildren<{
|
|
82
125
|
visible: boolean;
|
|
83
126
|
}>;
|
|
127
|
+
export type ClippingScrollViewProps = PropsWithChildren<ViewProps & {
|
|
128
|
+
/** An additional space that gets applied to the bottom of the ScrollView content. Default is 0. */
|
|
129
|
+
contentInsetBottom?: number;
|
|
130
|
+
/** An additional space that gets applied to the top of the ScrollView content. Default is 0. */
|
|
131
|
+
contentInsetTop?: number;
|
|
132
|
+
applyWorkaroundForContentInsetHitTestBug?: boolean;
|
|
133
|
+
}>;
|
|
134
|
+
export type KeyboardBackgroundViewProps = PropsWithChildren<ViewProps>;
|
|
135
|
+
export type KeyboardToolbarGroupViewProps = PropsWithChildren<ViewProps>;
|
|
136
|
+
export type KeyboardExtenderProps = PropsWithChildren<{
|
|
137
|
+
/** Controls whether this `KeyboardExtender` instance should take effect. Default is `true`. */
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
}>;
|
|
84
140
|
export type Direction = "next" | "prev" | "current";
|
|
85
141
|
export type DismissOptions = {
|
|
86
142
|
keepFocus: boolean;
|
|
143
|
+
animated: boolean;
|
|
87
144
|
};
|
|
88
145
|
export type KeyboardControllerModule = {
|
|
89
146
|
setDefaultMode: () => void;
|
|
90
147
|
setInputMode: (mode: number) => void;
|
|
91
|
-
|
|
148
|
+
preload: () => void;
|
|
149
|
+
dismiss: (options?: Partial<DismissOptions>) => Promise<void>;
|
|
92
150
|
setFocusTo: (direction: Direction) => void;
|
|
93
151
|
isVisible: () => boolean;
|
|
94
|
-
state: () => KeyboardEventData
|
|
152
|
+
state: () => KeyboardEventData;
|
|
95
153
|
addListener: (eventName: string) => void;
|
|
96
154
|
removeListeners: (count: number) => void;
|
|
155
|
+
getConstants: () => {
|
|
156
|
+
keyboardBorderRadius: number;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
export type ViewPositionInWindowResult = {
|
|
160
|
+
x: number;
|
|
161
|
+
y: number;
|
|
162
|
+
width: number;
|
|
163
|
+
height: number;
|
|
97
164
|
};
|
|
98
165
|
export type KeyboardControllerNativeModule = {
|
|
99
166
|
setDefaultMode: () => void;
|
|
100
167
|
setInputMode: (mode: number) => void;
|
|
101
|
-
|
|
168
|
+
preload: () => void;
|
|
169
|
+
dismiss: (keepFocus: boolean, animated: boolean) => void;
|
|
102
170
|
setFocusTo: (direction: Direction) => void;
|
|
171
|
+
viewPositionInWindow: (viewTag: number) => Promise<ViewPositionInWindowResult>;
|
|
172
|
+
getConstants: () => {
|
|
173
|
+
keyboardBorderRadius: number;
|
|
174
|
+
};
|
|
103
175
|
addListener: (eventName: string) => void;
|
|
104
176
|
removeListeners: (count: number) => void;
|
|
105
177
|
};
|
|
@@ -111,12 +183,15 @@ export type KeyboardEventData = {
|
|
|
111
183
|
timestamp: number;
|
|
112
184
|
target: number;
|
|
113
185
|
type: NonNullable<TextInputProps["keyboardType"]>;
|
|
114
|
-
appearance:
|
|
186
|
+
appearance: "dark" | "light";
|
|
115
187
|
};
|
|
188
|
+
export type IKeyboardState = {
|
|
189
|
+
isVisible: boolean;
|
|
190
|
+
} & KeyboardEventData;
|
|
116
191
|
export type KeyboardEventsModule = {
|
|
117
192
|
addListener: (name: KeyboardControllerEvents, cb: (e: KeyboardEventData) => void) => EmitterSubscription;
|
|
118
193
|
};
|
|
119
|
-
export type FocusedInputAvailableEvents = "focusDidSet";
|
|
194
|
+
export type FocusedInputAvailableEvents = "focusDidSet" | "layoutDidSynchronize";
|
|
120
195
|
export type FocusedInputEventData = {
|
|
121
196
|
current: number;
|
|
122
197
|
count: number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { KeyboardExtenderProps } from "../../types";
|
|
3
|
+
import type { PropsWithChildren } from "react";
|
|
4
|
+
declare const KeyboardExtender: ({ children, enabled, }: PropsWithChildren<KeyboardExtenderProps>) => React.JSX.Element;
|
|
5
|
+
export default KeyboardExtender;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-keyboard-controller",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Keyboard manager which works in identical way on iOS and Android and harmony",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"react-native-keyboard-controller.podspec",
|
|
18
18
|
"jest",
|
|
19
19
|
"!lib/typescript/example",
|
|
20
|
-
"!harmony/keyboard_controller/build",
|
|
21
20
|
"!android/build",
|
|
22
21
|
"!android/.gradle",
|
|
23
22
|
"!android/gradle",
|
|
@@ -27,7 +26,8 @@
|
|
|
27
26
|
"!ios/KeyboardControllerNative",
|
|
28
27
|
"!**/__tests__",
|
|
29
28
|
"!**/__fixtures__",
|
|
30
|
-
"!**/__mocks__"
|
|
29
|
+
"!**/__mocks__",
|
|
30
|
+
"!build"
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"format": "prettier '**/*' --ignore-unknown --write",
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"bugs": {
|
|
73
73
|
"url": "https://gitcode.com/CPF-RN/rntpc_react-native-keyboard-controller/issues"
|
|
74
74
|
},
|
|
75
|
-
"homepage": "https://gitcode.com/CPF-RN/rntpc_react-native-keyboard-controller/tree/br_rnoh0.
|
|
75
|
+
"homepage": "https://gitcode.com/CPF-RN/rntpc_react-native-keyboard-controller/tree/br_rnoh0.82#readme",
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"registry": "https://registry.npmjs.org/"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@commitlint/config-conventional": "^11.0.0",
|
|
81
|
-
"@react-native/babel-preset": "0.
|
|
82
|
-
"@react-native/eslint-config": "0.
|
|
81
|
+
"@react-native/babel-preset": "0.82.0",
|
|
82
|
+
"@react-native/eslint-config": "0.82.0",
|
|
83
83
|
"@release-it/conventional-changelog": "^2.0.0",
|
|
84
84
|
"@testing-library/react-hooks": "^8.0.1",
|
|
85
85
|
"@types/jest": "^29.5.13",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"pod-install": "^0.1.0",
|
|
104
104
|
"prettier": "^2.8.8",
|
|
105
105
|
"react": "18.3.1",
|
|
106
|
-
"react-native": "0.
|
|
106
|
+
"react-native": "0.82.1",
|
|
107
107
|
"react-native-builder-bob": "^0.18.0",
|
|
108
108
|
"react-native-reanimated": "3.18.0",
|
|
109
109
|
"react-test-renderer": "18.2.0",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"react": "*",
|
|
115
115
|
"react-native": "*",
|
|
116
116
|
"react-native-reanimated": ">=3.0.0",
|
|
117
|
-
"react-native-keyboard-controller": "1.
|
|
117
|
+
"react-native-keyboard-controller": "1.21.8"
|
|
118
118
|
},
|
|
119
119
|
"jest": {
|
|
120
120
|
"preset": "react-native",
|
|
@@ -172,6 +172,12 @@
|
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
174
|
"harmony": {
|
|
175
|
-
"alias": "react-native-keyboard-controller"
|
|
175
|
+
"alias": "react-native-keyboard-controller",
|
|
176
|
+
"autolinking": {
|
|
177
|
+
"etsPackageClassName": "RNKeyboardControllerPackage",
|
|
178
|
+
"cppPackageClassName": "RNKeyboardControllerPackage",
|
|
179
|
+
"cmakeLibraryTargetName": "rnoh_keyboard_controller",
|
|
180
|
+
"ohPackageName": "@react-native-ohos/react-native-keyboard-controller"
|
|
181
|
+
}
|
|
176
182
|
}
|
|
177
183
|
}
|
package/src/animated.tsx
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useMemo,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
} from "react";
|
|
2
8
|
import { Animated, Platform, StyleSheet } from "react-native";
|
|
3
9
|
import Reanimated, { useSharedValue } from "react-native-reanimated";
|
|
4
10
|
|
|
5
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
FocusedInputEvents,
|
|
13
|
+
KeyboardControllerView,
|
|
14
|
+
KeyboardControllerViewCommands,
|
|
15
|
+
} from "./bindings";
|
|
6
16
|
import { KeyboardContext } from "./context";
|
|
7
17
|
import { useAnimatedValue, useSharedHandlers } from "./internal";
|
|
8
|
-
import {
|
|
18
|
+
import { KeyboardController } from "./module";
|
|
9
19
|
import {
|
|
10
20
|
useAnimatedKeyboardHandler,
|
|
11
21
|
useFocusedInputLayoutHandler,
|
|
@@ -19,6 +29,7 @@ import type {
|
|
|
19
29
|
FocusedInputLayoutChangedEvent,
|
|
20
30
|
KeyboardControllerProps,
|
|
21
31
|
KeyboardHandler,
|
|
32
|
+
KeyboardProviderProps,
|
|
22
33
|
NativeEvent,
|
|
23
34
|
} from "./types";
|
|
24
35
|
import type { ViewStyle } from "react-native";
|
|
@@ -27,7 +38,10 @@ const KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(
|
|
|
27
38
|
Animated.createAnimatedComponent(
|
|
28
39
|
KeyboardControllerView,
|
|
29
40
|
) as React.FC<KeyboardControllerProps>,
|
|
30
|
-
)
|
|
41
|
+
) as React.ComponentType<
|
|
42
|
+
KeyboardControllerProps &
|
|
43
|
+
React.RefAttributes<React.Component<KeyboardControllerProps>>
|
|
44
|
+
>;
|
|
31
45
|
|
|
32
46
|
type Styles = {
|
|
33
47
|
container: ViewStyle;
|
|
@@ -44,43 +58,6 @@ const styles = StyleSheet.create<Styles>({
|
|
|
44
58
|
},
|
|
45
59
|
});
|
|
46
60
|
|
|
47
|
-
type KeyboardProviderProps = {
|
|
48
|
-
children: React.ReactNode;
|
|
49
|
-
/**
|
|
50
|
-
* Set the value to `true`, if you use translucent status bar on Android.
|
|
51
|
-
* If you already control status bar translucency via `react-native-screens`
|
|
52
|
-
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
53
|
-
* Defaults to `false`.
|
|
54
|
-
*
|
|
55
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
56
|
-
* @platform android
|
|
57
|
-
*/
|
|
58
|
-
statusBarTranslucent?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
61
|
-
* Defaults to `false`.
|
|
62
|
-
*
|
|
63
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
64
|
-
* @platform android
|
|
65
|
-
*/
|
|
66
|
-
navigationBarTranslucent?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
69
|
-
* Defaults to `false`.
|
|
70
|
-
*
|
|
71
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
72
|
-
* @platform android
|
|
73
|
-
*/
|
|
74
|
-
preserveEdgeToEdge?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* A boolean prop indicating whether the module is enabled. It indicate only initial state,
|
|
77
|
-
* i. e. if you try to change this prop after component mount it will not have any effect.
|
|
78
|
-
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
79
|
-
* Defaults to `true`.
|
|
80
|
-
*/
|
|
81
|
-
enabled?: boolean;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
61
|
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
85
62
|
// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details
|
|
86
63
|
const OS = Platform.OS;
|
|
@@ -91,7 +68,9 @@ export const KeyboardProvider = ({
|
|
|
91
68
|
navigationBarTranslucent,
|
|
92
69
|
preserveEdgeToEdge,
|
|
93
70
|
enabled: initiallyEnabled = true,
|
|
71
|
+
preload = true,
|
|
94
72
|
}: KeyboardProviderProps) => {
|
|
73
|
+
const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);
|
|
95
74
|
// state
|
|
96
75
|
const [enabled, setEnabled] = useState(initiallyEnabled);
|
|
97
76
|
// animated values
|
|
@@ -105,6 +84,21 @@ export const KeyboardProvider = ({
|
|
|
105
84
|
useSharedHandlers<KeyboardHandler>();
|
|
106
85
|
const [setInputHandlers, broadcastInputEvents] =
|
|
107
86
|
useSharedHandlers<FocusedInputHandler>();
|
|
87
|
+
const update = useCallback(async () => {
|
|
88
|
+
KeyboardControllerViewCommands.synchronizeFocusedInputLayout(
|
|
89
|
+
viewRef.current,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
await new Promise((resolve) => {
|
|
93
|
+
const subscription = FocusedInputEvents.addListener(
|
|
94
|
+
"layoutDidSynchronize",
|
|
95
|
+
() => {
|
|
96
|
+
subscription.remove();
|
|
97
|
+
resolve(null);
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
}, []);
|
|
108
102
|
// memo
|
|
109
103
|
const context = useMemo<KeyboardAnimationContext>(
|
|
110
104
|
() => ({
|
|
@@ -112,11 +106,12 @@ export const KeyboardProvider = ({
|
|
|
112
106
|
animated: { progress: progress, height: Animated.multiply(height,-1) },
|
|
113
107
|
reanimated: { progress: progressSV, height: heightSV },
|
|
114
108
|
layout,
|
|
109
|
+
update,
|
|
115
110
|
setKeyboardHandlers,
|
|
116
111
|
setInputHandlers,
|
|
117
112
|
setEnabled,
|
|
118
113
|
}),
|
|
119
|
-
[enabled],
|
|
114
|
+
[enabled, update],
|
|
120
115
|
);
|
|
121
116
|
const style = useMemo(
|
|
122
117
|
() => [
|
|
@@ -211,18 +206,16 @@ export const KeyboardProvider = ({
|
|
|
211
206
|
},
|
|
212
207
|
[],
|
|
213
208
|
);
|
|
214
|
-
// effects
|
|
215
209
|
useEffect(() => {
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
} else {
|
|
219
|
-
revertMonkeyPatch();
|
|
210
|
+
if (preload) {
|
|
211
|
+
KeyboardController.preload();
|
|
220
212
|
}
|
|
221
|
-
}, [
|
|
213
|
+
}, [preload]);
|
|
222
214
|
|
|
223
215
|
return (
|
|
224
216
|
<KeyboardContext.Provider value={context}>
|
|
225
217
|
<KeyboardControllerViewAnimated
|
|
218
|
+
ref={viewRef}
|
|
226
219
|
enabled={enabled}
|
|
227
220
|
onKeyboardMoveReanimated={keyboardHandler}
|
|
228
221
|
onKeyboardMoveStart={OS === "ios" ? onKeyboardMove : undefined}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const IS_FABRIC = "nativeFabricUIManager" in global;
|
package/src/bindings.native.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
Platform,
|
|
5
|
+
useColorScheme,
|
|
6
|
+
View,
|
|
7
|
+
} from "react-native";
|
|
2
8
|
|
|
3
9
|
import type {
|
|
10
|
+
ClippingScrollViewProps,
|
|
4
11
|
FocusedInputEventsModule,
|
|
12
|
+
KeyboardBackgroundViewProps,
|
|
5
13
|
KeyboardControllerNativeModule,
|
|
6
14
|
KeyboardControllerProps,
|
|
7
15
|
KeyboardEventsModule,
|
|
16
|
+
KeyboardExtenderProps,
|
|
8
17
|
KeyboardGestureAreaProps,
|
|
18
|
+
KeyboardToolbarGroupViewProps,
|
|
9
19
|
OverKeyboardViewProps,
|
|
10
20
|
WindowDimensionsEventsModule,
|
|
11
21
|
} from "./types";
|
|
22
|
+
import type { View as RNView } from "react-native";
|
|
12
23
|
|
|
13
24
|
const LINKING_ERROR =
|
|
14
25
|
`The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -16,6 +27,7 @@ const LINKING_ERROR =
|
|
|
16
27
|
"- You rebuilt the app after installing the package\n" +
|
|
17
28
|
"- You are not using Expo Go\n";
|
|
18
29
|
|
|
30
|
+
const KeyboardControllerViewNativeComponentModule = require("./specs/KeyboardControllerViewNativeComponent");
|
|
19
31
|
const RCTKeyboardController =
|
|
20
32
|
require("./specs/NativeKeyboardController").default;
|
|
21
33
|
|
|
@@ -53,10 +65,33 @@ export const WindowDimensionsEvents: WindowDimensionsEventsModule = {
|
|
|
53
65
|
eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),
|
|
54
66
|
};
|
|
55
67
|
export const KeyboardControllerView: React.FC<KeyboardControllerProps> =
|
|
56
|
-
|
|
68
|
+
KeyboardControllerViewNativeComponentModule.default;
|
|
69
|
+
export const KeyboardControllerViewCommands =
|
|
70
|
+
KeyboardControllerViewNativeComponentModule.Commands;
|
|
57
71
|
export const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =
|
|
58
72
|
(Platform.OS === "android" && Platform.Version >= 30) || Platform.OS === "ios"
|
|
59
73
|
? require("./specs/KeyboardGestureAreaNativeComponent").default
|
|
60
74
|
: ({ children }: KeyboardGestureAreaProps) => children;
|
|
61
75
|
export const RCTOverKeyboardView: React.FC<OverKeyboardViewProps> =
|
|
62
76
|
require("./specs/OverKeyboardViewNativeComponent").default;
|
|
77
|
+
export const ClippingScrollView: React.FC<ClippingScrollViewProps> =
|
|
78
|
+
Platform.OS === "android" || (Platform.OS as string) === "harmony"
|
|
79
|
+
? require("./specs/ClippingScrollViewDecoratorViewNativeComponent").default
|
|
80
|
+
: ({ children }: ClippingScrollViewProps) => children;
|
|
81
|
+
export const KeyboardBackgroundView = React.forwardRef<
|
|
82
|
+
RNView,
|
|
83
|
+
KeyboardBackgroundViewProps
|
|
84
|
+
>(({ style, ...props }, ref) => {
|
|
85
|
+
const colorScheme = useColorScheme();
|
|
86
|
+
const backgroundColor = colorScheme === "dark" ? "#2c2c2e" : "#eceff3";
|
|
87
|
+
|
|
88
|
+
return React.createElement(View, {
|
|
89
|
+
ref,
|
|
90
|
+
style: [{ backgroundColor }, style],
|
|
91
|
+
...props,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
export const RCTKeyboardExtender =
|
|
95
|
+
View as unknown as React.FC<KeyboardExtenderProps>;
|
|
96
|
+
export const RCTKeyboardToolbarGroupView: React.FC<KeyboardToolbarGroupViewProps> =
|
|
97
|
+
require("./specs/KeyboardToolbarGroupViewNativeComponent").default;
|
package/src/bindings.ts
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useColorScheme, View } from "react-native";
|
|
2
3
|
|
|
3
4
|
import type {
|
|
5
|
+
ClippingScrollViewProps,
|
|
4
6
|
FocusedInputEventsModule,
|
|
7
|
+
KeyboardBackgroundViewProps,
|
|
5
8
|
KeyboardControllerNativeModule,
|
|
6
9
|
KeyboardControllerProps,
|
|
7
10
|
KeyboardEventsModule,
|
|
11
|
+
KeyboardExtenderProps,
|
|
8
12
|
KeyboardGestureAreaProps,
|
|
13
|
+
KeyboardToolbarGroupViewProps,
|
|
9
14
|
OverKeyboardViewProps,
|
|
10
15
|
WindowDimensionsEventsModule,
|
|
11
16
|
} from "./types";
|
|
12
17
|
import type { EmitterSubscription } from "react-native";
|
|
18
|
+
import type { View as RNView } from "react-native";
|
|
13
19
|
|
|
14
20
|
const NOOP = () => {};
|
|
15
21
|
|
|
16
22
|
export const KeyboardControllerNative: KeyboardControllerNativeModule = {
|
|
17
23
|
setDefaultMode: NOOP,
|
|
18
24
|
setInputMode: NOOP,
|
|
25
|
+
preload: NOOP,
|
|
19
26
|
dismiss: NOOP,
|
|
20
27
|
setFocusTo: NOOP,
|
|
28
|
+
viewPositionInWindow: () =>
|
|
29
|
+
Promise.resolve({ x: 0, y: 0, width: 0, height: 0 }),
|
|
21
30
|
addListener: NOOP,
|
|
22
31
|
removeListeners: NOOP,
|
|
32
|
+
getConstants: () => ({
|
|
33
|
+
keyboardBorderRadius: 0,
|
|
34
|
+
}),
|
|
23
35
|
};
|
|
24
36
|
export const KeyboardEvents: KeyboardEventsModule = {
|
|
25
37
|
addListener: () => ({ remove: NOOP } as EmitterSubscription),
|
|
@@ -36,7 +48,34 @@ export const WindowDimensionsEvents: WindowDimensionsEventsModule = {
|
|
|
36
48
|
};
|
|
37
49
|
export const KeyboardControllerView =
|
|
38
50
|
View as unknown as React.FC<KeyboardControllerProps>;
|
|
51
|
+
export const KeyboardControllerViewCommands = {
|
|
52
|
+
synchronizeFocusedInputLayout: (
|
|
53
|
+
_ref: React.Component<KeyboardControllerProps> | null,
|
|
54
|
+
) => {},
|
|
55
|
+
};
|
|
39
56
|
export const KeyboardGestureArea =
|
|
40
57
|
View as unknown as React.FC<KeyboardGestureAreaProps>;
|
|
41
58
|
export const RCTOverKeyboardView =
|
|
42
59
|
View as unknown as React.FC<OverKeyboardViewProps>;
|
|
60
|
+
export const ClippingScrollView =
|
|
61
|
+
View as unknown as React.FC<ClippingScrollViewProps>;
|
|
62
|
+
export const KeyboardBackgroundView = React.forwardRef<
|
|
63
|
+
RNView,
|
|
64
|
+
KeyboardBackgroundViewProps
|
|
65
|
+
>(({ style, ...props }, ref) => {
|
|
66
|
+
const colorScheme = useColorScheme();
|
|
67
|
+
const backgroundColor = colorScheme === "dark" ? "#2c2c2e" : "#eceff3";
|
|
68
|
+
|
|
69
|
+
return React.createElement(View, {
|
|
70
|
+
ref,
|
|
71
|
+
style: [{ backgroundColor }, style],
|
|
72
|
+
...props,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
export const RCTKeyboardExtender =
|
|
76
|
+
View as unknown as React.FC<KeyboardExtenderProps>;
|
|
77
|
+
/**
|
|
78
|
+
* A View that defines a group of `TextInput`s for toolbar navigation.
|
|
79
|
+
*/
|
|
80
|
+
export const RCTKeyboardToolbarGroupView =
|
|
81
|
+
View as unknown as React.FC<KeyboardToolbarGroupViewProps>;
|
package/src/compat.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useSharedValue } from "react-native-reanimated";
|
|
2
|
+
|
|
3
|
+
import { useKeyboardHandler } from "./hooks";
|
|
4
|
+
|
|
5
|
+
export const KeyboardState = {
|
|
6
|
+
UNKNOWN: 0,
|
|
7
|
+
OPENING: 1,
|
|
8
|
+
OPEN: 2,
|
|
9
|
+
CLOSING: 3,
|
|
10
|
+
CLOSED: 4,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Compatibility layer for migrating from Reanimated's useAnimatedKeyboard. */
|
|
14
|
+
export const useAnimatedKeyboard = () => {
|
|
15
|
+
const height = useSharedValue(0);
|
|
16
|
+
const state = useSharedValue(KeyboardState.UNKNOWN);
|
|
17
|
+
|
|
18
|
+
useKeyboardHandler(
|
|
19
|
+
{
|
|
20
|
+
onStart: (event) => {
|
|
21
|
+
"worklet";
|
|
22
|
+
state.value =
|
|
23
|
+
event.height > 0 ? KeyboardState.OPENING : KeyboardState.CLOSING;
|
|
24
|
+
},
|
|
25
|
+
onMove: (event) => {
|
|
26
|
+
"worklet";
|
|
27
|
+
height.value = event.height;
|
|
28
|
+
},
|
|
29
|
+
onInteractive: (event) => {
|
|
30
|
+
"worklet";
|
|
31
|
+
height.value = event.height;
|
|
32
|
+
},
|
|
33
|
+
onEnd: (event) => {
|
|
34
|
+
"worklet";
|
|
35
|
+
state.value =
|
|
36
|
+
event.height > 0 ? KeyboardState.OPEN : KeyboardState.CLOSED;
|
|
37
|
+
height.value = event.height;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
[],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return { height, state };
|
|
44
|
+
};
|
|
@@ -2,21 +2,28 @@ import { useSharedValue } from "react-native-reanimated";
|
|
|
2
2
|
|
|
3
3
|
import {useKeyboardHandler} from "../../hooks";
|
|
4
4
|
import {useKeyboardContext} from "../../context";
|
|
5
|
-
import {
|
|
5
|
+
import { useLayoutEffect } from "react";
|
|
6
6
|
import { Platform } from "react-native";
|
|
7
7
|
|
|
8
8
|
const OS = Platform.OS;
|
|
9
9
|
|
|
10
10
|
export const useKeyboardAnimation = () => {
|
|
11
11
|
const { reanimated } = useKeyboardContext();
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const heightWhenOpened = useSharedValue(0);
|
|
13
|
+
const height = useSharedValue(0);
|
|
14
|
+
const progress = useSharedValue(0);
|
|
15
|
+
const isClosed = useSharedValue(true);
|
|
16
|
+
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
const initialHeight = -reanimated.height.value;
|
|
19
|
+
const initialProgress = reanimated.progress.value;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
22
|
+
heightWhenOpened.value = initialHeight;
|
|
23
|
+
height.value = initialHeight;
|
|
24
|
+
progress.value = initialProgress;
|
|
25
|
+
isClosed.value = initialProgress === 0;
|
|
26
|
+
}, []);
|
|
20
27
|
|
|
21
28
|
useKeyboardHandler(
|
|
22
29
|
{
|
|
@@ -24,7 +31,6 @@ export const useKeyboardAnimation = () => {
|
|
|
24
31
|
"worklet";
|
|
25
32
|
|
|
26
33
|
if (e.height > 0) {
|
|
27
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
28
34
|
isClosed.value = false;
|
|
29
35
|
heightWhenOpened.value = e.height;
|
|
30
36
|
}
|
|
@@ -73,19 +79,20 @@ export const useKeyboardAnimation = () => {
|
|
|
73
79
|
export const useTranslateAnimation = () => {
|
|
74
80
|
const { reanimated } = useKeyboardContext();
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
const [initialProgress] = useState(() => reanimated.progress.value);
|
|
78
|
-
|
|
79
|
-
const padding = useSharedValue(initialProgress);
|
|
82
|
+
const padding = useSharedValue(0);
|
|
80
83
|
const translate = useSharedValue(0);
|
|
81
84
|
|
|
85
|
+
useLayoutEffect(() => {
|
|
86
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
87
|
+
padding.value = reanimated.progress.value;
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
82
90
|
useKeyboardHandler(
|
|
83
91
|
{
|
|
84
92
|
onStart: (e) => {
|
|
85
93
|
"worklet";
|
|
86
94
|
|
|
87
95
|
if (e.height === 0) {
|
|
88
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
89
96
|
padding.value = 0;
|
|
90
97
|
}
|
|
91
98
|
if (OS === "ios") {
|
|
@@ -95,7 +102,7 @@ export const useTranslateAnimation = () => {
|
|
|
95
102
|
onMove: (e) => {
|
|
96
103
|
"worklet";
|
|
97
104
|
|
|
98
|
-
if (OS
|
|
105
|
+
if (OS !== "ios") {
|
|
99
106
|
translate.value = e.progress;
|
|
100
107
|
}
|
|
101
108
|
},
|
|
@@ -111,7 +118,7 @@ export const useTranslateAnimation = () => {
|
|
|
111
118
|
|
|
112
119
|
padding.value = e.progress;
|
|
113
120
|
|
|
114
|
-
if (OS
|
|
121
|
+
if (OS !== "ios") {
|
|
115
122
|
translate.value = e.progress;
|
|
116
123
|
}
|
|
117
124
|
},
|