@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,112 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { forwardRef, useState } from "react";
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
import Reanimated, { runOnJS, useAnimatedProps, useAnimatedReaction, useDerivedValue, useSharedValue } from "react-native-reanimated";
|
|
5
|
+
import { ClippingScrollView } from "../../bindings";
|
|
6
|
+
import styles from "./styles";
|
|
7
|
+
const OS = Platform.OS;
|
|
8
|
+
const ReanimatedClippingScrollView = OS === "android" || OS === "harmony" ? Reanimated.createAnimatedComponent(ClippingScrollView) : ClippingScrollView;
|
|
9
|
+
const ScrollViewWithBottomPadding = /*#__PURE__*/forwardRef(({
|
|
10
|
+
ScrollViewComponent,
|
|
11
|
+
bottomPadding,
|
|
12
|
+
scrollIndicatorPadding,
|
|
13
|
+
contentInset,
|
|
14
|
+
scrollIndicatorInsets,
|
|
15
|
+
inverted,
|
|
16
|
+
contentOffsetY,
|
|
17
|
+
applyWorkaroundForContentInsetHitTestBug,
|
|
18
|
+
onContentInsetChange,
|
|
19
|
+
contentContainerStyle,
|
|
20
|
+
children,
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const prevContentOffsetY = useSharedValue(null);
|
|
24
|
+
|
|
25
|
+
// HarmonyOS workaround: ArkUI ScrollView's scrollable range only follows
|
|
26
|
+
// contentSize (contentInset prop is dropped, padding/scrollToOverflowEnabled
|
|
27
|
+
// don't extend it). So we mirror the keyboard-driven bottomPadding into the
|
|
28
|
+
// inner ScrollView's contentContainerStyle.paddingBottom to actually expand
|
|
29
|
+
// contentSize, letting the worklet's scrollTo reach the keyboard area.
|
|
30
|
+
const isHarmony = OS === "harmony";
|
|
31
|
+
const [harmonyKbPad, setHarmonyKbPad] = useState(0);
|
|
32
|
+
useAnimatedReaction(() => isHarmony ? bottomPadding.value : 0, (cur, prev) => {
|
|
33
|
+
if (isHarmony && cur !== prev) {
|
|
34
|
+
runOnJS(setHarmonyKbPad)(Math.round(cur));
|
|
35
|
+
}
|
|
36
|
+
}, [isHarmony]);
|
|
37
|
+
const insets = useDerivedValue(() => {
|
|
38
|
+
const dynamicTop = inverted ? bottomPadding.value : 0;
|
|
39
|
+
const dynamicBottom = !inverted ? bottomPadding.value : 0;
|
|
40
|
+
return {
|
|
41
|
+
dynamic: {
|
|
42
|
+
top: dynamicTop,
|
|
43
|
+
bottom: dynamicBottom
|
|
44
|
+
},
|
|
45
|
+
effective: {
|
|
46
|
+
top: dynamicTop + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.top) || 0),
|
|
47
|
+
bottom: dynamicBottom + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom) || 0),
|
|
48
|
+
left: (contentInset === null || contentInset === void 0 ? void 0 : contentInset.left) || 0,
|
|
49
|
+
right: (contentInset === null || contentInset === void 0 ? void 0 : contentInset.right) || 0
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, [inverted, contentInset === null || contentInset === void 0 ? void 0 : contentInset.top, contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom, contentInset === null || contentInset === void 0 ? void 0 : contentInset.left, contentInset === null || contentInset === void 0 ? void 0 : contentInset.right]);
|
|
53
|
+
useAnimatedReaction(() => insets.value.effective, (current, previous) => {
|
|
54
|
+
if (!onContentInsetChange) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (previous && current.top === previous.top && current.bottom === previous.bottom && current.left === previous.left && current.right === previous.right) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
runOnJS(onContentInsetChange)(current);
|
|
61
|
+
}, [onContentInsetChange]);
|
|
62
|
+
const animatedProps = useAnimatedProps(() => {
|
|
63
|
+
const {
|
|
64
|
+
dynamic,
|
|
65
|
+
effective
|
|
66
|
+
} = insets.value;
|
|
67
|
+
const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;
|
|
68
|
+
const indicatorTop = (inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top) || 0);
|
|
69
|
+
const indicatorBottom = (!inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom) || 0);
|
|
70
|
+
const result = {
|
|
71
|
+
// iOS prop
|
|
72
|
+
contentInset: effective,
|
|
73
|
+
scrollIndicatorInsets: {
|
|
74
|
+
bottom: indicatorBottom,
|
|
75
|
+
top: indicatorTop,
|
|
76
|
+
right: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right,
|
|
77
|
+
left: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left
|
|
78
|
+
},
|
|
79
|
+
// Android prop
|
|
80
|
+
contentInsetBottom: dynamic.bottom,
|
|
81
|
+
contentInsetTop: dynamic.top
|
|
82
|
+
};
|
|
83
|
+
if (contentOffsetY) {
|
|
84
|
+
const curr = contentOffsetY.value;
|
|
85
|
+
if (curr !== prevContentOffsetY.value) {
|
|
86
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
87
|
+
prevContentOffsetY.value = curr;
|
|
88
|
+
result.contentOffset = {
|
|
89
|
+
x: 0,
|
|
90
|
+
y: curr
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}, [scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left, inverted, contentOffsetY]);
|
|
96
|
+
return /*#__PURE__*/React.createElement(ReanimatedClippingScrollView, {
|
|
97
|
+
animatedProps: animatedProps,
|
|
98
|
+
applyWorkaroundForContentInsetHitTestBug: applyWorkaroundForContentInsetHitTestBug,
|
|
99
|
+
style: styles.container
|
|
100
|
+
}, /*#__PURE__*/React.createElement(ScrollViewComponent, _extends({
|
|
101
|
+
ref: ref,
|
|
102
|
+
animatedProps: animatedProps
|
|
103
|
+
}, rest, {
|
|
104
|
+
contentContainerStyle: isHarmony ? [contentContainerStyle, inverted ? {
|
|
105
|
+
paddingTop: harmonyKbPad
|
|
106
|
+
} : {
|
|
107
|
+
paddingBottom: harmonyKbPad
|
|
108
|
+
}] : contentContainerStyle
|
|
109
|
+
}), children));
|
|
110
|
+
});
|
|
111
|
+
export default ScrollViewWithBottomPadding;
|
|
112
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useState","Platform","Reanimated","runOnJS","useAnimatedProps","useAnimatedReaction","useDerivedValue","useSharedValue","ClippingScrollView","styles","OS","ReanimatedClippingScrollView","createAnimatedComponent","ScrollViewWithBottomPadding","ScrollViewComponent","bottomPadding","scrollIndicatorPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","applyWorkaroundForContentInsetHitTestBug","onContentInsetChange","contentContainerStyle","children","rest","ref","prevContentOffsetY","isHarmony","harmonyKbPad","setHarmonyKbPad","value","cur","prev","Math","round","insets","dynamicTop","dynamicBottom","dynamic","top","bottom","effective","left","right","current","previous","animatedProps","indicatorPadding","indicatorTop","indicatorBottom","result","contentInsetBottom","contentInsetTop","curr","contentOffset","x","y","createElement","style","container","_extends","paddingTop","paddingBottom"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useState } from \"react\";\nimport { Platform } from \"react-native\";\nimport Reanimated, {\n runOnJS,\n useAnimatedProps,\n useAnimatedReaction,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\" || (OS as string) === \"harmony\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\nexport type ScrollViewContentInsets = {\n top: number;\n bottom: number;\n left: number;\n right: number;\n};\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Padding for scroll indicator insets (excludes blankSpace). Falls back to bottomPadding when not provided. */\n scrollIndicatorPadding?: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */\n contentOffsetY?: SharedValue<number>;\n applyWorkaroundForContentInsetHitTestBug?: boolean;\n /**\n * Fires whenever the effective content inset changes (combines the static `contentInset`\n * prop with the dynamic keyboard-driven padding). Useful on Android where the synthetic\n * inset is not reflected in `onScroll` events.\n */\n onContentInsetChange?: (insets: ScrollViewContentInsets) => void;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n scrollIndicatorPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n applyWorkaroundForContentInsetHitTestBug,\n onContentInsetChange,\n contentContainerStyle,\n children,\n ...rest\n },\n ref,\n ) => {\n const prevContentOffsetY = useSharedValue<number | null>(null);\n\n // HarmonyOS workaround: ArkUI ScrollView's scrollable range only follows\n // contentSize (contentInset prop is dropped, padding/scrollToOverflowEnabled\n // don't extend it). So we mirror the keyboard-driven bottomPadding into the\n // inner ScrollView's contentContainerStyle.paddingBottom to actually expand\n // contentSize, letting the worklet's scrollTo reach the keyboard area.\n const isHarmony = (OS as string) === \"harmony\";\n const [harmonyKbPad, setHarmonyKbPad] = useState(0);\n useAnimatedReaction(\n () => (isHarmony ? bottomPadding.value : 0),\n (cur, prev) => {\n if (isHarmony && cur !== prev) {\n runOnJS(setHarmonyKbPad)(Math.round(cur));\n }\n },\n [isHarmony],\n );\n\n const insets = useDerivedValue(() => {\n const dynamicTop = inverted ? bottomPadding.value : 0;\n const dynamicBottom = !inverted ? bottomPadding.value : 0;\n\n return {\n dynamic: {\n top: dynamicTop,\n bottom: dynamicBottom,\n },\n effective: {\n top: dynamicTop + (contentInset?.top || 0),\n bottom: dynamicBottom + (contentInset?.bottom || 0),\n left: contentInset?.left || 0,\n right: contentInset?.right || 0,\n } as ScrollViewContentInsets,\n };\n }, [\n inverted,\n contentInset?.top,\n contentInset?.bottom,\n contentInset?.left,\n contentInset?.right,\n ]);\n\n useAnimatedReaction(\n () => insets.value.effective,\n (current, previous) => {\n if (!onContentInsetChange) {\n return;\n }\n if (\n previous &&\n current.top === previous.top &&\n current.bottom === previous.bottom &&\n current.left === previous.left &&\n current.right === previous.right\n ) {\n return;\n }\n runOnJS(onContentInsetChange)(current);\n },\n [onContentInsetChange],\n );\n\n const animatedProps = useAnimatedProps(() => {\n const { dynamic, effective } = insets.value;\n\n const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;\n const indicatorTop =\n (inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.top || 0);\n const indicatorBottom =\n (!inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.bottom || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: effective,\n scrollIndicatorInsets: {\n bottom: indicatorBottom,\n top: indicatorTop,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: dynamic.bottom,\n contentInsetTop: dynamic.top,\n };\n\n if (contentOffsetY) {\n const curr = contentOffsetY.value;\n\n if (curr !== prevContentOffsetY.value) {\n // eslint-disable-next-line react-compiler/react-compiler\n prevContentOffsetY.value = curr;\n result.contentOffset = { x: 0, y: curr };\n }\n }\n\n return result;\n }, [\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n style={styles.container}\n >\n <ScrollViewComponent\n ref={ref}\n animatedProps={animatedProps}\n {...rest}\n contentContainerStyle={\n isHarmony\n ? [\n contentContainerStyle,\n inverted\n ? { paddingTop: harmonyKbPad }\n : { paddingBottom: harmonyKbPad },\n ]\n : contentContainerStyle\n }\n >\n {children}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,UAAU,IACfC,OAAO,EACPC,gBAAgB,EAChBC,mBAAmB,EACnBC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,OAAOC,MAAM,MAAM,UAAU;AAK7B,MAAMC,EAAE,GAAGT,QAAQ,CAACS,EAAE;AACtB,MAAMC,4BAA4B,GAChCD,EAAE,KAAK,SAAS,IAAKA,EAAE,KAAgB,SAAS,GAC5CR,U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AqB,aAArBA,qBAAqB,uBAArBA,qBAAqB,CAAEyB,IAAI,EAC3BxB,QAAQ,EACRC,cAAc,CACf,CAAC;EAEF,oBACEtB,KAAA,CAAA4D,aAAA,CAAC/C,4BAA4B;IAC3BoC,aAAa,EAAEA,aAAc;IAC7B1B,wCAAwC,EACtCA,wCACD;IACDsC,KAAK,EAAElD,MAAM,CAACmD;EAAU,gBAExB9D,KAAA,CAAA4D,aAAA,CAAC5C,mBAAmB,EAAA+C,QAAA;IAClBnC,GAAG,EAAEA,GAAI;IACTqB,aAAa,EAAEA;EAAc,GACzBtB,IAAI;IACRF,qBAAqB,EACnBK,SAAS,GACL,CACEL,qBAAqB,EACrBJ,QAAQ,GACJ;MAAE2C,UAAU,EAAEjC;IAAa,CAAC,GAC5B;MAAEkC,aAAa,EAAElC;IAAa,CAAC,CACpC,GACDN;EACL,IAEAC,QACkB,CACO,CAAC;AAEnC,CACF,CAAC;AAED,eAAeX,2BAA2B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","styles","create","container","flexGrow","flexShrink"],"sources":["styles.ts"],"sourcesContent":["import { StyleSheet } from \"react-native\";\n\nconst styles = StyleSheet.create({\n container: {\n flexGrow: 1,\n flexShrink: 1,\n },\n});\n\nexport default styles;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,QAAQ,EAAE,CAAC;IACXC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAeJ,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useColorScheme","useColorSchemeRN"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\
|
|
1
|
+
{"version":3,"names":["useColorScheme","useColorSchemeRN"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\n\nconst useColorScheme = (): \"light\" | \"dark\" =>\n useColorSchemeRN() === \"dark\" ? \"dark\" : \"light\";\n\nexport default useColorScheme;\n"],"mappings":"AAAA,SAASA,cAAc,IAAIC,gBAAgB,QAAQ,cAAc;AAEjE,MAAMD,cAAc,GAAGA,CAAA,KACrBC,gBAAgB,CAAC,CAAC,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;AAElD,eAAeD,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
const useCombinedRef = (...refs) => {
|
|
3
|
+
return useCallback(value => {
|
|
4
|
+
for (const ref of refs) {
|
|
5
|
+
if (!ref) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
if (typeof ref === "function") {
|
|
9
|
+
ref(value);
|
|
10
|
+
} else {
|
|
11
|
+
ref.current = value;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
15
|
+
}, refs);
|
|
16
|
+
};
|
|
17
|
+
export default useCombinedRef;
|
|
18
|
+
//# sourceMappingURL=useCombinedRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useCombinedRef","refs","value","ref","current"],"sources":["useCombinedRef.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nimport type { MutableRefObject, Ref, RefCallback } from \"react\";\n\nconst useCombinedRef = <T>(...refs: Ref<T>[]): RefCallback<T> => {\n return useCallback((value: T | null) => {\n for (const ref of refs) {\n if (!ref) {\n continue;\n }\n\n if (typeof ref === \"function\") {\n ref(value);\n } else {\n (ref as MutableRefObject<T | null>).current = value;\n }\n }\n // eslint-disable-next-line react-compiler/react-compiler\n }, refs);\n};\n\nexport default useCombinedRef;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAInC,MAAMC,cAAc,GAAGA,CAAI,GAAGC,IAAc,KAAqB;EAC/D,OAAOF,WAAW,CAAEG,KAAe,IAAK;IACtC,KAAK,MAAMC,GAAG,IAAIF,IAAI,EAAE;MACtB,IAAI,CAACE,GAAG,EAAE;QACR;MACF;MAEA,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;QAC7BA,GAAG,CAACD,KAAK,CAAC;MACZ,CAAC,MAAM;QACJC,GAAG,CAAgCC,OAAO,GAAGF,KAAK;MACrD;IACF;IACA;EACF,CAAC,EAAED,IAAI,CAAC;AACV,CAAC;AAED,eAAeD,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useCallback, useEffect } from "react";
|
|
2
|
+
import { useEvent, useSharedValue } from "react-native-reanimated";
|
|
3
|
+
import { useEventHandlerRegistration } from "../../internal";
|
|
4
|
+
const NATIVE_SCROLL_EVENT_NAMES = ["onScroll", "onScrollBeginDrag", "onScrollEndDrag", "onMomentumScrollBegin", "onMomentumScrollEnd"];
|
|
5
|
+
const useScrollState = ref => {
|
|
6
|
+
const offset = useSharedValue(0);
|
|
7
|
+
const layout = useSharedValue({
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
});
|
|
11
|
+
const size = useSharedValue({
|
|
12
|
+
width: 0,
|
|
13
|
+
height: 0
|
|
14
|
+
});
|
|
15
|
+
const register = useEventHandlerRegistration(ref);
|
|
16
|
+
const eventHandler = useEvent(event => {
|
|
17
|
+
"worklet";
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
20
|
+
offset.value = event.contentOffset.y;
|
|
21
|
+
layout.value = event.layoutMeasurement;
|
|
22
|
+
size.value = event.contentSize;
|
|
23
|
+
}, NATIVE_SCROLL_EVENT_NAMES);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const cleanup = register(eventHandler);
|
|
26
|
+
return () => {
|
|
27
|
+
cleanup();
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
// `onContentSizeChange` is synthesized in JS (from the content container's
|
|
32
|
+
// onLayout) and `onLayout` has a different payload shape than scroll events,
|
|
33
|
+
// so neither can be reliably captured via native event registration.
|
|
34
|
+
// Instead we expose callbacks for the consumer to attach as props.
|
|
35
|
+
const onLayout = useCallback(e => {
|
|
36
|
+
layout.value = {
|
|
37
|
+
width: e.nativeEvent.layout.width,
|
|
38
|
+
height: e.nativeEvent.layout.height
|
|
39
|
+
};
|
|
40
|
+
}, [layout]);
|
|
41
|
+
const onContentSizeChange = useCallback((w, h) => {
|
|
42
|
+
size.value = {
|
|
43
|
+
width: w,
|
|
44
|
+
height: h
|
|
45
|
+
};
|
|
46
|
+
}, [size]);
|
|
47
|
+
return {
|
|
48
|
+
offset,
|
|
49
|
+
layout,
|
|
50
|
+
size,
|
|
51
|
+
onLayout,
|
|
52
|
+
onContentSizeChange
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export default useScrollState;
|
|
56
|
+
//# sourceMappingURL=useScrollState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useEvent","useSharedValue","useEventHandlerRegistration","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","layout","width","height","size","register","eventHandler","event","value","contentOffset","y","layoutMeasurement","contentSize","cleanup","onLayout","e","nativeEvent","onContentSizeChange","w","h"],"sources":["useScrollState.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport { useEvent, useSharedValue } from \"react-native-reanimated\";\n\nimport { useEventHandlerRegistration } from \"../../internal\";\n\nimport type { LayoutChangeEvent } from \"react-native\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst NATIVE_SCROLL_EVENT_NAMES = [\n \"onScroll\",\n \"onScrollBeginDrag\",\n \"onScrollEndDrag\",\n \"onMomentumScrollBegin\",\n \"onMomentumScrollEnd\",\n];\n\ntype ScrollEvent = {\n contentOffset: {\n x: number;\n y: number;\n };\n layoutMeasurement: {\n width: number;\n height: number;\n };\n contentSize: {\n width: number;\n height: number;\n };\n};\n\nconst useScrollState = (ref: AnimatedRef<Reanimated.ScrollView>) => {\n const offset = useSharedValue(0);\n const layout = useSharedValue({ width: 0, height: 0 });\n const size = useSharedValue({ width: 0, height: 0 });\n\n const register = useEventHandlerRegistration(ref);\n\n const eventHandler = useEvent((event: ScrollEvent) => {\n \"worklet\";\n\n // eslint-disable-next-line react-compiler/react-compiler\n offset.value = event.contentOffset.y;\n layout.value = event.layoutMeasurement;\n size.value = event.contentSize;\n }, NATIVE_SCROLL_EVENT_NAMES);\n\n useEffect(() => {\n const cleanup = register(eventHandler);\n\n return () => {\n cleanup();\n };\n }, []);\n\n // `onContentSizeChange` is synthesized in JS (from the content container's\n // onLayout) and `onLayout` has a different payload shape than scroll events,\n // so neither can be reliably captured via native event registration.\n // Instead we expose callbacks for the consumer to attach as props.\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n layout.value = {\n width: e.nativeEvent.layout.width,\n height: e.nativeEvent.layout.height,\n };\n },\n [layout],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n size.value = { width: w, height: h };\n },\n [size],\n );\n\n return { offset, layout, size, onLayout, onContentSizeChange };\n};\n\nexport default useScrollState;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,QAAQ,OAAO;AAC9C,SAASC,QAAQ,EAAEC,cAAc,QAAQ,yBAAyB;AAElE,SAASC,2BAA2B,QAAQ,gBAAgB;AAM5D,MAAMC,yBAAyB,GAAG,CAChC,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,CACtB;AAiBD,MAAMC,cAAc,GAAIC,GAAuC,IAAK;EAClE,MAAMC,MAAM,GAAGL,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMM,MAAM,GAAGN,cAAc,CAAC;IAAEO,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EAC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
|
1
1
|
export { default as KeyboardAvoidingView } from "./KeyboardAvoidingView";
|
|
2
2
|
export { default as KeyboardStickyView } from "./KeyboardStickyView";
|
|
3
3
|
export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
|
|
4
|
+
export { default as KeyboardChatScrollView } from "./KeyboardChatScrollView";
|
|
4
5
|
export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./KeyboardToolbar";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\
|
|
1
|
+
{"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardChatScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport { default as KeyboardChatScrollView } from \"./KeyboardChatScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type { KeyboardAwareScrollViewProps } from \"./KeyboardAwareScrollView\";\nexport type { KeyboardAwareScrollViewRef } from \"./KeyboardAwareScrollView\";\nexport type { KeyboardChatScrollViewProps } from \"./KeyboardChatScrollView/types\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SAASH,OAAO,IAAII,sBAAsB,QAAQ,0BAA0B;AAC5E,SACEJ,OAAO,IAAIK,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB","ignoreList":[]}
|
package/lib/module/constants.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { KeyboardControllerNative } from "./bindings";
|
|
2
|
+
|
|
1
3
|
// copied from `android.view.WindowManager.LayoutParams`
|
|
2
4
|
export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes) {
|
|
3
5
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_NOTHING"] = 48] = "SOFT_INPUT_ADJUST_NOTHING";
|
|
@@ -18,4 +20,5 @@ export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes)
|
|
|
18
20
|
AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
|
|
19
21
|
return AndroidSoftInputModes;
|
|
20
22
|
}({});
|
|
23
|
+
export const KEYBOARD_BORDER_RADIUS = KeyboardControllerNative.getConstants().keyboardBorderRadius;
|
|
21
24
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AndroidSoftInputModes"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\
|
|
1
|
+
{"version":3,"names":["KeyboardControllerNative","AndroidSoftInputModes","KEYBOARD_BORDER_RADIUS","getConstants","keyboardBorderRadius"],"sources":["constants.ts"],"sourcesContent":["import { KeyboardControllerNative } from \"./bindings\";\n\n// copied from `android.view.WindowManager.LayoutParams`\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\n SOFT_INPUT_MASK_ADJUST = 240,\n SOFT_INPUT_MASK_STATE = 15,\n SOFT_INPUT_MODE_CHANGED = 512,\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\n SOFT_INPUT_STATE_HIDDEN = 2,\n SOFT_INPUT_STATE_UNCHANGED = 1,\n // temporarily disable this rule to avoid breaking changes.\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\n SOFT_INPUT_STATE_VISIBLE = 4,\n}\nexport const KEYBOARD_BORDER_RADIUS =\n KeyboardControllerNative.getConstants().keyboardBorderRadius;\n"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,YAAY;;AAErD;AACA,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAkBjC,OAAO,MAAMC,sBAAsB,GACjCF,wBAAwB,CAACG,YAAY,CAAC,CAAC,CAACC,oBAAoB","ignoreList":[]}
|
package/lib/module/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","Animated","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","useKeyboardContext","context","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\
|
|
1
|
+
{"version":3,"names":["createContext","useContext","Animated","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Value","height","reanimated","layout","update","Promise","resolve","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","useKeyboardContext","context","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport type {\n FocusedInputHandlers,\n FocusedInputLayoutChangedEvent,\n KeyboardHandlers,\n} from \"./types\";\nimport type React from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nexport type AnimatedContext = {\n progress: Animated.Value;\n height: Animated.AnimatedMultiplication<number>;\n};\nexport type ReanimatedContext = {\n progress: SharedValue<number>;\n height: SharedValue<number>;\n};\nexport type KeyboardAnimationContext = {\n enabled: boolean;\n animated: AnimatedContext;\n reanimated: ReanimatedContext;\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\n update: () => Promise<void>;\n setKeyboardHandlers: (handlers: KeyboardHandlers) => void;\n setInputHandlers: (handlers: FocusedInputHandlers) => void;\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\n};\nconst NOOP = () => {};\nconst NESTED_NOOP = () => NOOP;\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\n value,\n addListener: NOOP,\n removeListener: NOOP,\n modify: NOOP,\n get: () => value,\n set: NOOP,\n});\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\n null,\n);\nconst defaultContext: KeyboardAnimationContext = {\n enabled: true,\n animated: {\n progress: new Animated.Value(0),\n height: new Animated.Value(0),\n },\n reanimated: {\n progress: DEFAULT_SHARED_VALUE,\n height: DEFAULT_SHARED_VALUE,\n },\n layout: DEFAULT_LAYOUT,\n update: () => Promise.resolve(),\n setKeyboardHandlers: NESTED_NOOP,\n setInputHandlers: NESTED_NOOP,\n setEnabled: NOOP,\n};\nexport const KeyboardContext = createContext(defaultContext);\nexport const useKeyboardContext = () => {\n const context = useContext(KeyboardContext);\n if (__DEV__ && context === defaultContext) {\n console.warn(\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AACjD,SAASC,QAAQ,QAAQ,cAAc;AA4BvC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,WAAW,GAAGA,CAAA,KAAMD,IAAI;AAC9B,MAAME,eAAe,GAAOC,KAAQ,KAAsB;EACxDA,KAAK;EACLC,WAAW,EAAEJ,IAAI;EACjBK,cAAc,EAAEL,IAAI;EACpBM,MAAM,EAAEN,IAAI;EACZO,GAAG,EAAEA,CAAA,KAAMJ,KAAK;EAChBK,GAAG,EAAER;AACP,CAAC,CAAC;AACF,MAAMS,oBAAoB,GAAGP,eAAe,CAAC,CAAC,CAAC;AAC/C,MAAMQ,cAAc,GAAGR,eAAe,CACpC,IACF,CAAC;AACD,MAAMS,cAAwC,GAAG;EAC/CC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIf,QAAQ,CAACgB,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAIjB,QAAQ,CAACgB,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVH,QAAQ,EAAEL,oBAAoB;IAC9BO,MAAM,EAAEP;EACV,CAAC;EACDS,MAAM,EAAER,cAAc;EACtBS,MAAM,EAAEA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC/BC,mBAAmB,EAAErB,WAAW;EAChCsB,gBAAgB,EAAEtB,WAAW;EAC7BuB,UAAU,EAAExB;AACd,CAAC;AACD,OAAO,MAAMyB,eAAe,gBAAG5B,aAAa,CAACc,cAAc,CAAC;AAC5D,OAAO,MAAMe,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAG7B,UAAU,CAAC2B,eAAe,CAAC;EAC3C,IAAIG,OAAO,IAAID,OAAO,KAAKhB,cAAc,EAAE;IACzCkB,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -47,7 +47,8 @@ export function useKeyboardController() {
|
|
|
47
47
|
export function useReanimatedFocusedInput() {
|
|
48
48
|
const context = useKeyboardContext();
|
|
49
49
|
return {
|
|
50
|
-
input: context.layout
|
|
50
|
+
input: context.layout,
|
|
51
|
+
update: context.update
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
export function useFocusedInputHandler(handler, deps) {
|
|
@@ -65,4 +66,5 @@ export function useFocusedInputHandler(handler, deps) {
|
|
|
65
66
|
}, deps);
|
|
66
67
|
}
|
|
67
68
|
export * from "./useWindowDimensions";
|
|
69
|
+
export * from "./useKeyboardState";
|
|
68
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","AndroidSoftInputModes","useKeyboardContext","uuid","KeyboardController","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\
|
|
1
|
+
{"version":3,"names":["useEffect","AndroidSoftInputModes","useKeyboardContext","uuid","KeyboardController","useResizeMode","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","key","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","update","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\nimport { uuid } from \"../utils\";\nimport { KeyboardController } from \"../module\";\n\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\nimport type { DependencyList } from \"react\";\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.animated;\n};\n\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.reanimated;\n};\n\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useEffect(() => {\n const key = uuid();\n\n context.setKeyboardHandlers({ [key]: handler });\n\n return () => {\n context.setKeyboardHandlers({ [key]: undefined });\n };\n }, deps);\n}\n\nexport function useKeyboardHandler(\n handler: KeyboardHandler,\n deps?: DependencyList,\n) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n\nexport function useKeyboardController() {\n const context = useKeyboardContext();\n\n return { setEnabled: context.setEnabled, enabled: context.enabled };\n}\n\nexport function useReanimatedFocusedInput() {\n const context = useKeyboardContext();\n\n return { input: context.layout, update: context.update };\n}\n\nexport function useFocusedInputHandler(\n handler?: FocusedInputHandler,\n deps?: DependencyList,\n) {\n const context = useKeyboardContext();\n\n useEffect(() => {\n const key = uuid();\n\n context.setInputHandlers({ [key]: handler });\n\n return () => {\n context.setInputHandlers({ [key]: undefined });\n };\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\nexport * from \"./useKeyboardState\";\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,kBAAkB,QAAQ,YAAY;AAC/C,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,kBAAkB,QAAQ,WAAW;AAM9C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjCL,SAAS,CAAC,MAAM;IACdI,kBAAkB,CAACE,YAAY,CAC7BL,qBAAqB,CAACM,wBACxB,CAAC;IAED,OAAO,MAAMH,kBAAkB,CAACI,cAAc,CAAC,CAAC;EAClD,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAuB;EACzDJ,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGR,kBAAkB,CAAC,CAAC;EAEpC,OAAOQ,OAAO,CAACC,QAAQ;AACzB,CAAC;AAED,OAAO,MAAMC,8BAA8B,GAAGA,CAAA,KAAyB;EACrEP,aAAa,CAAC,CAAC;EACf,MAAMK,OAAO,GAAGR,kBAAkB,CAAC,CAAC;EAEpC,OAAOQ,OAAO,CAACG,UAAU;AAC3B,CAAC;AAED,OAAO,SAASC,yBAAyBA,CACvCC,OAAwB,EACxBC,IAAqB,EACrB;EACA,MAAMN,OAAO,GAAGR,kBAAkB,CAAC,CAAC;EAEpCF,SAAS,CAAC,MAAM;IACd,MAAMiB,GAAG,GAAGd,IA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 -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { KeyboardEvents } from "../../bindings";
|
|
3
|
+
import { KeyboardController } from "../../module";
|
|
4
|
+
const EVENTS = ["keyboardDidShow", "keyboardDidHide"];
|
|
5
|
+
const getLatestState = () => ({
|
|
6
|
+
...KeyboardController.state(),
|
|
7
|
+
isVisible: KeyboardController.isVisible()
|
|
8
|
+
});
|
|
9
|
+
const defaultSelector = state => state;
|
|
10
|
+
export function useKeyboardState(selector = defaultSelector) {
|
|
11
|
+
const [state, setState] = useState(() => selector(getLatestState()));
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const subscriptions = EVENTS.map(event => KeyboardEvents.addListener(event, () =>
|
|
14
|
+
// state will be updated by global listener first,
|
|
15
|
+
// so we simply read it and don't derive data from the event
|
|
16
|
+
setState(selector(getLatestState()))));
|
|
17
|
+
const willShowSubscription = KeyboardEvents.addListener("keyboardWillShow", event => setState(selector({
|
|
18
|
+
...getLatestState(),
|
|
19
|
+
appearance: event.appearance
|
|
20
|
+
})));
|
|
21
|
+
|
|
22
|
+
// we might have missed an update between reading a value in render and
|
|
23
|
+
// `addListener` in this handler, so we set it here. If there was
|
|
24
|
+
// no change, React will filter out this update as a no-op.
|
|
25
|
+
setState(selector(getLatestState()));
|
|
26
|
+
return () => {
|
|
27
|
+
subscriptions.forEach(subscription => subscription.remove());
|
|
28
|
+
willShowSubscription.remove();
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","KeyboardEvents","KeyboardController","EVENTS","getLatestState","state","isVisible","defaultSelector","useKeyboardState","selector","setState","subscriptions","map","event","addListener","willShowSubscription","appearance","forEach","subscription","remove"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type { IKeyboardState } from \"../../types\";\n\nconst EVENTS = [\"keyboardDidShow\", \"keyboardDidHide\"] as const;\n\nconst getLatestState = () => ({\n ...KeyboardController.state(),\n isVisible: KeyboardController.isVisible(),\n});\n\ntype KeyboardStateSelector<T> = (state: IKeyboardState) => T;\n\nconst defaultSelector: KeyboardStateSelector<IKeyboardState> = (state) => state;\n\nexport function useKeyboardState<T = IKeyboardState>(\n selector: KeyboardStateSelector<T> = defaultSelector as KeyboardStateSelector<T>,\n): T {\n const [state, setState] = useState<T>(() => selector(getLatestState()));\n\n useEffect(() => {\n const subscriptions = EVENTS.map((event) =>\n KeyboardEvents.addListener(event, () =>\n // state will be updated by global listener first,\n // so we simply read it and don't derive data from the event\n setState(selector(getLatestState())),\n ),\n );\n const willShowSubscription = KeyboardEvents.addListener(\n \"keyboardWillShow\",\n (event) =>\n setState(\n selector({ ...getLatestState(), appearance: event.appearance }),\n ),\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setState(selector(getLatestState()));\n\n return () => {\n subscriptions.forEach((subscription) => subscription.remove());\n willShowSubscription.remove();\n };\n }, []);\n\n return state;\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,kBAAkB,QAAQ,cAAc;AAIjD,MAAMC,MAAM,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU;AAE9D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGF,kBAAkB,CAACG,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEJ,kBAAkB,CAACI,SAAS,CAAC;AAC1C,CAAC,CAAC;AAIF,MAAMC,eAAsD,GAAIF,KAAK,IAAKA,KAAK;AAE/E,OAAO,SAASG,gBAAgBA,CAC9BC,QAAkC,GAAGF,eAA2C,EAC7E;EACH,MAAM,CAACF,KAAK,EAAEK,QAAQ,CAAC,GAAGV,QAAQ,CAAI,MAAMS,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC;EAEvEL,SAAS,CAAC,MAAM;IACd,MAAMY,aAAa,GAAGR,MAAM,CAACS,GAAG,CAAEC,KAAK,IACrCZ,cAAc,CAACa,WAAW,CAACD,KAAK,EAAE;IAChC;IACA;IACAH,QAAQ,CAACD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CACrC,CACF,CAAC;IACD,MAAMW,oBAAoB,GAAGd,cAAc,CAACa,WAAW,CACrD,kBAAkB,EACjBD,KAAK,IACJH,QAAQ,CACND,QAAQ,CAAC;MAAE,GAAGL,cAAc,CAAC,CAAC;MAAEY,UAAU,EAAEH,KAAK,CAACG;IAAW,CAAC,CAChE,CACJ,CAAC;;IAED;IACA;IACA;IACAN,QAAQ,CAACD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,MAAM;MACXO,aAAa,CAACM,OAAO,CAAEC,YAAY,IAAKA,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC;MAC9DJ,oBAAoB,CAACI,MAAM,CAAC,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOd,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","WindowDimensionsEvents","initialDimensions","width","height","addListener","e","useWindowDimensions","dimensions","setDimensions","subscription","remove"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\
|
|
1
|
+
{"version":3,"names":["useEffect","useState","WindowDimensionsEvents","initialDimensions","width","height","addListener","e","useWindowDimensions","dimensions","setDimensions","subscription","remove"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { WindowDimensionsEvents } from \"../../bindings\";\n\nimport type { WindowDimensionsEventData } from \"../../types\";\n\nlet initialDimensions: WindowDimensionsEventData = {\n width: 0,\n height: 0,\n};\n\nWindowDimensionsEvents.addListener(\"windowDidResize\", (e) => {\n initialDimensions = e;\n});\n\nexport const useWindowDimensions = () => {\n const [dimensions, setDimensions] = useState(initialDimensions);\n\n useEffect(() => {\n const subscription = WindowDimensionsEvents.addListener(\n \"windowDidResize\",\n (e) => {\n setDimensions(e);\n },\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setDimensions(initialDimensions);\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return dimensions;\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,sBAAsB,QAAQ,gBAAgB;AAIvD,IAAIC,iBAA4C,GAAG;EACjDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAEDH,sBAAsB,CAACI,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EAC3DJ,iBAAiB,GAAGI,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGT,QAAQ,CAACE,iBAAiB,CAAC;EAE/DH,SAAS,CAAC,MAAM;IACd,MAAMW,YAAY,GAAGT,sBAAsB,CAACI,WAAW,CACrD,iBAAiB,EAChBC,CAAC,IAAK;MACLG,aAAa,CAACH,CAAC,CAAC;IAClB,CACF,CAAC;;IAED;IACA;IACA;IACAG,aAAa,CAACP,iBAAiB,CAAC;IAEhC,OAAO,MAAM;MACXQ,YAAY,CAACC,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOH,UAAU;AACnB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useWindowDimensions"],"sources":["index.ts"],"sourcesContent":["export { useWindowDimensions } from \"react-native\";\
|
|
1
|
+
{"version":3,"names":["useWindowDimensions"],"sources":["index.ts"],"sourcesContent":["export { useWindowDimensions } from \"react-native\";\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,cAAc","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -5,8 +5,9 @@ export * from "./hooks";
|
|
|
5
5
|
export * from "./constants";
|
|
6
6
|
export * from "./module";
|
|
7
7
|
export * from "./types";
|
|
8
|
-
export
|
|
8
|
+
export * from "./compat";
|
|
9
|
+
export { KeyboardChatScrollView, KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
|
|
9
10
|
// keyboard toolbar
|
|
10
11
|
KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./components";
|
|
11
|
-
export { OverKeyboardView } from "./views";
|
|
12
|
+
export { OverKeyboardView, KeyboardExtender } from "./views";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","OverKeyboardView"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\
|
|
1
|
+
{"version":3,"names":["KeyboardChatScrollView","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","OverKeyboardView","KeyboardExtender"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\nexport * from \"./compat\";\n\nexport {\n KeyboardChatScrollView,\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardChatScrollViewProps,\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AAExB,SACEA,sBAAsB,EACtBC,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,QACtB,cAAc;AASrB,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS","ignoreList":[]}
|
package/lib/module/internal.js
CHANGED
|
@@ -1,16 +1,51 @@
|
|
|
1
1
|
import { useCallback, useRef } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
import { useSharedValue } from "react-native-reanimated";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { findNodeHandle } from "./utils/findNodeHandle";
|
|
5
|
+
export function useEventHandlerRegistration(viewTagRef) {
|
|
6
|
+
const onRegisterHandler = handler => {
|
|
7
|
+
const currentHandler = handler;
|
|
8
|
+
const attachWorkletHandlers = () => {
|
|
9
|
+
const viewTag = findNodeHandle(viewTagRef.current);
|
|
10
|
+
if (__DEV__ && !viewTag) {
|
|
11
|
+
console.warn("Can not attach worklet handlers for `react-native-keyboard-controller` because view tag can not be resolved. Be sure that `KeyboardProvider` is fully mounted before registering handlers. If you think it is a bug in library, please open an issue.");
|
|
12
|
+
}
|
|
13
|
+
if (viewTag) {
|
|
14
|
+
if ("workletEventHandler" in currentHandler) {
|
|
15
|
+
currentHandler.workletEventHandler.registerForEvents(viewTag);
|
|
16
|
+
} else {
|
|
17
|
+
currentHandler.registerForEvents(viewTag);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
if (viewTagRef.current) {
|
|
22
|
+
attachWorkletHandlers();
|
|
23
|
+
} else {
|
|
24
|
+
queueMicrotask(attachWorkletHandlers);
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
const viewTag = findNodeHandle(viewTagRef.current);
|
|
28
|
+
if (viewTag) {
|
|
29
|
+
if ("workletEventHandler" in currentHandler) {
|
|
30
|
+
currentHandler.workletEventHandler.unregisterFromEvents(viewTag);
|
|
31
|
+
} else {
|
|
32
|
+
currentHandler.unregisterFromEvents(viewTag);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
return onRegisterHandler;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Hook for storing worklet handlers (objects with keys, where values are worklets).
|
|
41
|
+
* Returns methods for setting handlers and broadcasting events in them.
|
|
42
|
+
*
|
|
43
|
+
* T is a generic that looks like:
|
|
44
|
+
* @example
|
|
45
|
+
* {
|
|
46
|
+
* onEvent: () => {},
|
|
47
|
+
* onEvent2: () => {},
|
|
48
|
+
* }
|
|
14
49
|
*/
|
|
15
50
|
export function useSharedHandlers() {
|
|
16
51
|
const handlers = useSharedValue({});
|
|
@@ -47,14 +82,14 @@ export function useSharedHandlers() {
|
|
|
47
82
|
return [setHandlers, broadcast];
|
|
48
83
|
}
|
|
49
84
|
|
|
50
|
-
/**
|
|
51
|
-
* TS variant of `useAnimatedValue` hook which is added in RN 0.71
|
|
52
|
-
* A better alternative of storing animated values in refs, since
|
|
53
|
-
* it doesn't recreate a new `Animated.Value` object on every re-render
|
|
54
|
-
* and therefore consumes less memory. We can not use a variant from
|
|
55
|
-
* RN, since this library supports earlier versions of RN.
|
|
56
|
-
*
|
|
57
|
-
* @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937
|
|
85
|
+
/**
|
|
86
|
+
* TS variant of `useAnimatedValue` hook which is added in RN 0.71
|
|
87
|
+
* A better alternative of storing animated values in refs, since
|
|
88
|
+
* it doesn't recreate a new `Animated.Value` object on every re-render
|
|
89
|
+
* and therefore consumes less memory. We can not use a variant from
|
|
90
|
+
* RN, since this library supports earlier versions of RN.
|
|
91
|
+
*
|
|
92
|
+
* @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937
|
|
58
93
|
*/
|
|
59
94
|
export function useAnimatedValue(initialValue, config) {
|
|
60
95
|
const ref = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useRef","Animated","useSharedValue","
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","Animated","useSharedValue","findNodeHandle","useEventHandlerRegistration","viewTagRef","onRegisterHandler","handler","currentHandler","attachWorkletHandlers","viewTag","current","__DEV__","console","warn","workletEventHandler","registerForEvents","queueMicrotask","unregisterFromEvents","useSharedHandlers","handlers","jsHandlers","updateSharedHandlers","value","setHandlers","broadcast","type","event","Object","keys","forEach","key","_handlers$value$key","_handlers$value$key$t","call","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { Animated } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport { findNodeHandle } from \"./utils/findNodeHandle\";\n\nimport type { EventHandlerProcessed } from \"react-native-reanimated\";\nimport type { Handlers } from \"./types\";\n\ntype ComponentOrHandle = Parameters<typeof findNodeHandle>[0];\n\ntype WorkletHandler = {\n registerForEvents: (viewTag: number) => void;\n unregisterFromEvents: (viewTag: number) => void;\n};\n\ntype WorkletHandlerOrWorkletHandlerObject =\n | WorkletHandler\n | {\n workletEventHandler: WorkletHandler;\n };\n\nexport function useEventHandlerRegistration(\n viewTagRef: React.MutableRefObject<ComponentOrHandle>,\n) {\n const onRegisterHandler = (handler: EventHandlerProcessed<never, never>) => {\n const currentHandler =\n handler as unknown as WorkletHandlerOrWorkletHandlerObject;\n const attachWorkletHandlers = () => {\n const viewTag = findNodeHandle(viewTagRef.current);\n\n if (__DEV__ && !viewTag) {\n console.warn(\n \"Can not attach worklet handlers for `react-native-keyboard-controller` because view tag can not be resolved. Be sure that `KeyboardProvider` is fully mounted before registering handlers. If you think it is a bug in library, please open an issue.\",\n );\n }\n\n if (viewTag) {\n if (\"workletEventHandler\" in currentHandler) {\n currentHandler.workletEventHandler.registerForEvents(viewTag);\n } else {\n currentHandler.registerForEvents(viewTag);\n }\n }\n };\n\n if (viewTagRef.current) {\n attachWorkletHandlers();\n } else {\n queueMicrotask(attachWorkletHandlers);\n }\n\n return () => {\n const viewTag = findNodeHandle(viewTagRef.current);\n\n if (viewTag) {\n if (\"workletEventHandler\" in currentHandler) {\n currentHandler.workletEventHandler.unregisterFromEvents(viewTag);\n } else {\n currentHandler.unregisterFromEvents(viewTag);\n }\n }\n };\n };\n\n return onRegisterHandler;\n}\n\ntype UntypedHandler = Record<string, (event: never) => void>;\ntype SharedHandlersReturnType<T extends UntypedHandler> = [\n (handler: Handlers<T>) => void,\n <K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void,\n];\n\n/**\n * Hook for storing worklet handlers (objects with keys, where values are worklets).\n * Returns methods for setting handlers and broadcasting events in them.\n *\n * T is a generic that looks like:\n * @example\n * {\n * onEvent: () => {},\n * onEvent2: () => {},\n * }\n */\nexport function useSharedHandlers<\n T extends UntypedHandler,\n>(): SharedHandlersReturnType<T> {\n const handlers = useSharedValue<Handlers<T>>({});\n const jsHandlers = useRef<Handlers<T>>({});\n\n // since js -> worklet -> js call is asynchronous, we can not write handlers\n // straight into shared variable (using current shared value as a previous result),\n // since there may be a race condition in a call, and closure may have out-of-dated\n // values. As a result, some of handlers may be not written to \"all handlers\" object.\n // Below we are writing all handlers to `ref` and afterwards synchronize them with\n // shared value (since `refs` are not referring to actual value in worklets).\n // This approach allow us to update synchronously handlers in js thread (and it assures,\n // that it will have all of them) and then update them in worklet thread (calls are\n // happening in FIFO order, so we will always have actual value).\n const updateSharedHandlers = () => {\n // eslint-disable-next-line react-compiler/react-compiler\n handlers.value = jsHandlers.current;\n };\n const setHandlers = useCallback((handler: Handlers<T>) => {\n jsHandlers.current = {\n ...jsHandlers.current,\n ...handler,\n };\n updateSharedHandlers();\n }, []);\n const broadcast = <K extends keyof T>(\n type: K,\n event: Parameters<T[K]>[0],\n ) => {\n \"worklet\";\n\n Object.keys(handlers.value).forEach((key) => {\n handlers.value[key]?.[type]?.(event);\n });\n };\n\n return [setHandlers, broadcast];\n}\n\n/**\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\n * A better alternative of storing animated values in refs, since\n * it doesn't recreate a new `Animated.Value` object on every re-render\n * and therefore consumes less memory. We can not use a variant from\n * RN, since this library supports earlier versions of RN.\n *\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\n */\nexport function useAnimatedValue(\n initialValue: number,\n config?: Animated.AnimatedConfig,\n): Animated.Value {\n const ref = useRef<Animated.Value | null>(null);\n\n if (ref.current == null) {\n ref.current = new Animated.Value(initialValue, config);\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAAQ,yBAAyB;AAExD,SAASC,cAAc,QAAQ,wBAAwB;AAkBvD,OAAO,SAASC,2BAA2BA,CACzCC,UAAqD,EACrD;EACA,MAAMC,iBAAiB,GAAIC,OAA4C,IAAK;IAC1E,MAAMC,cAAc,GAClBD,OAA0D;IAC5D,MAAME,qBAAqB,GAAGA,CAAA,KAAM;MAClC,MAAMC,OAAO,GAAGP,cAAc,CAACE,UAAU,CAACM,OAAO,CAAC;MAElD,IAAIC,OAAO,IAAI,CAACF,OAAO,EAAE;QACvBG,OAAO,CAACC,IAAI,CACV,uPACF,CAAC;MACH;MAEA,IAAIJ,OAAO,EAAE;QACX,IAAI,qBAAqB,IAAIF,cAAc,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