@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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* MIT License
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2026 Huawei Device Co., Ltd.
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#ifndef CLIPPINGSCROLLVIEWJSIBINDER_H
|
|
29
|
+
#define CLIPPINGSCROLLVIEWJSIBINDER_H
|
|
30
|
+
|
|
31
|
+
#pragma once
|
|
32
|
+
|
|
33
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
34
|
+
|
|
35
|
+
namespace rnoh {
|
|
36
|
+
|
|
37
|
+
class ClippingScrollViewJSIBinder : public ViewComponentJSIBinder {
|
|
38
|
+
protected:
|
|
39
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
40
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
41
|
+
object.setProperty(rt, "contentInsetBottom", "number");
|
|
42
|
+
object.setProperty(rt, "contentInsetTop", "number");
|
|
43
|
+
object.setProperty(rt, "applyWorkaroundForContentInsetHitTestBug", "bool");
|
|
44
|
+
return object;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
48
|
+
facebook::jsi::Object events(rt);
|
|
49
|
+
return events;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
53
|
+
facebook::jsi::Object events(rt);
|
|
54
|
+
return events;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace rnoh
|
|
59
|
+
|
|
60
|
+
#endif
|
package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp
CHANGED
|
@@ -158,6 +158,10 @@ void KeyboardControllerViewComponentInstance::onCommandReceived(std::string cons
|
|
|
158
158
|
CppComponentInstance::onCommandReceived(commandName, args);
|
|
159
159
|
if (commandName == "synchronizeFocusedInputLayout") {
|
|
160
160
|
syncUpLayout();
|
|
161
|
+
auto rnInstancePtr = this->m_deps->rnInstance.lock();
|
|
162
|
+
if (rnInstancePtr != nullptr) {
|
|
163
|
+
rnInstancePtr->postMessageToArkTS("layoutDidSynchronize", folly::dynamic::object());
|
|
164
|
+
}
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
|
|
@@ -498,7 +502,10 @@ void KeyboardControllerViewComponentInstance::focusDidSet() {
|
|
|
498
502
|
this->textInputVector.clear();
|
|
499
503
|
return;
|
|
500
504
|
}
|
|
501
|
-
|
|
505
|
+
auto groupAncestor = ViewHierarchyNavigator::findGroupAncestor(focused);
|
|
506
|
+
ComponentInstance::Shared scanRoot =
|
|
507
|
+
groupAncestor ? groupAncestor : this->shared_from_this();
|
|
508
|
+
this->textInputVector = ViewHierarchyNavigator::getAllInputFields(scanRoot);
|
|
502
509
|
int count = static_cast<int>(this->textInputVector.size());
|
|
503
510
|
int currentIndex = -1;
|
|
504
511
|
for (size_t i = 0; i < this->textInputVector.size(); ++i) {
|
|
@@ -86,7 +86,7 @@ void KeyboardGestureAreaComponentInstance::swipeToDismiss() {
|
|
|
86
86
|
if (rnInstancePtr != nullptr) {
|
|
87
87
|
auto turboModule = rnInstancePtr->getTurboModule("KeyboardController");
|
|
88
88
|
auto arkTsTurboModule = std::dynamic_pointer_cast<rnoh::ArkTSTurboModule>(turboModule);
|
|
89
|
-
arkTsTurboModule->callSync("dismiss", {false});
|
|
89
|
+
arkTsTurboModule->callSync("dismiss", {false, true});
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
void KeyboardGestureAreaComponentInstance::swipeToUp() {
|
|
@@ -105,4 +105,4 @@ void KeyboardGestureAreaComponentInstance::executeInterpolator() {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
} // namespace rnoh
|
|
108
|
-
// namespace rnoh
|
|
108
|
+
// namespace rnoh
|
package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentDescriptor.h
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#ifndef KEYBOARDTOOLBARGROUPVIEWCOMPONENTDESCRIPTOR_H
|
|
6
|
+
#define KEYBOARDTOOLBARGROUPVIEWCOMPONENTDESCRIPTOR_H
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
11
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
|
|
14
|
+
namespace facebook {
|
|
15
|
+
namespace react {
|
|
16
|
+
|
|
17
|
+
inline const char KeyboardToolbarGroupViewComponentName[] =
|
|
18
|
+
"KeyboardToolbarGroupView";
|
|
19
|
+
|
|
20
|
+
class KeyboardToolbarGroupViewProps : public ViewProps {
|
|
21
|
+
public:
|
|
22
|
+
KeyboardToolbarGroupViewProps() = default;
|
|
23
|
+
KeyboardToolbarGroupViewProps(
|
|
24
|
+
const PropsParserContext &context,
|
|
25
|
+
const KeyboardToolbarGroupViewProps &sourceProps,
|
|
26
|
+
const RawProps &rawProps)
|
|
27
|
+
: ViewProps(context, sourceProps, rawProps) {}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
using KeyboardToolbarGroupViewShadowNode = ConcreteViewShadowNode<
|
|
31
|
+
KeyboardToolbarGroupViewComponentName,
|
|
32
|
+
KeyboardToolbarGroupViewProps,
|
|
33
|
+
ViewEventEmitter>;
|
|
34
|
+
|
|
35
|
+
class KeyboardToolbarGroupViewComponentDescriptor final
|
|
36
|
+
: public ConcreteComponentDescriptor<KeyboardToolbarGroupViewShadowNode> {
|
|
37
|
+
public:
|
|
38
|
+
KeyboardToolbarGroupViewComponentDescriptor(
|
|
39
|
+
ComponentDescriptorParameters const ¶meters)
|
|
40
|
+
: ConcreteComponentDescriptor(parameters) {}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
} // namespace react
|
|
44
|
+
} // namespace facebook
|
|
45
|
+
|
|
46
|
+
#endif
|
package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.cpp
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include "KeyboardToolbarGroupViewComponentInstance.h"
|
|
6
|
+
|
|
7
|
+
namespace rnoh {
|
|
8
|
+
|
|
9
|
+
KeyboardToolbarGroupViewComponentInstance::KeyboardToolbarGroupViewComponentInstance(
|
|
10
|
+
Context context)
|
|
11
|
+
: CppComponentInstance(std::move(context)) {
|
|
12
|
+
m_stackNode.setHitTestMode(ARKUI_HIT_TEST_MODE_DEFAULT);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void KeyboardToolbarGroupViewComponentInstance::onChildInserted(
|
|
16
|
+
ComponentInstance::Shared const &childComponentInstance,
|
|
17
|
+
std::size_t index) {
|
|
18
|
+
CppComponentInstance::onChildInserted(childComponentInstance, index);
|
|
19
|
+
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void KeyboardToolbarGroupViewComponentInstance::onChildRemoved(
|
|
23
|
+
ComponentInstance::Shared const &childComponentInstance) {
|
|
24
|
+
CppComponentInstance::onChildRemoved(childComponentInstance);
|
|
25
|
+
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void KeyboardToolbarGroupViewComponentInstance::onPropsChanged(
|
|
29
|
+
SharedConcreteProps const &props) {
|
|
30
|
+
CppComponentInstance::onPropsChanged(props);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ArkUINode &KeyboardToolbarGroupViewComponentInstance::getLocalRootArkUINode() {
|
|
34
|
+
return m_stackNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#ifndef KEYBOARDTOOLBARGROUPVIEWCOMPONENTINSTANCE_H
|
|
6
|
+
#define KEYBOARDTOOLBARGROUPVIEWCOMPONENTINSTANCE_H
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "KeyboardToolbarGroupViewComponentDescriptor.h"
|
|
11
|
+
#include "RNOH/CppComponentInstance.h"
|
|
12
|
+
#include "RNOH/arkui/StackNode.h"
|
|
13
|
+
|
|
14
|
+
namespace rnoh {
|
|
15
|
+
|
|
16
|
+
class KeyboardToolbarGroupViewComponentInstance
|
|
17
|
+
: public CppComponentInstance<facebook::react::KeyboardToolbarGroupViewShadowNode> {
|
|
18
|
+
public:
|
|
19
|
+
explicit KeyboardToolbarGroupViewComponentInstance(Context context);
|
|
20
|
+
|
|
21
|
+
void onChildInserted(ComponentInstance::Shared const &childComponentInstance, std::size_t index) override;
|
|
22
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override;
|
|
23
|
+
void onPropsChanged(SharedConcreteProps const &props) override;
|
|
24
|
+
ArkUINode &getLocalRootArkUINode() override;
|
|
25
|
+
|
|
26
|
+
private:
|
|
27
|
+
StackNode m_stackNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
} // namespace rnoh
|
|
31
|
+
|
|
32
|
+
#endif
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#ifndef KEYBOARDTOOLBARGROUPVIEWJSIBINDER_H
|
|
6
|
+
#define KEYBOARDTOOLBARGROUPVIEWJSIBINDER_H
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
11
|
+
|
|
12
|
+
namespace rnoh {
|
|
13
|
+
|
|
14
|
+
class KeyboardToolbarGroupViewJSIBinder : public ViewComponentJSIBinder {
|
|
15
|
+
protected:
|
|
16
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
17
|
+
return ViewComponentJSIBinder::createNativeProps(rt);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace rnoh
|
|
22
|
+
|
|
23
|
+
#endif
|
|
@@ -28,6 +28,12 @@
|
|
|
28
28
|
|
|
29
29
|
#include "RNKeyboardController.h"
|
|
30
30
|
|
|
31
|
+
#include <ReactCommon/TurboModuleUtils.h>
|
|
32
|
+
#include <react/renderer/dom/DOM.h>
|
|
33
|
+
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
34
|
+
|
|
35
|
+
#include <utility>
|
|
36
|
+
|
|
31
37
|
namespace rnoh {
|
|
32
38
|
using namespace facebook;
|
|
33
39
|
KeyboardController::KeyboardController(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name)
|
|
@@ -36,11 +42,62 @@ KeyboardController::KeyboardController(const ArkTSTurboModule::Context ctx, cons
|
|
|
36
42
|
ARK_METHOD_METADATA(getConstants, 0),
|
|
37
43
|
ARK_METHOD_METADATA(setInputMode, 1),
|
|
38
44
|
ARK_METHOD_METADATA(setDefaultMode, 0),
|
|
39
|
-
ARK_METHOD_METADATA(
|
|
45
|
+
ARK_METHOD_METADATA(preload, 0),
|
|
46
|
+
ARK_METHOD_METADATA(dismiss, 2),
|
|
40
47
|
ARK_METHOD_METADATA(setFocusTo, 1),
|
|
41
48
|
ARK_METHOD_METADATA(addListener, 1),
|
|
42
49
|
ARK_METHOD_METADATA(removeListeners, 1),
|
|
43
50
|
};
|
|
51
|
+
|
|
52
|
+
methodMap_["viewPositionInWindow"] = MethodMetadata{
|
|
53
|
+
1,
|
|
54
|
+
[](jsi::Runtime& runtime,
|
|
55
|
+
react::TurboModule&,
|
|
56
|
+
const jsi::Value* args,
|
|
57
|
+
size_t count) -> jsi::Value {
|
|
58
|
+
if (count < 1 || !args[0].isNumber()) {
|
|
59
|
+
return react::createPromiseAsJSIValue(
|
|
60
|
+
runtime,
|
|
61
|
+
[](jsi::Runtime&, std::shared_ptr<react::Promise> promise) {
|
|
62
|
+
promise->reject("viewPositionInWindow requires a numeric view tag");
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const auto tag = static_cast<react::Tag>(args[0].asNumber());
|
|
67
|
+
return react::createPromiseAsJSIValue(
|
|
68
|
+
runtime,
|
|
69
|
+
[tag](jsi::Runtime& promiseRuntime, std::shared_ptr<react::Promise> promise) {
|
|
70
|
+
auto binding = react::UIManagerBinding::getBinding(promiseRuntime);
|
|
71
|
+
if (!binding) {
|
|
72
|
+
promise->reject("UIManagerBinding is unavailable");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
auto& uiManager = binding->getUIManager();
|
|
77
|
+
auto shadowNode = uiManager.findShadowNodeByTag_DEPRECATED(tag);
|
|
78
|
+
if (!shadowNode) {
|
|
79
|
+
promise->reject("Could not find ShadowNode for tag");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
auto revisionProvider = uiManager.getShadowTreeRevisionProvider();
|
|
84
|
+
auto currentRevision = revisionProvider == nullptr
|
|
85
|
+
? nullptr
|
|
86
|
+
: revisionProvider->getCurrentRevision(shadowNode->getSurfaceId());
|
|
87
|
+
if (!currentRevision) {
|
|
88
|
+
promise->reject("Could not find current ShadowTree revision");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const auto rect = react::dom::measureInWindow(currentRevision, *shadowNode);
|
|
93
|
+
jsi::Object result(promiseRuntime);
|
|
94
|
+
result.setProperty(promiseRuntime, "x", rect.x);
|
|
95
|
+
result.setProperty(promiseRuntime, "y", rect.y);
|
|
96
|
+
result.setProperty(promiseRuntime, "width", rect.width);
|
|
97
|
+
result.setProperty(promiseRuntime, "height", rect.height);
|
|
98
|
+
promise->resolve(jsi::Value(std::move(result)));
|
|
99
|
+
});
|
|
100
|
+
}};
|
|
44
101
|
}
|
|
45
102
|
|
|
46
103
|
} // namespace rnoh
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "keyboardControllerPackage.h"
|
|
11
|
+
|
|
12
|
+
namespace rnoh {
|
|
13
|
+
|
|
14
|
+
class RNKeyboardControllerPackage : public KeyboardControllerPackage {
|
|
15
|
+
public:
|
|
16
|
+
explicit RNKeyboardControllerPackage(Package::Context ctx)
|
|
17
|
+
: KeyboardControllerPackage(ctx) {}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace rnoh
|
|
@@ -26,25 +26,60 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
#include "ViewHierarchyNavigator.h"
|
|
29
|
-
#include <glog/logging.h>
|
|
30
|
-
#include <algorithm>
|
|
31
29
|
|
|
32
30
|
namespace rnoh {
|
|
31
|
+
|
|
32
|
+
namespace {
|
|
33
|
+
const char *kToolbarGroupName = "KeyboardToolbarGroupView";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
bool ViewHierarchyNavigator::isToolbarGroupComponent(
|
|
37
|
+
ComponentInstance::Shared component) {
|
|
38
|
+
return component && component->getComponentName() == kToolbarGroupName;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ComponentInstance::Shared ViewHierarchyNavigator::findGroupAncestor(
|
|
42
|
+
ComponentInstance::Shared component) {
|
|
43
|
+
if (!component) {
|
|
44
|
+
return nullptr;
|
|
45
|
+
}
|
|
46
|
+
auto parent = component->getParent().lock();
|
|
47
|
+
while (parent) {
|
|
48
|
+
if (isToolbarGroupComponent(parent)) {
|
|
49
|
+
return parent;
|
|
50
|
+
}
|
|
51
|
+
parent = parent->getParent().lock();
|
|
52
|
+
}
|
|
53
|
+
return nullptr;
|
|
54
|
+
}
|
|
55
|
+
|
|
33
56
|
TextInputComponentInstance::Shared ViewHierarchyNavigator::setFocusTo(
|
|
34
57
|
const std::string& direction, ComponentInstance::Shared currentFocus) {
|
|
35
58
|
if (!currentFocus) {
|
|
36
|
-
DLOG(INFO) << "ViewHierarchyNavigator::setFocusTo - currentFocus is null";
|
|
37
59
|
return nullptr;
|
|
38
60
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
return findTextInputInDirection(
|
|
62
|
+
currentFocus,
|
|
63
|
+
direction == "next" ? 1 : -1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void ViewHierarchyNavigator::collectInputFields(
|
|
67
|
+
ComponentInstance::Shared component,
|
|
68
|
+
std::vector<TextInputComponentInstance::Shared>& out,
|
|
69
|
+
bool skipGroups) {
|
|
70
|
+
if (!component) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (auto textInput = isValidTextInput(component)) {
|
|
74
|
+
out.push_back(textInput);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (skipGroups && isToolbarGroupComponent(component)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
for (const auto& child : component->getChildren()) {
|
|
81
|
+
collectInputFields(child, out, skipGroups);
|
|
46
82
|
}
|
|
47
|
-
return textInput;
|
|
48
83
|
}
|
|
49
84
|
|
|
50
85
|
std::vector<TextInputComponentInstance::Shared> ViewHierarchyNavigator::getAllInputFields(
|
|
@@ -53,35 +88,24 @@ std::vector<TextInputComponentInstance::Shared> ViewHierarchyNavigator::getAllIn
|
|
|
53
88
|
if (!rootComponent) {
|
|
54
89
|
return textInputs;
|
|
55
90
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
// 递归查找子组件
|
|
65
|
-
const auto& children = component->getChildren();
|
|
66
|
-
for (const auto& child : children) {
|
|
67
|
-
findTextInputs(child);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
findTextInputs(rootComponent);
|
|
91
|
+
if (isToolbarGroupComponent(rootComponent)) {
|
|
92
|
+
for (const auto& child : rootComponent->getChildren()) {
|
|
93
|
+
collectInputFields(child, textInputs, true);
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
collectInputFields(rootComponent, textInputs, true);
|
|
97
|
+
}
|
|
72
98
|
return textInputs;
|
|
73
99
|
}
|
|
74
100
|
|
|
75
101
|
TextInputComponentInstance::Shared ViewHierarchyNavigator::findTextInputInDirection(
|
|
76
|
-
ComponentInstance::Shared currentFocus,
|
|
102
|
+
ComponentInstance::Shared currentFocus, int direction) {
|
|
77
103
|
if (!currentFocus) {
|
|
78
104
|
return nullptr;
|
|
79
105
|
}
|
|
80
|
-
DLOG(INFO) << "jjtest currentFocus.name" << currentFocus->getComponentName();
|
|
81
106
|
// 获取父组件
|
|
82
107
|
auto parentComponent = currentFocus->getParent().lock();
|
|
83
108
|
if (!parentComponent) {
|
|
84
|
-
DLOG(INFO) << "jjtest ViewHierarchyNavigator - no parent found";
|
|
85
109
|
return nullptr;
|
|
86
110
|
}
|
|
87
111
|
// 获取父组件的所有子组件
|
|
@@ -94,14 +118,11 @@ TextInputComponentInstance::Shared ViewHierarchyNavigator::findTextInputInDirect
|
|
|
94
118
|
break;
|
|
95
119
|
}
|
|
96
120
|
}
|
|
97
|
-
if (currentIndex
|
|
98
|
-
DLOG(INFO) << "ViewHierarchyNavigator - current focus not found in parent's children";
|
|
121
|
+
if (currentIndex < 0) {
|
|
99
122
|
return nullptr;
|
|
100
123
|
}
|
|
101
|
-
DLOG(INFO) << "ViewHierarchyNavigator - currentIndex=" << currentIndex
|
|
102
|
-
<< " siblings.size()=" << siblings.size();
|
|
103
124
|
// 根据方向确定遍历范围
|
|
104
|
-
if (direction
|
|
125
|
+
if (direction > 0) {
|
|
105
126
|
// 向后遍历:从 currentIndex+1 到末尾
|
|
106
127
|
for (size_t i = currentIndex + 1; i < siblings.size(); ++i) {
|
|
107
128
|
auto result = findTextInputOrGoDeeper(siblings[i], direction);
|
|
@@ -118,18 +139,21 @@ TextInputComponentInstance::Shared ViewHierarchyNavigator::findTextInputInDirect
|
|
|
118
139
|
}
|
|
119
140
|
}
|
|
120
141
|
}
|
|
142
|
+
// Group 是导航边界,组内焦点不能跳转到组外输入框
|
|
143
|
+
if (isToolbarGroupComponent(parentComponent)) {
|
|
144
|
+
return nullptr;
|
|
145
|
+
}
|
|
121
146
|
// 如果同级没找到,递归到父级继续查找
|
|
122
|
-
DLOG(INFO) << "ViewHierarchyNavigator - searching in parent's parent";
|
|
123
147
|
return findTextInputInDirection(parentComponent, direction);
|
|
124
148
|
}
|
|
125
149
|
|
|
126
150
|
TextInputComponentInstance::Shared ViewHierarchyNavigator::findTextInputInHierarchy(
|
|
127
|
-
ComponentInstance::Shared component,
|
|
128
|
-
if (!component) {
|
|
151
|
+
ComponentInstance::Shared component, int direction) {
|
|
152
|
+
if (!component || isToolbarGroupComponent(component)) {
|
|
129
153
|
return nullptr;
|
|
130
154
|
}
|
|
131
155
|
const auto& children = component->getChildren();
|
|
132
|
-
if (direction
|
|
156
|
+
if (direction > 0) {
|
|
133
157
|
// 正序遍历
|
|
134
158
|
for (const auto& child : children) {
|
|
135
159
|
auto result = findTextInputOrGoDeeper(child, direction);
|
|
@@ -150,8 +174,8 @@ TextInputComponentInstance::Shared ViewHierarchyNavigator::findTextInputInHierar
|
|
|
150
174
|
}
|
|
151
175
|
|
|
152
176
|
TextInputComponentInstance::Shared ViewHierarchyNavigator::findTextInputOrGoDeeper(
|
|
153
|
-
ComponentInstance::Shared child,
|
|
154
|
-
if (!child) {
|
|
177
|
+
ComponentInstance::Shared child, int direction) {
|
|
178
|
+
if (!child || isToolbarGroupComponent(child)) {
|
|
155
179
|
return nullptr;
|
|
156
180
|
}
|
|
157
181
|
// 首先检查当前组件是否是有效输入框
|
|
@@ -175,9 +199,6 @@ TextInputComponentInstance::Shared ViewHierarchyNavigator::isValidTextInput(
|
|
|
175
199
|
// 尝试转换为 TextInputComponentInstance
|
|
176
200
|
auto textInput = std::dynamic_pointer_cast<TextInputComponentInstance>(component);
|
|
177
201
|
if (textInput) {
|
|
178
|
-
// TODO: 可以在这里添加 enabled 状态检查
|
|
179
|
-
// 类似于 iOS 的 textField.isEnabled 或 textView.isEditable
|
|
180
|
-
DLOG(INFO) << "ViewHierarchyNavigator - found valid TextInput: " << name;
|
|
181
202
|
return textInput;
|
|
182
203
|
}
|
|
183
204
|
}
|
|
@@ -64,7 +64,20 @@ public:
|
|
|
64
64
|
ComponentInstance::Shared rootComponent
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* 查找距离当前组件最近的 KeyboardToolbar.Group 祖先
|
|
69
|
+
* @param component 当前组件
|
|
70
|
+
* @return 最近的 Group 祖先,不在 Group 内时返回 nullptr
|
|
71
|
+
*/
|
|
72
|
+
static ComponentInstance::Shared findGroupAncestor(
|
|
73
|
+
ComponentInstance::Shared component
|
|
74
|
+
);
|
|
75
|
+
|
|
67
76
|
private:
|
|
77
|
+
static bool isToolbarGroupComponent(
|
|
78
|
+
ComponentInstance::Shared component
|
|
79
|
+
);
|
|
80
|
+
|
|
68
81
|
/**
|
|
69
82
|
* 根据方向查找输入框
|
|
70
83
|
* @param currentFocus 当前焦点组件
|
|
@@ -73,7 +86,7 @@ private:
|
|
|
73
86
|
*/
|
|
74
87
|
static TextInputComponentInstance::Shared findTextInputInDirection(
|
|
75
88
|
ComponentInstance::Shared currentFocus,
|
|
76
|
-
|
|
89
|
+
int direction
|
|
77
90
|
);
|
|
78
91
|
|
|
79
92
|
/**
|
|
@@ -84,7 +97,7 @@ private:
|
|
|
84
97
|
*/
|
|
85
98
|
static TextInputComponentInstance::Shared findTextInputInHierarchy(
|
|
86
99
|
ComponentInstance::Shared component,
|
|
87
|
-
|
|
100
|
+
int direction
|
|
88
101
|
);
|
|
89
102
|
|
|
90
103
|
/**
|
|
@@ -95,7 +108,7 @@ private:
|
|
|
95
108
|
*/
|
|
96
109
|
static TextInputComponentInstance::Shared findTextInputOrGoDeeper(
|
|
97
110
|
ComponentInstance::Shared child,
|
|
98
|
-
|
|
111
|
+
int direction
|
|
99
112
|
);
|
|
100
113
|
|
|
101
114
|
/**
|
|
@@ -106,6 +119,12 @@ private:
|
|
|
106
119
|
static TextInputComponentInstance::Shared isValidTextInput(
|
|
107
120
|
ComponentInstance::Shared component
|
|
108
121
|
);
|
|
122
|
+
|
|
123
|
+
static void collectInputFields(
|
|
124
|
+
ComponentInstance::Shared component,
|
|
125
|
+
std::vector<TextInputComponentInstance::Shared>& out,
|
|
126
|
+
bool skipGroups
|
|
127
|
+
);
|
|
109
128
|
};
|
|
110
129
|
|
|
111
130
|
} // namespace rnoh
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
#include "keyboardControllerPackage.h"
|
|
29
29
|
#include "KeyboardControllerViewJSIBinder.h"
|
|
30
30
|
#include "KeyboardGestureAreaJSIBinder.h"
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
#include "KeyboardToolbarGroupViewJSIBinder.h"
|
|
32
|
+
#include "ClippingScrollViewJSIBinder.h"
|
|
33
|
+
#include "glog/logging.h"
|
|
33
34
|
using namespace facebook;
|
|
34
35
|
using namespace rnoh;
|
|
35
36
|
|
|
@@ -38,11 +39,17 @@ KeyboardControllerPackage::createComponentDescriptorProviders() {
|
|
|
38
39
|
return {facebook::react::concreteComponentDescriptorProvider<
|
|
39
40
|
facebook::react::KeyboardControllerViewComponentDescriptor>(),
|
|
40
41
|
facebook::react::concreteComponentDescriptorProvider<
|
|
41
|
-
facebook::react::KeyboardGestureAreaComponentDescriptor>()
|
|
42
|
+
facebook::react::KeyboardGestureAreaComponentDescriptor>(),
|
|
43
|
+
facebook::react::concreteComponentDescriptorProvider<
|
|
44
|
+
facebook::react::KeyboardToolbarGroupViewComponentDescriptor>(),
|
|
45
|
+
facebook::react::concreteComponentDescriptorProvider<
|
|
46
|
+
facebook::react::ClippingScrollViewDecoratorViewComponentDescriptor>()};
|
|
42
47
|
}
|
|
43
48
|
ComponentJSIBinderByString KeyboardControllerPackage::createComponentJSIBinderByName() {
|
|
44
49
|
return {{"RNKeyboardControllerView", std::make_shared<KeyboardControllerViewJSIBinder>()},
|
|
45
|
-
{"RNKeyboardGestureArea", std::make_shared<KeyboardGestureAreaJSIBinder>()}
|
|
50
|
+
{"RNKeyboardGestureArea", std::make_shared<KeyboardGestureAreaJSIBinder>()},
|
|
51
|
+
{"KeyboardToolbarGroupView", std::make_shared<KeyboardToolbarGroupViewJSIBinder>()},
|
|
52
|
+
{"ClippingScrollViewDecoratorView", std::make_shared<ClippingScrollViewJSIBinder>()}};
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
std::unique_ptr<TurboModuleFactoryDelegate> KeyboardControllerPackage::createTurboModuleFactoryDelegate() {
|
|
@@ -60,5 +67,11 @@ ComponentInstance::Shared KeyboardControllerPackage::createComponentInstance(con
|
|
|
60
67
|
if (ctx.componentName == "RNKeyboardGestureArea") {
|
|
61
68
|
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
|
|
62
69
|
}
|
|
70
|
+
if (ctx.componentName == "KeyboardToolbarGroupView") {
|
|
71
|
+
return std::make_shared<KeyboardToolbarGroupViewComponentInstance>(ctx);
|
|
72
|
+
}
|
|
73
|
+
if (ctx.componentName == "ClippingScrollViewDecoratorView") {
|
|
74
|
+
return std::make_shared<ClippingScrollViewComponentInstance>(ctx);
|
|
75
|
+
}
|
|
63
76
|
return nullptr;
|
|
64
77
|
};
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
#define KEYBOARDCONTROLLERPACKAGE_H
|
|
33
33
|
|
|
34
34
|
#include "KeyboardGestureAreaComponentInstance.h"
|
|
35
|
+
#include "KeyboardToolbarGroupViewComponentInstance.h"
|
|
36
|
+
#include "ClippingScrollViewComponentInstance.h"
|
|
35
37
|
#include "RNOH/Package.h"
|
|
36
38
|
#include "RNKeyboardController.h"
|
|
37
39
|
#include "RNStatusBarManagerCompat.h"
|
|
@@ -43,9 +45,15 @@ namespace rnoh {
|
|
|
43
45
|
if (ctx.componentName == "RNKeyboardControllerView") {
|
|
44
46
|
return std::make_shared<KeyboardControllerViewComponentInstance>(ctx);
|
|
45
47
|
}
|
|
46
|
-
|
|
48
|
+
if (ctx.componentName == "RNKeyboardGestureArea") {
|
|
47
49
|
return std::make_shared<KeyboardGestureAreaComponentInstance>(ctx);
|
|
48
50
|
}
|
|
51
|
+
if (ctx.componentName == "KeyboardToolbarGroupView") {
|
|
52
|
+
return std::make_shared<KeyboardToolbarGroupViewComponentInstance>(ctx);
|
|
53
|
+
}
|
|
54
|
+
if (ctx.componentName == "ClippingScrollViewDecoratorView") {
|
|
55
|
+
return std::make_shared<ClippingScrollViewComponentInstance>(ctx);
|
|
56
|
+
}
|
|
49
57
|
return nullptr;
|
|
50
58
|
}
|
|
51
59
|
};
|