@react-native-ohos/react-native-keyboard-controller 1.17.0-beta.2 → 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/LICENSE +21 -21
- package/README.OpenSource +11 -11
- package/README.md +686 -19
- package/harmony/keyboard_controller/BuildProfile.ets +16 -16
- package/harmony/keyboard_controller/Index.ets +29 -28
- package/harmony/keyboard_controller/build-profile.json5 +31 -31
- package/harmony/keyboard_controller/hvigorfile.ts +6 -6
- package/harmony/keyboard_controller/obfuscation-rules.txt +17 -17
- package/harmony/keyboard_controller/oh-package-lock.json5 +28 -18
- package/harmony/keyboard_controller/oh-package.json5 +10 -10
- package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -7
- 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/EventEmitters.cpp +119 -96
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +111 -111
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +94 -94
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +840 -288
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +169 -103
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +65 -65
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +79 -79
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +108 -108
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +83 -83
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -60
- 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 +103 -46
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -48
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +20 -0
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -45
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -49
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +207 -186
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +131 -112
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +77 -64
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +85 -77
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +66 -66
- package/harmony/keyboard_controller/src/main/ets/{RNKeyboardControllerPackage.ts → RNKeyboardControllerPackage.ets} +70 -66
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +465 -273
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +128 -119
- package/harmony/keyboard_controller/src/main/ets/Type.ts +63 -62
- package/harmony/keyboard_controller/src/main/module.json5 +11 -11
- package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -8
- package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/keyboard_controller/{ts.ts → ts.ets} +29 -29
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +22 -11
- 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 +40 -5
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +28 -5
- 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 +39 -14
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +94 -57
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.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/KeyboardStickyView/index.js.map +1 -1
- 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/colors.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/colors.native.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 +98 -87
- 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.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/hooks/useWindowDimensions/index.android.js.map +1 -1
- package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -1
- package/lib/commonjs/index.js +27 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +54 -18
- 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/reanimated.js.map +1 -1
- package/lib/commonjs/reanimated.native.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/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/commonjs/specs/OverKeyboardViewNativeComponent.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/utils.js.map +1 -1
- package/lib/commonjs/views/KeyboardExtender/index.js +30 -0
- package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
- package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -1
- package/lib/commonjs/views/index.js +7 -0
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/animated.js +24 -13
- 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 +39 -5
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +27 -5
- 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 +38 -14
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +97 -60
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/utils.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/KeyboardStickyView/index.js.map +1 -1
- 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/colors.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/colors.native.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 +98 -88
- 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.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/hooks/useWindowDimensions/index.android.js.map +1 -1
- package/lib/module/hooks/useWindowDimensions/index.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +53 -18
- 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/reanimated.js.map +1 -1
- package/lib/module/reanimated.native.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/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/module/specs/OverKeyboardViewNativeComponent.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/utils.js.map +1 -1
- package/lib/module/views/KeyboardExtender/index.js +23 -0
- package/lib/module/views/KeyboardExtender/index.js.map +1 -0
- package/lib/module/views/OverKeyboardView/index.js.map +1 -1
- 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 +81 -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 +183 -174
- package/src/animated.tsx +248 -255
- package/src/architecture.ts +1 -0
- package/src/bindings.native.ts +97 -62
- package/src/bindings.ts +81 -42
- package/src/compat.ts +44 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +130 -123
- package/src/components/KeyboardAvoidingView/index.tsx +232 -188
- package/src/components/KeyboardAwareScrollView/index.tsx +452 -389
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -133
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -41
- 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/KeyboardStickyView/index.tsx +66 -66
- package/src/components/KeyboardToolbar/Arrow.tsx +80 -80
- package/src/components/KeyboardToolbar/Button.tsx +98 -98
- package/src/components/KeyboardToolbar/colors.native.ts +37 -37
- package/src/components/KeyboardToolbar/colors.ts +16 -16
- 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 +220 -223
- package/src/components/KeyboardToolbar/types.ts +72 -40
- package/src/components/ScrollViewWithBottomPadding/index.tsx +216 -0
- package/src/components/ScrollViewWithBottomPadding/styles.ts +10 -0
- package/src/components/hooks/useColorScheme.ts +6 -6
- package/src/components/hooks/useCombinedRef.ts +22 -0
- package/src/components/hooks/useScrollState.ts +81 -0
- package/src/components/index.ts +14 -11
- package/src/constants.ts +23 -19
- package/src/context.ts +70 -68
- package/src/hooks/index.ts +91 -90
- package/src/hooks/useKeyboardState/index.ts +52 -0
- package/src/hooks/useWindowDimensions/index.android.ts +38 -38
- package/src/hooks/useWindowDimensions/index.ts +1 -1
- package/src/index.ts +27 -23
- package/src/internal.ts +146 -84
- package/src/module.ts +64 -52
- package/src/reanimated.native.ts +132 -132
- package/src/reanimated.ts +29 -29
- package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +19 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +82 -71
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +21 -20
- package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
- package/src/specs/NativeKeyboardController.ts +23 -19
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -14
- package/src/specs/OverKeyboardViewNativeComponent.ts +12 -12
- package/src/types.ts +330 -243
- package/src/utils/findNodeHandle/index.native.ts +3 -0
- package/src/utils/findNodeHandle/index.ts +6 -0
- package/src/utils.ts +1 -1
- package/src/views/KeyboardExtender/index.tsx +30 -0
- package/src/views/OverKeyboardView/index.tsx +43 -43
- package/src/views/index.ts +2 -1
- 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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { AnimatedScrollViewComponent, ScrollViewContentInsets } from "../ScrollViewWithBottomPadding";
|
|
2
|
+
import type { KeyboardLiftBehavior } from "./useChatKeyboard/types";
|
|
3
|
+
import type { ScrollViewProps } from "react-native";
|
|
4
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
5
|
+
export type KeyboardChatScrollViewProps = {
|
|
6
|
+
/** Custom component for `ScrollView`. Default is `ScrollView`. */
|
|
7
|
+
ScrollViewComponent?: AnimatedScrollViewComponent;
|
|
8
|
+
/** Whether list are using `inverted` prop. Default is `false`. */
|
|
9
|
+
inverted?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The distance between the bottom of the screen and the `ScrollView`.
|
|
12
|
+
* When the keyboard appears, the `ScrollView` will only push content by the effective
|
|
13
|
+
* distance (`keyboardHeight - offset`) instead of the full keyboard height.
|
|
14
|
+
*
|
|
15
|
+
* Useful when the input is not at the very bottom of the screen (e.g., above safe area, above
|
|
16
|
+
* bottom tabs, etc. - in this case offset should be equal to the height of the elements between
|
|
17
|
+
* `ScrollView` and bottom of the screen).
|
|
18
|
+
*
|
|
19
|
+
* Default is `0`.
|
|
20
|
+
*/
|
|
21
|
+
offset?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Determines how the chat content should behave when the keyboard appears, specifically whether
|
|
24
|
+
* the scroll view should automatically lift its content to keep it visible above the keyboard.
|
|
25
|
+
*
|
|
26
|
+
* Possible values:
|
|
27
|
+
* - `'always'`: The content always lifts along with the keyboard, ensuring the messages from the bottom part of screen
|
|
28
|
+
* remain visible regardless of the current scroll position. This is the default behavior for most chat applications (used in Telegram).
|
|
29
|
+
* - `'whenAtEnd'`: The content lifts only if the scroll view is at the end (i.e., the last message
|
|
30
|
+
* is visible or near the bottom). This prevents unnecessary adjustments when the user is scrolling
|
|
31
|
+
* through older messages (ChatGPT mobile app behavior).
|
|
32
|
+
* - `'persistent'`: The content always lifts when the keyboard appears (similar to `'always'`), but
|
|
33
|
+
* does not reset (lower) when the keyboard hides. This mimics behaviors where the view remains adjusted
|
|
34
|
+
* after keyboard dismissal to maintain focus on the latest content without shifting back (Claude mobile app behavior).
|
|
35
|
+
* - `'never'`: The content does not lift at all when the keyboard appears. Use this for scenarios
|
|
36
|
+
* when you don't want to disturb user attention with animations (Perplexity mobile app behavior).
|
|
37
|
+
*
|
|
38
|
+
* Default is `'always'`.
|
|
39
|
+
*/
|
|
40
|
+
keyboardLiftBehavior?: KeyboardLiftBehavior;
|
|
41
|
+
/**
|
|
42
|
+
* When `true`, freezes all keyboard-driven layout changes (padding, content offset, scroll position).
|
|
43
|
+
* Useful when dismissing the keyboard to open a bottom sheet — prevents visual disruption
|
|
44
|
+
* while the sheet is visible.
|
|
45
|
+
*
|
|
46
|
+
* Default is `false`.
|
|
47
|
+
*/
|
|
48
|
+
freeze?: boolean | SharedValue<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* A shared value representing additional padding from external elements
|
|
51
|
+
* (e.g., a growing multiline `TextInput` in a `KeyboardStickyView`).
|
|
52
|
+
*
|
|
53
|
+
* When this value changes:
|
|
54
|
+
* - The scrollable range is always extended/contracted (via `contentInset`).
|
|
55
|
+
* - The scroll position is conditionally adjusted based on `keyboardLiftBehavior`.
|
|
56
|
+
*
|
|
57
|
+
* Default is `undefined` (no extra padding).
|
|
58
|
+
*/
|
|
59
|
+
extraContentPadding?: SharedValue<number>;
|
|
60
|
+
/**
|
|
61
|
+
* When `true`, applies a runtime workaround for a React Native 0.81+ bug
|
|
62
|
+
* where the ScrollView's `contentInset` area does not respond to touch/scroll
|
|
63
|
+
* gestures (facebook/react-native#54123).
|
|
64
|
+
*
|
|
65
|
+
* This uses Objective-C runtime method swizzling on the ScrollView's container
|
|
66
|
+
* view, which is inherently fragile. Only enable if you are affected by the
|
|
67
|
+
* upstream bug and understand the risks.
|
|
68
|
+
*
|
|
69
|
+
* iOS only. Default is `false`.
|
|
70
|
+
*/
|
|
71
|
+
applyWorkaroundForContentInsetHitTestBug?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* A shared value representing a minimum inset floor (in pixels).
|
|
74
|
+
*
|
|
75
|
+
* When set, the total bottom padding is computed as:
|
|
76
|
+
* `max(blankSpace, keyboardPadding + extraContentPadding)`
|
|
77
|
+
*
|
|
78
|
+
* This means the keyboard "absorbs" into the minimum padding rather than adding to it:
|
|
79
|
+
* - When `blankSpace >= keyboard + extraContentPadding`: content does NOT move on keyboard open/close.
|
|
80
|
+
* - When `blankSpace < keyboard + extraContentPadding`: content moves, but only by the excess amount.
|
|
81
|
+
*
|
|
82
|
+
* Useful in AI chat apps where a sent message needs space below it (to push it to the top
|
|
83
|
+
* of the viewport) while the AI response streams in, without that space causing extra movement
|
|
84
|
+
* when the keyboard opens.
|
|
85
|
+
*
|
|
86
|
+
* Default is `undefined` (equivalent to `0` — no minimum floor).
|
|
87
|
+
*/
|
|
88
|
+
blankSpace?: SharedValue<number>;
|
|
89
|
+
/**
|
|
90
|
+
* Fires whenever the effective content inset changes — the static `contentInset`
|
|
91
|
+
* prop combined with the dynamic keyboard-driven padding.
|
|
92
|
+
*
|
|
93
|
+
* Useful on Android, where the synthetic content inset is not reflected in the native
|
|
94
|
+
* `onScroll` event payload. Consumers such as virtualized lists computing their own
|
|
95
|
+
* `scrollToEnd` target can use this to track the current inset alongside scroll offsets.
|
|
96
|
+
*/
|
|
97
|
+
onContentInsetChange?: (insets: ScrollViewContentInsets) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Fires whenever the visibility of the content "end" changes — both when the user
|
|
100
|
+
* arrives at the end and when they leave it. The boolean parameter reflects the new state.
|
|
101
|
+
*
|
|
102
|
+
* For non-inverted lists, the "end" is the bottom of the content. For inverted lists
|
|
103
|
+
* (`inverted={true}`), the "end" is the top of the scroll view, where the latest messages
|
|
104
|
+
* are rendered. The same internal detection drives `keyboardLiftBehavior="whenAtEnd"`.
|
|
105
|
+
*
|
|
106
|
+
* The callback can be either a plain JS function or a Reanimated worklet — the type is
|
|
107
|
+
* detected automatically. Worklets run on the UI thread; plain functions are dispatched
|
|
108
|
+
* via `runOnJS`.
|
|
109
|
+
*
|
|
110
|
+
* Fires once on mount with the initial state (after the scroll view has been measured).
|
|
111
|
+
*/
|
|
112
|
+
onEndVisible?: (visible: boolean) => void;
|
|
113
|
+
} & ScrollViewProps;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { KeyboardLiftBehavior } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Map the current keyboard height to an effective height that accounts for a
|
|
4
|
+
* fixed offset (e.g. Bottom safe-area or tab-bar height)..
|
|
5
|
+
*
|
|
6
|
+
* @param height - Current keyboard height.
|
|
7
|
+
* @param targetKeyboardHeight - Full target keyboard height (captured on keyboard open).
|
|
8
|
+
* @param offset - Fixed distance between the scroll-view bottom and the screen bottom.
|
|
9
|
+
* @returns Effective height after subtracting the offset proportionally.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* getEffectiveHeight(300, 300, 50); // 250
|
|
13
|
+
* getEffectiveHeight(150, 300, 50); // 125
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const getEffectiveHeight: (height: number, targetKeyboardHeight: number, offset: number) => number;
|
|
17
|
+
/**
|
|
18
|
+
* Check whether the scroll view is at the end of its content.
|
|
19
|
+
*
|
|
20
|
+
* For non-inverted lists the "end" is the bottom of the content.
|
|
21
|
+
* For inverted lists the "end" is the top (scroll offset near 0),
|
|
22
|
+
* because that is where the latest messages are displayed.
|
|
23
|
+
*
|
|
24
|
+
* @param scrollOffset - Current vertical scroll offset.
|
|
25
|
+
* @param layoutHeight - Visible height of the scroll view.
|
|
26
|
+
* @param contentHeight - Total height of the scrollable content.
|
|
27
|
+
* @param inverted - Whether the list is inverted.
|
|
28
|
+
* @returns `true` if the scroll position is within the threshold of the content end.
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const atEnd = isScrollAtEnd(100, 800, 920); // true (100 + 800 >= 920 - 20)
|
|
32
|
+
* const atEndInverted = isScrollAtEnd(5, 800, 2000, true); // true (5 <= 20)
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const isScrollAtEnd: (scrollOffset: number, layoutHeight: number, contentHeight: number, inverted?: boolean) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Decide whether content should be shifted based on the keyboard lift behavior.
|
|
38
|
+
*
|
|
39
|
+
* @param behavior - The configured keyboard lift behavior.
|
|
40
|
+
* @param isAtEnd - Whether the scroll view is currently at the end.
|
|
41
|
+
* @returns `true` if content should be shifted.
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* shouldShiftContent("always", false); // true
|
|
45
|
+
* shouldShiftContent("whenAtEnd", false); // false
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const shouldShiftContent: (behavior: KeyboardLiftBehavior, isAtEnd: boolean) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Compute the fraction of minimum padding space currently visible in the viewport (0–1).
|
|
51
|
+
*
|
|
52
|
+
* The minimum padding space lives in the scroll view's contentInset, NOT in the
|
|
53
|
+
* content itself. So `contentHeight` (from onContentSizeChange / scroll
|
|
54
|
+
* events) does **not** include it. The visible portion is how far the
|
|
55
|
+
* viewport extends past the content boundary into the inset area.
|
|
56
|
+
*
|
|
57
|
+
* For non-inverted lists the padding is in contentInset.bottom.
|
|
58
|
+
* For inverted lists the padding is in contentInset.top (negative scroll).
|
|
59
|
+
*
|
|
60
|
+
* @param scrollOffset - Current vertical scroll offset.
|
|
61
|
+
* @param layoutHeight - Visible height of the scroll view.
|
|
62
|
+
* @param contentHeight - Height of the scroll content (excludes insets).
|
|
63
|
+
* @param blankSpace - Size of the minimum padding inset area.
|
|
64
|
+
* @param inverted - Whether the list is inverted.
|
|
65
|
+
* @returns A value between 0 (padding fully off-screen) and 1 (padding fully visible).
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* // Non-inverted: contentHeight=1500, layout=800, blankSpace=300
|
|
69
|
+
* getVisibleMinimumPaddingFraction(1500, 800, 1500, 300, false); // 1 (at end, viewport past content)
|
|
70
|
+
* getVisibleMinimumPaddingFraction(850, 800, 1500, 300, false); // 0.5 (half padding visible)
|
|
71
|
+
* getVisibleMinimumPaddingFraction(700, 800, 1500, 300, false); // 0 (padding off-screen)
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare const getVisibleMinimumPaddingFraction: (scrollOffset: number, layoutHeight: number, contentHeight: number, blankSpace: number, inverted: boolean) => number;
|
|
75
|
+
/**
|
|
76
|
+
* Compute how much of the minimum content padding absorbs the keyboard + extraContentPadding.
|
|
77
|
+
*
|
|
78
|
+
* @param blankSpace - Minimum inset floor.
|
|
79
|
+
* @param extraContentPadding - Extra content padding from external elements.
|
|
80
|
+
* @returns The portion of blankSpace that absorbs keyboard displacement.
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* getMinimumPaddingAbsorbed(500, 20); // 480
|
|
84
|
+
* getMinimumPaddingAbsorbed(0, 20); // 0
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const getMinimumPaddingAbsorbed: (blankSpace: number, extraContentPadding: number) => number;
|
|
88
|
+
/**
|
|
89
|
+
* Compute the effective scroll displacement after minimum padding absorption.
|
|
90
|
+
*
|
|
91
|
+
* @param rawEffective - Raw effective keyboard height.
|
|
92
|
+
* @param minimumPaddingAbsorbed - Amount absorbed by minimum content padding.
|
|
93
|
+
* @returns The scroll displacement after subtracting the absorbed portion.
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* getScrollEffective(300, 200); // 100
|
|
97
|
+
* getScrollEffective(300, 400); // 0
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare const getScrollEffective: (rawEffective: number, minimumPaddingAbsorbed: number) => number;
|
|
101
|
+
/**
|
|
102
|
+
* Compute the clamped scroll target for non-inverted lists.
|
|
103
|
+
*
|
|
104
|
+
* @param offsetBeforeScroll - Scroll position before keyboard appeared.
|
|
105
|
+
* @param keyboardHeight - Current keyboard height (used for scroll displacement).
|
|
106
|
+
* @param contentHeight - Total height of the scrollable content.
|
|
107
|
+
* @param layoutHeight - Visible height of the scroll view.
|
|
108
|
+
* @param totalPaddingForMaxScroll - Total padding to use for maxScroll calculation. When provided, used instead of keyboardHeight for the scrollable range. Defaults to keyboardHeight.
|
|
109
|
+
* @returns Clamped scroll target between 0 and maxScroll.
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* clampedScrollTarget(100, 300, 1000, 800); // 400
|
|
113
|
+
* clampedScrollTarget(100, 100, 1000, 800, 500); // 200, maxScroll uses 500
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare const clampedScrollTarget: (offsetBeforeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, totalPaddingForMaxScroll?: number) => number;
|
|
117
|
+
/**
|
|
118
|
+
* Compute contentOffset.y for iOS lists.
|
|
119
|
+
*
|
|
120
|
+
* @param relativeScroll - Scroll position relative to current inset.
|
|
121
|
+
* @param keyboardHeight - Target keyboard height (used for scroll displacement).
|
|
122
|
+
* @param contentHeight - Total height of the scrollable content.
|
|
123
|
+
* @param layoutHeight - Visible height of the scroll view.
|
|
124
|
+
* @param inverted - Whether the list is inverted.
|
|
125
|
+
* @param totalPaddingForMaxScroll - Total padding to use for maxScroll calculation. When provided, used instead of keyboardHeight for the scrollable range. Defaults to keyboardHeight.
|
|
126
|
+
* @returns The absolute contentOffset.y to set.
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* computeIOSContentOffset(100, 300, 1000, 800, false); // 400
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UseChatKeyboardOptions, UseChatKeyboardReturn } from "./types";
|
|
2
|
+
import type { AnimatedRef } from "react-native-reanimated";
|
|
3
|
+
import type Reanimated from "react-native-reanimated";
|
|
4
|
+
/**
|
|
5
|
+
* Hook that manages keyboard-driven scrolling for chat-style scroll views.
|
|
6
|
+
* Calculates padding (extra scrollable space) and content shift values,
|
|
7
|
+
* using per-frame scrollTo updates (Android and other platforms).
|
|
8
|
+
*
|
|
9
|
+
* @param scrollViewRef - Animated ref to the scroll view.
|
|
10
|
+
* @param options - Configuration for inverted and keyboardLiftBehavior.
|
|
11
|
+
* @returns Shared values for padding and contentOffsetY (always `undefined`).
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const { padding } = useChatKeyboard(ref, { inverted: false, keyboardLiftBehavior: "always" });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare function useChatKeyboard(scrollViewRef: AnimatedRef<Reanimated.ScrollView>, options: UseChatKeyboardOptions): UseChatKeyboardReturn;
|
|
18
|
+
export { useChatKeyboard };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { UseChatKeyboardOptions, UseChatKeyboardReturn } from "./types";
|
|
2
|
+
import type { AnimatedRef } from "react-native-reanimated";
|
|
3
|
+
import type Reanimated from "react-native-reanimated";
|
|
4
|
+
/**
|
|
5
|
+
* Hook that manages keyboard-driven scrolling for chat-style scroll views.
|
|
6
|
+
* Calculates padding (extra scrollable space) and content shift values,
|
|
7
|
+
* using iOS-specific strategy (contentOffset set once in onStart).
|
|
8
|
+
*
|
|
9
|
+
* @param scrollViewRef - Animated ref to the scroll view.
|
|
10
|
+
* @param options - Configuration for inverted and keyboardLiftBehavior.
|
|
11
|
+
* @returns Shared values for padding and contentOffsetY.
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const { padding, contentOffsetY } = useChatKeyboard(ref, {
|
|
15
|
+
* inverted: false,
|
|
16
|
+
* keyboardLiftBehavior: "always",
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare function useChatKeyboard(scrollViewRef: AnimatedRef<Reanimated.ScrollView>, options: UseChatKeyboardOptions): UseChatKeyboardReturn;
|
|
21
|
+
export { useChatKeyboard };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LayoutChangeEvent } from "react-native";
|
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
3
|
+
type KeyboardLiftBehavior = "always" | "whenAtEnd" | "persistent" | "never";
|
|
4
|
+
type UseChatKeyboardOptions = {
|
|
5
|
+
inverted: boolean;
|
|
6
|
+
keyboardLiftBehavior: KeyboardLiftBehavior;
|
|
7
|
+
freeze: SharedValue<boolean>;
|
|
8
|
+
offset: number;
|
|
9
|
+
blankSpace: SharedValue<number>;
|
|
10
|
+
/** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
|
|
11
|
+
extraContentPadding: SharedValue<number>;
|
|
12
|
+
};
|
|
13
|
+
type UseChatKeyboardReturn = {
|
|
14
|
+
/** Extra scrollable space (= keyboard height). Used as contentInset on iOS, contentInsetBottom/contentInsetTop on Android. */
|
|
15
|
+
padding: SharedValue<number>;
|
|
16
|
+
/** Raw keyboard height updated every frame in onMove. Used to force Reanimated commits on Fabric. */
|
|
17
|
+
currentHeight: SharedValue<number>;
|
|
18
|
+
/** Absolute Y content offset for iOS (set once in onStart). `undefined` on Android. */
|
|
19
|
+
contentOffsetY: SharedValue<number> | undefined;
|
|
20
|
+
/** Current vertical scroll offset. */
|
|
21
|
+
scroll: SharedValue<number>;
|
|
22
|
+
/** Visible viewport dimensions. */
|
|
23
|
+
layout: SharedValue<{
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}>;
|
|
27
|
+
/** Total content dimensions. */
|
|
28
|
+
size: SharedValue<{
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}>;
|
|
32
|
+
/** Callback to attach to ScrollView's onLayout prop to capture initial viewport dimensions. */
|
|
33
|
+
onLayout: (e: LayoutChangeEvent) => void;
|
|
34
|
+
/** Callback to attach to ScrollView's onContentSizeChange prop to capture initial content dimensions. */
|
|
35
|
+
onContentSizeChange: (w: number, h: number) => void;
|
|
36
|
+
};
|
|
37
|
+
export type { KeyboardLiftBehavior, UseChatKeyboardOptions, UseChatKeyboardReturn, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
type EndVisibleCallback = (visible: boolean) => void;
|
|
3
|
+
type Options = {
|
|
4
|
+
scroll: SharedValue<number>;
|
|
5
|
+
layout: SharedValue<{
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}>;
|
|
9
|
+
size: SharedValue<{
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}>;
|
|
13
|
+
inverted: boolean;
|
|
14
|
+
onEndVisible?: EndVisibleCallback;
|
|
15
|
+
};
|
|
16
|
+
export declare const useEndVisible: ({ scroll, layout, size, inverted, onEndVisible, }: Options) => void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { KeyboardLiftBehavior } from "../useChatKeyboard/types";
|
|
2
|
+
import type { AnimatedRef, SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type Reanimated from "react-native-reanimated";
|
|
4
|
+
type UseExtraContentPaddingOptions = {
|
|
5
|
+
scrollViewRef: AnimatedRef<Reanimated.ScrollView>;
|
|
6
|
+
extraContentPadding: SharedValue<number>;
|
|
7
|
+
/** Keyboard-only padding from useChatKeyboard — used to compute total padding for clamping. */
|
|
8
|
+
keyboardPadding: SharedValue<number>;
|
|
9
|
+
/** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */
|
|
10
|
+
blankSpace: SharedValue<number>;
|
|
11
|
+
/** Current vertical scroll offset. */
|
|
12
|
+
scroll: SharedValue<number>;
|
|
13
|
+
/** Visible viewport dimensions. */
|
|
14
|
+
layout: SharedValue<{
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}>;
|
|
18
|
+
/** Total content dimensions. */
|
|
19
|
+
size: SharedValue<{
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}>;
|
|
23
|
+
/** IOS only — when provided, sets contentOffset atomically with contentInset. */
|
|
24
|
+
contentOffsetY?: SharedValue<number>;
|
|
25
|
+
inverted: boolean;
|
|
26
|
+
keyboardLiftBehavior: KeyboardLiftBehavior;
|
|
27
|
+
freeze: SharedValue<boolean>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Hook that reacts to `extraContentPadding` changes and conditionally
|
|
31
|
+
* adjusts the scroll position using `scrollTo` on both iOS and Android.
|
|
32
|
+
*
|
|
33
|
+
* Padding extension (scrollable range) is handled externally via a
|
|
34
|
+
* `useDerivedValue` that sums keyboard padding + extra content padding.
|
|
35
|
+
* This hook only handles the scroll correction.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Configuration and shared values.
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* useExtraContentPadding({ scrollViewRef, extraContentPadding, ... });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare function useExtraContentPadding(options: UseExtraContentPaddingOptions): void;
|
|
44
|
+
export { useExtraContentPadding };
|
|
45
|
+
export type { UseExtraContentPaddingOptions };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { KeyboardToolbarTheme } from "./types";
|
|
3
3
|
import type { PropsWithChildren } from "react";
|
|
4
|
-
import type { ViewStyle } from "react-native";
|
|
4
|
+
import type { GestureResponderEvent, ViewStyle } from "react-native";
|
|
5
5
|
type ButtonProps = {
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
onPress: () => void;
|
|
7
|
+
onPress: (event: GestureResponderEvent) => void;
|
|
8
8
|
accessibilityLabel: string;
|
|
9
9
|
accessibilityHint: string;
|
|
10
10
|
testID: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type Arrow from "../../Arrow";
|
|
2
|
+
import type Button from "../../Button";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import type { GestureResponderEvent, ViewStyle } from "react-native";
|
|
5
|
+
export type ButtonSubProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
testID?: string;
|
|
10
|
+
rippleRadius?: number;
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
button?: typeof Button;
|
|
13
|
+
icon?: typeof Arrow;
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KeyboardToolbarTheme } from "../types";
|
|
2
|
+
type ToolbarContextType = {
|
|
3
|
+
theme: KeyboardToolbarTheme;
|
|
4
|
+
isPrevDisabled: boolean;
|
|
5
|
+
isNextDisabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const ToolbarContext: import("react").Context<ToolbarContextType | undefined>;
|
|
8
|
+
export declare const useToolbarContext: () => ToolbarContextType;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HEX } from "./types";
|
|
2
|
+
export declare const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
|
|
3
|
+
export declare const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = "keyboard.toolbar.previous";
|
|
4
|
+
export declare const TEST_ID_KEYBOARD_TOOLBAR_NEXT = "keyboard.toolbar.next";
|
|
5
|
+
export declare const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = "keyboard.toolbar.content";
|
|
6
|
+
export declare const TEST_ID_KEYBOARD_TOOLBAR_DONE = "keyboard.toolbar.done";
|
|
7
|
+
export declare const KEYBOARD_TOOLBAR_HEIGHT = 42;
|
|
8
|
+
export declare const DEFAULT_OPACITY: HEX;
|
|
9
|
+
export declare const KEYBOARD_HAS_ROUNDED_CORNERS: boolean;
|
|
10
|
+
export declare const OPENED_OFFSET: number;
|
|
@@ -1,52 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import Button from "./Button";
|
|
2
|
+
import { RCTKeyboardToolbarGroupView } from "../../bindings";
|
|
4
3
|
import { colors } from "./colors";
|
|
5
|
-
import
|
|
6
|
-
import type {
|
|
7
|
-
import type { ReactNode } from "react";
|
|
8
|
-
import type { ViewProps } from "react-native";
|
|
9
|
-
export type KeyboardToolbarProps = Omit<ViewProps, "style" | "testID" | "children"> & {
|
|
10
|
-
/** An element that is shown in the middle of the toolbar. */
|
|
11
|
-
content?: JSX.Element | null;
|
|
12
|
-
/** A set of dark/light colors consumed by toolbar component. */
|
|
13
|
-
theme?: KeyboardToolbarTheme;
|
|
14
|
-
/** Custom text for done button. */
|
|
15
|
-
doneText?: ReactNode;
|
|
16
|
-
/** Custom touchable component for toolbar (used for prev/next/done buttons). */
|
|
17
|
-
button?: typeof Button;
|
|
18
|
-
/** Custom icon component used to display next/prev buttons. */
|
|
19
|
-
icon?: typeof Arrow;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input
|
|
22
|
-
* and want to show only `Done` button. Default to `true`.
|
|
23
|
-
*/
|
|
24
|
-
showArrows?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* A callback that is called when the user presses the next button along with the default action.
|
|
27
|
-
*/
|
|
28
|
-
onNextCallback?: () => void;
|
|
29
|
-
/**
|
|
30
|
-
* A callback that is called when the user presses the previous button along with the default action.
|
|
31
|
-
*/
|
|
32
|
-
onPrevCallback?: () => void;
|
|
33
|
-
/**
|
|
34
|
-
* A callback that is called when the user presses the done button along with the default action.
|
|
35
|
-
*/
|
|
36
|
-
onDoneCallback?: () => void;
|
|
37
|
-
/**
|
|
38
|
-
* A component that applies blur effect to the toolbar.
|
|
39
|
-
*/
|
|
40
|
-
blur?: JSX.Element | null;
|
|
41
|
-
/**
|
|
42
|
-
* A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.
|
|
43
|
-
*/
|
|
44
|
-
opacity?: HEX;
|
|
45
|
-
} & Pick<KeyboardStickyViewProps, "offset" | "enabled">;
|
|
4
|
+
import { Background, Content, Done, Next, Prev } from "./compound/components";
|
|
5
|
+
import type { KeyboardToolbarProps } from "./types";
|
|
46
6
|
/**
|
|
47
7
|
* `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
|
|
48
8
|
* `Done` buttons.
|
|
49
9
|
*/
|
|
50
|
-
declare const KeyboardToolbar: React.FC<KeyboardToolbarProps
|
|
51
|
-
|
|
10
|
+
declare const KeyboardToolbar: React.FC<KeyboardToolbarProps> & {
|
|
11
|
+
Background: typeof Background;
|
|
12
|
+
Content: typeof Content;
|
|
13
|
+
Prev: typeof Prev;
|
|
14
|
+
Next: typeof Next;
|
|
15
|
+
Done: typeof Done;
|
|
16
|
+
Group: typeof RCTKeyboardToolbarGroupView;
|
|
17
|
+
};
|
|
18
|
+
export { colors as DefaultKeyboardToolbarTheme, KeyboardToolbarProps };
|
|
52
19
|
export default KeyboardToolbar;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type Arrow from "./Arrow";
|
|
2
|
+
import type Button from "./Button";
|
|
3
|
+
import type { KeyboardStickyViewProps } from "../KeyboardStickyView";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
5
|
+
import type { ColorValue, GestureResponderEvent, ViewProps } from "react-native";
|
|
2
6
|
type Theme = {
|
|
3
7
|
/** Color for arrow when it's enabled */
|
|
4
8
|
primary: ColorValue;
|
|
@@ -15,4 +19,23 @@ export type KeyboardToolbarTheme = {
|
|
|
15
19
|
};
|
|
16
20
|
type HexSymbol = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f";
|
|
17
21
|
export type HEX = `${HexSymbol}${HexSymbol}`;
|
|
22
|
+
type SafeAreaInsets = {
|
|
23
|
+
left: number;
|
|
24
|
+
right: number;
|
|
25
|
+
};
|
|
26
|
+
export type KeyboardToolbarProps = Omit<ViewProps, "style" | "testID" | "children"> & {
|
|
27
|
+
content?: React.JSX.Element | null;
|
|
28
|
+
theme?: KeyboardToolbarTheme;
|
|
29
|
+
doneText?: ReactNode;
|
|
30
|
+
button?: typeof Button;
|
|
31
|
+
icon?: typeof Arrow;
|
|
32
|
+
showArrows?: boolean;
|
|
33
|
+
onNextCallback?: (event: GestureResponderEvent) => void;
|
|
34
|
+
onPrevCallback?: (event: GestureResponderEvent) => void;
|
|
35
|
+
onDoneCallback?: (event: GestureResponderEvent) => void;
|
|
36
|
+
blur?: React.JSX.Element | null;
|
|
37
|
+
opacity?: HEX;
|
|
38
|
+
insets?: SafeAreaInsets;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
} & Pick<KeyboardStickyViewProps, "offset" | "enabled">;
|
|
18
41
|
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Reanimated from "react-native-reanimated";
|
|
3
|
+
import type { ScrollViewProps } from "react-native";
|
|
4
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
5
|
+
type AnimatedScrollViewProps = React.ComponentProps<typeof Reanimated.ScrollView>;
|
|
6
|
+
export type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>>;
|
|
7
|
+
export type ScrollViewContentInsets = {
|
|
8
|
+
top: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
left: number;
|
|
11
|
+
right: number;
|
|
12
|
+
};
|
|
13
|
+
declare const ScrollViewWithBottomPadding: React.ForwardRefExoticComponent<{
|
|
14
|
+
ScrollViewComponent: AnimatedScrollViewComponent;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
inverted?: boolean;
|
|
17
|
+
bottomPadding: SharedValue<number>;
|
|
18
|
+
/** Padding for scroll indicator insets (excludes blankSpace). Falls back to bottomPadding when not provided. */
|
|
19
|
+
scrollIndicatorPadding?: SharedValue<number>;
|
|
20
|
+
/** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */
|
|
21
|
+
contentOffsetY?: SharedValue<number>;
|
|
22
|
+
applyWorkaroundForContentInsetHitTestBug?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Fires whenever the effective content inset changes (combines the static `contentInset`
|
|
25
|
+
* prop with the dynamic keyboard-driven padding). Useful on Android where the synthetic
|
|
26
|
+
* inset is not reflected in `onScroll` events.
|
|
27
|
+
*/
|
|
28
|
+
onContentInsetChange?: (insets: ScrollViewContentInsets) => void;
|
|
29
|
+
} & ScrollViewProps & React.RefAttributes<Reanimated.ScrollView>>;
|
|
30
|
+
export default ScrollViewWithBottomPadding;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LayoutChangeEvent } from "react-native";
|
|
2
|
+
import type { AnimatedRef } from "react-native-reanimated";
|
|
3
|
+
import type Reanimated from "react-native-reanimated";
|
|
4
|
+
declare const useScrollState: (ref: AnimatedRef<Reanimated.ScrollView>) => {
|
|
5
|
+
offset: import("react-native-reanimated").SharedValue<number>;
|
|
6
|
+
layout: import("react-native-reanimated").SharedValue<{
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}>;
|
|
10
|
+
size: import("react-native-reanimated").SharedValue<{
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}>;
|
|
14
|
+
onLayout: (e: LayoutChangeEvent) => void;
|
|
15
|
+
onContentSizeChange: (w: number, h: number) => void;
|
|
16
|
+
};
|
|
17
|
+
export default useScrollState;
|