@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverKeyboardView","children","visible","height","width","useWindowDimensions","inner","useMemo","style","styles","absolute","Platform","OS","global","_IS_FABRIC","undefined","createElement","RCTOverKeyboardView","View","collapsable","StyleSheet","create","position","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverKeyboardView","children","visible","height","width","useWindowDimensions","inner","useMemo","style","styles","absolute","Platform","OS","global","_IS_FABRIC","undefined","createElement","RCTOverKeyboardView","View","collapsable","StyleSheet","create","position","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Platform, StyleSheet, View } from \"react-native\";\n\nimport { RCTOverKeyboardView } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { OverKeyboardViewProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\nconst OverKeyboardView = ({\n children,\n visible,\n}: PropsWithChildren<OverKeyboardViewProps>) => {\n const { height, width } = useWindowDimensions();\n const inner = useMemo(() => ({ height, width }), [height, width]);\n const style = useMemo(\n () => [\n styles.absolute,\n // On iOS - stretch view to full window dimensions to make yoga work\n // On Android Fabric we temporarily use the same approach\n // @ts-expect-error `_IS_FABRIC` is injected by REA\n Platform.OS === \"ios\" || global._IS_FABRIC ? inner : undefined,\n ],\n [inner],\n );\n\n return (\n <RCTOverKeyboardView visible={visible}>\n {/* `OverKeyboardView` should always have a single child */}\n <View collapsable={false} style={style}>\n {children}\n </View>\n </RCTOverKeyboardView>\n );\n};\n\nconst styles = StyleSheet.create({\n absolute: {\n position: \"absolute\",\n },\n});\n\nexport default OverKeyboardView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAkD,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAKlD,MAAMkB,gBAAgB,GAAGA,CAAC;EACxBC,QAAQ;EACRC;AACwC,CAAC,KAAK;EAC9C,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,0BAAmB,EAAC,CAAC;EAC/C,MAAMC,KAAK,GAAG,IAAAC,cAAO,EAAC,OAAO;IAAEJ,MAAM;IAAEC;EAAM,CAAC,CAAC,EAAE,CAACD,MAAM,EAAEC,KAAK,CAAC,CAAC;EACjE,MAAMI,KAAK,GAAG,IAAAD,cAAO,EACnB,MAAM,CACJE,MAAM,CAACC,QAAQ;EACf;EACA;EACA;EACAC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAIC,MAAM,CAACC,UAAU,GAAGR,KAAK,GAAGS,SAAS,CAC/D,EACD,CAACT,KAAK,CACR,CAAC;EAED,oBACE/B,MAAA,CAAAgB,OAAA,CAAAyB,aAAA,CAACrC,SAAA,CAAAsC,mBAAmB;IAACf,OAAO,EAAEA;EAAQ,gBAEpC3B,MAAA,CAAAgB,OAAA,CAAAyB,aAAA,CAACtC,YAAA,CAAAwC,IAAI;IAACC,WAAW,EAAE,KAAM;IAACX,KAAK,EAAEA;EAAM,GACpCP,QACG,CACa,CAAC;AAE1B,CAAC;AAED,MAAMQ,MAAM,GAAGW,uBAAU,CAACC,MAAM,CAAC;EAC/BX,QAAQ,EAAE;IACRY,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEYS,gBAAgB","ignoreList":[]}
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "KeyboardExtender", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _KeyboardExtender.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "OverKeyboardView", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -10,5 +16,6 @@ Object.defineProperty(exports, "OverKeyboardView", {
|
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
18
|
var _OverKeyboardView = _interopRequireDefault(require("./OverKeyboardView"));
|
|
19
|
+
var _KeyboardExtender = _interopRequireDefault(require("./KeyboardExtender"));
|
|
13
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_OverKeyboardView","_interopRequireDefault","require","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as OverKeyboardView } from \"./OverKeyboardView\";\
|
|
1
|
+
{"version":3,"names":["_OverKeyboardView","_interopRequireDefault","require","_KeyboardExtender","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as OverKeyboardView } from \"./OverKeyboardView\";\nexport { default as KeyboardExtender } from \"./KeyboardExtender\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
package/lib/module/animated.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Animated, Platform, StyleSheet } from "react-native";
|
|
3
3
|
import Reanimated, { useSharedValue } from "react-native-reanimated";
|
|
4
|
-
import { KeyboardControllerView } from "./bindings";
|
|
4
|
+
import { FocusedInputEvents, KeyboardControllerView, KeyboardControllerViewCommands } from "./bindings";
|
|
5
5
|
import { KeyboardContext } from "./context";
|
|
6
6
|
import { useAnimatedValue, useSharedHandlers } from "./internal";
|
|
7
|
-
import {
|
|
7
|
+
import { KeyboardController } from "./module";
|
|
8
8
|
import { useAnimatedKeyboardHandler, useFocusedInputLayoutHandler, useFocusedInputSelectionHandler, useFocusedInputTextHandler } from "./reanimated";
|
|
9
9
|
const KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(Animated.createAnimatedComponent(KeyboardControllerView));
|
|
10
10
|
const styles = StyleSheet.create({
|
|
@@ -16,6 +16,7 @@ const styles = StyleSheet.create({
|
|
|
16
16
|
position: "absolute"
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
|
|
19
20
|
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
20
21
|
// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details
|
|
21
22
|
const OS = Platform.OS;
|
|
@@ -24,8 +25,10 @@ export const KeyboardProvider = ({
|
|
|
24
25
|
statusBarTranslucent,
|
|
25
26
|
navigationBarTranslucent,
|
|
26
27
|
preserveEdgeToEdge,
|
|
27
|
-
enabled: initiallyEnabled = true
|
|
28
|
+
enabled: initiallyEnabled = true,
|
|
29
|
+
preload = true
|
|
28
30
|
}) => {
|
|
31
|
+
const viewRef = useRef(null);
|
|
29
32
|
// state
|
|
30
33
|
const [enabled, setEnabled] = useState(initiallyEnabled);
|
|
31
34
|
// animated values
|
|
@@ -37,6 +40,15 @@ export const KeyboardProvider = ({
|
|
|
37
40
|
const layout = useSharedValue(null);
|
|
38
41
|
const [setKeyboardHandlers, broadcastKeyboardEvents] = useSharedHandlers();
|
|
39
42
|
const [setInputHandlers, broadcastInputEvents] = useSharedHandlers();
|
|
43
|
+
const update = useCallback(async () => {
|
|
44
|
+
KeyboardControllerViewCommands.synchronizeFocusedInputLayout(viewRef.current);
|
|
45
|
+
await new Promise(resolve => {
|
|
46
|
+
const subscription = FocusedInputEvents.addListener("layoutDidSynchronize", () => {
|
|
47
|
+
subscription.remove();
|
|
48
|
+
resolve(null);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}, []);
|
|
40
52
|
// memo
|
|
41
53
|
const context = useMemo(() => ({
|
|
42
54
|
enabled,
|
|
@@ -49,10 +61,11 @@ export const KeyboardProvider = ({
|
|
|
49
61
|
height: heightSV
|
|
50
62
|
},
|
|
51
63
|
layout,
|
|
64
|
+
update,
|
|
52
65
|
setKeyboardHandlers,
|
|
53
66
|
setInputHandlers,
|
|
54
67
|
setEnabled
|
|
55
|
-
}), [enabled]);
|
|
68
|
+
}), [enabled, update]);
|
|
56
69
|
const style = useMemo(() => [styles.hidden, {
|
|
57
70
|
transform: [{
|
|
58
71
|
translateX: height
|
|
@@ -89,13 +102,13 @@ export const KeyboardProvider = ({
|
|
|
89
102
|
"worklet";
|
|
90
103
|
|
|
91
104
|
broadcastKeyboardEvents("onMove", event);
|
|
92
|
-
updateSharedValues(event, ["android"]);
|
|
105
|
+
updateSharedValues(event, ["android", "harmony"]);
|
|
93
106
|
},
|
|
94
107
|
onKeyboardMoveEnd: event => {
|
|
95
108
|
"worklet";
|
|
96
109
|
|
|
97
110
|
broadcastKeyboardEvents("onEnd", event);
|
|
98
|
-
updateSharedValues(event, [
|
|
111
|
+
updateSharedValues(event, ["android", "harmony"]);
|
|
99
112
|
},
|
|
100
113
|
onKeyboardMoveInteractive: event => {
|
|
101
114
|
"worklet";
|
|
@@ -129,17 +142,15 @@ export const KeyboardProvider = ({
|
|
|
129
142
|
broadcastInputEvents("onSelectionChange", e);
|
|
130
143
|
}
|
|
131
144
|
}, []);
|
|
132
|
-
// effects
|
|
133
145
|
useEffect(() => {
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
} else {
|
|
137
|
-
revertMonkeyPatch();
|
|
146
|
+
if (preload) {
|
|
147
|
+
KeyboardController.preload();
|
|
138
148
|
}
|
|
139
|
-
}, [
|
|
149
|
+
}, [preload]);
|
|
140
150
|
return /*#__PURE__*/React.createElement(KeyboardContext.Provider, {
|
|
141
151
|
value: context
|
|
142
152
|
}, /*#__PURE__*/React.createElement(KeyboardControllerViewAnimated, {
|
|
153
|
+
ref: viewRef,
|
|
143
154
|
enabled: enabled,
|
|
144
155
|
onKeyboardMoveReanimated: keyboardHandler,
|
|
145
156
|
onKeyboardMoveStart: OS === "ios" ? onKeyboardMove : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useMemo","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","KeyboardControllerView","KeyboardContext","useAnimatedValue","useSharedHandlers","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\r\n * @platform android\r\n */\r\n preserveEdgeToEdge?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n preserveEdgeToEdge,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height,-1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver:Platform.OS as string=='harmony'?false:true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n progressSV.value = event.progress;\r\n heightSV.value = -event.height;\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={ OS as string === \"harmony\"?onKeyboardMove:undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n preserveEdgeToEdge={preserveEdgeToEdge}\r\n style={styles.container}\r\n >\r\n {children}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAY;AAChE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpE,SACEC,0BAA0B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ACrB;EACF,CAAC,EAAE,CAACoB,OAAO,CAAC,CAAC;EAEb,oBACElC,KAAA,CAAA0E,aAAA,CAAChE,eAAe,CAACiE,QAAQ;IAACd,KAAK,EAAEf;EAAQ,gBACvC9C,KAAA,CAAA0E,aAAA,CAACvD,8BAA8B;IAC7Be,OAAO,EAAEA,OAAQ;IACjB0C,wBAAwB,EAAEd,eAAgB;IAC1CC,mBAAmB,EAAEnC,EAAE,KAAK,KAAK,GAAG0B,cAAc,GAAGuB,SAAU;IAC/DvB,cAAc,EAAE1B,EAAE,KAAK,SAAS,GAAG0B,cAAc,GAAGuB,SAAU;IAC9DZ,yBAAyB,EAAEX,cAAe;IAC1CU,iBAAiB,EAAGpC,EAAE,KAAe,SAAS,GAAC0B,cAAc,GAACuB,SAAU;IACxEC,qCAAqC,EAAEZ,kBAAmB;IAC1Da,mCAAmC,EAAET,gBAAiB;IACtDU,wCAAwC,EAAER,qBAAsB;IAChExC,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CE,kBAAkB,EAAEA,kBAAmB;IACvCiB,KAAK,EAAE7B,MAAM,CAACE;EAAU,GAEvBO,QAC6B,CAAC,eACjC9B,KAAA,CAAA0E,aAAA,CAACtE,QAAQ,CAAC6E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA/B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","Reanimated","useSharedValue","FocusedInputEvents","KeyboardControllerView","KeyboardControllerViewCommands","KeyboardContext","useAnimatedValue","useSharedHandlers","KeyboardController","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","useFocusedInputSelectionHandler","useFocusedInputTextHandler","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","setInputHandlers","broadcastInputEvents","update","synchronizeFocusedInputLayout","current","Promise","resolve","subscription","addListener","remove","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","onFocusedInputSelectionChanged","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n FocusedInputEvents,\n KeyboardControllerView,\n KeyboardControllerViewCommands,\n} from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputSelectionHandler,\n useFocusedInputTextHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n KeyboardProviderProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\n) as React.ComponentType<\n KeyboardControllerProps &\n React.RefAttributes<React.Component<KeyboardControllerProps>>\n>;\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n}: KeyboardProviderProps) => {\n const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n const update = useCallback(async () => {\n KeyboardControllerViewCommands.synchronizeFocusedInputLayout(\n viewRef.current,\n );\n\n await new Promise((resolve) => {\n const subscription = FocusedInputEvents.addListener(\n \"layoutDidSynchronize\",\n () => {\n subscription.remove();\n resolve(null);\n },\n );\n });\n }, []);\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height,-1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n update,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled, update],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver:Platform.OS as string=='harmony'?false:true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\", \"harmony\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n broadcastKeyboardEvents(\"onEnd\", event);\n updateSharedValues(event, [\"android\", \"harmony\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n const inputSelectionHandler = useFocusedInputSelectionHandler(\n {\n onFocusedInputSelectionChanged: (e) => {\n \"worklet\";\n broadcastInputEvents(\"onSelectionChange\", e);\n },\n },\n [],\n );\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewRef}\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={ OS as string === \"harmony\"?onKeyboardMove:undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n preserveEdgeToEdge={preserveEdgeToEdge}\n style={styles.container}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,8BAA8B,QACzB,YAAY;AACnB,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAY;AAChE,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SACEC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,0BAA0B,QACrB,cAAc;AAarB,MAAMC,8BAA8B,GAAGb,UAAU,CAACc,uBAAuB,CACvEjB,QAAQ,CAACiB,uBAAuB,CAC9BX,sBACF,CACF,CAGC;AAOD,MAAMY,MAAM,GAAGhB,UA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|
1
|
+
{"version":3,"names":["IS_FABRIC","global"],"sources":["architecture.ts"],"sourcesContent":["export const IS_FABRIC = \"nativeFabricUIManager\" in global;\n"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG,uBAAuB,IAAIC,MAAM","ignoreList":[]}
|
package/lib/module/bindings.js
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useColorScheme, View } from "react-native";
|
|
2
3
|
const NOOP = () => {};
|
|
3
4
|
export const KeyboardControllerNative = {
|
|
4
5
|
setDefaultMode: NOOP,
|
|
5
6
|
setInputMode: NOOP,
|
|
7
|
+
preload: NOOP,
|
|
6
8
|
dismiss: NOOP,
|
|
7
9
|
setFocusTo: NOOP,
|
|
10
|
+
viewPositionInWindow: () => Promise.resolve({
|
|
11
|
+
x: 0,
|
|
12
|
+
y: 0,
|
|
13
|
+
width: 0,
|
|
14
|
+
height: 0
|
|
15
|
+
}),
|
|
8
16
|
addListener: NOOP,
|
|
9
|
-
removeListeners: NOOP
|
|
17
|
+
removeListeners: NOOP,
|
|
18
|
+
getConstants: () => ({
|
|
19
|
+
keyboardBorderRadius: 0
|
|
20
|
+
})
|
|
10
21
|
};
|
|
11
22
|
export const KeyboardEvents = {
|
|
12
23
|
addListener: () => ({
|
|
13
24
|
remove: NOOP
|
|
14
25
|
})
|
|
15
26
|
};
|
|
16
|
-
/**
|
|
17
|
-
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
18
|
-
* Use it with cautious.
|
|
27
|
+
/**
|
|
28
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
29
|
+
* Use it with cautious.
|
|
19
30
|
*/
|
|
20
31
|
export const FocusedInputEvents = {
|
|
21
32
|
addListener: () => ({
|
|
@@ -28,6 +39,29 @@ export const WindowDimensionsEvents = {
|
|
|
28
39
|
})
|
|
29
40
|
};
|
|
30
41
|
export const KeyboardControllerView = View;
|
|
42
|
+
export const KeyboardControllerViewCommands = {
|
|
43
|
+
synchronizeFocusedInputLayout: _ref => {}
|
|
44
|
+
};
|
|
31
45
|
export const KeyboardGestureArea = View;
|
|
32
46
|
export const RCTOverKeyboardView = View;
|
|
47
|
+
export const ClippingScrollView = View;
|
|
48
|
+
export const KeyboardBackgroundView = /*#__PURE__*/React.forwardRef(({
|
|
49
|
+
style,
|
|
50
|
+
...props
|
|
51
|
+
}, ref) => {
|
|
52
|
+
const colorScheme = useColorScheme();
|
|
53
|
+
const backgroundColor = colorScheme === "dark" ? "#2c2c2e" : "#eceff3";
|
|
54
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
55
|
+
ref,
|
|
56
|
+
style: [{
|
|
57
|
+
backgroundColor
|
|
58
|
+
}, style],
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
export const RCTKeyboardExtender = View;
|
|
63
|
+
/**
|
|
64
|
+
* A View that defines a group of `TextInput`s for toolbar navigation.
|
|
65
|
+
*/
|
|
66
|
+
export const RCTKeyboardToolbarGroupView = View;
|
|
33
67
|
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","NOOP","KeyboardControllerNative","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","RCTOverKeyboardView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\
|
|
1
|
+
{"version":3,"names":["React","useColorScheme","View","NOOP","KeyboardControllerNative","setDefaultMode","setInputMode","preload","dismiss","setFocusTo","viewPositionInWindow","Promise","resolve","x","y","width","height","addListener","removeListeners","getConstants","keyboardBorderRadius","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","_ref","KeyboardGestureArea","RCTOverKeyboardView","ClippingScrollView","KeyboardBackgroundView","forwardRef","style","props","ref","colorScheme","backgroundColor","createElement","RCTKeyboardExtender","RCTKeyboardToolbarGroupView"],"sources":["bindings.ts"],"sourcesContent":["import React from \"react\";\nimport { useColorScheme, View } from \"react-native\";\n\nimport type {\n ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n KeyboardToolbarGroupViewProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\nimport type { View as RNView } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n preload: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n viewPositionInWindow: () =>\n Promise.resolve({ x: 0, y: 0, width: 0, height: 0 }),\n addListener: NOOP,\n removeListeners: NOOP,\n getConstants: () => ({\n keyboardBorderRadius: 0,\n }),\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardControllerViewCommands = {\n synchronizeFocusedInputLayout: (\n _ref: React.Component<KeyboardControllerProps> | null,\n ) => {},\n};\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\nexport const ClippingScrollView =\n View as unknown as React.FC<ClippingScrollViewProps>;\nexport const KeyboardBackgroundView = React.forwardRef<\n RNView,\n KeyboardBackgroundViewProps\n>(({ style, ...props }, ref) => {\n const colorScheme = useColorScheme();\n const backgroundColor = colorScheme === \"dark\" ? \"#2c2c2e\" : \"#eceff3\";\n\n return React.createElement(View, {\n ref,\n style: [{ backgroundColor }, style],\n ...props,\n });\n});\nexport const RCTKeyboardExtender =\n View as unknown as React.FC<KeyboardExtenderProps>;\n/**\n * A View that defines a group of `TextInput`s for toolbar navigation.\n */\nexport const RCTKeyboardToolbarGroupView =\n View as unknown as React.FC<KeyboardToolbarGroupViewProps>;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,IAAI,QAAQ,cAAc;AAkBnD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,wBAAwD,GAAG;EACtEC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,OAAO,EAAEL,IAAI;EACbM,UAAU,EAAEN,IAAI;EAChBO,oBAAoB,EAAEA,CAAA,KACpBC,OAAO,CAACC,OAAO,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtDC,WAAW,EAAEd,IAAI;EACjBe,eAAe,EAAEf,IAAI;EACrBgB,YAAY,EAAEA,CAAA,MAAO;IACnBC,oBAAoB,EAAE;EACxB,CAAC;AACH,CAAC;AACD,OAAO,MAAMC,cAAoC,GAAG;EAClDJ,WAAW,EAAEA,CAAA,MAAO;IAAEK,MAAM,EAAEnB;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMoB,kBAA4C,GAAG;EAC1DN,WAAW,EAAEA,CAAA,MAAO;IAAEK,MAAM,EAAEnB;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMqB,sBAAoD,GAAG;EAClEP,WAAW,EAAEA,CAAA,MAAO;IAAEK,MAAM,EAAEnB;EAAK,CAAC;AACtC,CAAC;AACD,OAAO,MAAMsB,sBAAsB,GACjCvB,IAAoD;AACtD,OAAO,MAAMwB,8BAA8B,GAAG;EAC5CC,6BAA6B,EAC3BC,IAAqD,IAClD,CAAC;AACR,CAAC;AACD,OAAO,MAAMC,mBAAmB,GAC9B3B,IAAqD;AACvD,OAAO,MAAM4B,mBAAmB,GAC9B5B,IAAkD;AACpD,OAAO,MAAM6B,kBAAkB,GAC7B7B,IAAoD;AACtD,OAAO,MAAM8B,sBAAsB,gBAAGhC,KAAK,CAACiC,UAAU,CAGpD,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC9B,MAAMC,WAAW,GAAGpC,cAAc,CAAC,CAAC;EACpC,MAAMqC,eAAe,GAAGD,WAAW,KAAK,MAAM,GAAG,SAAS,GAAG,SAAS;EAEtE,oBAAOrC,KAAK,CAACuC,aAAa,CAACrC,IAAI,EAAE;IAC/BkC,GAAG;IACHF,KAAK,EAAE,CAAC;MAAEI;IAAgB,CAAC,EAAEJ,KAAK,CAAC;IACnC,GAAGC;EACL,CAAC,CAAC;AACJ,CAAC,CAAC;AACF,OAAO,MAAMK,mBAAmB,GAC9BtC,IAAkD;AACpD;AACA;AACA;AACA,OAAO,MAAMuC,2BAA2B,GACtCvC,IAA0D","ignoreList":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeEventEmitter, Platform, useColorScheme, View } from "react-native";
|
|
2
3
|
const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
4
|
ios: "- You have run 'pod install'\n",
|
|
4
5
|
default: ""
|
|
5
6
|
}) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
|
|
7
|
+
const KeyboardControllerViewNativeComponentModule = require("./specs/KeyboardControllerViewNativeComponent");
|
|
6
8
|
const RCTKeyboardController = require("./specs/NativeKeyboardController").default;
|
|
7
9
|
export const KeyboardControllerNative = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
|
|
8
10
|
get() {
|
|
@@ -15,9 +17,9 @@ export const KeyboardEvents = {
|
|
|
15
17
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
16
18
|
};
|
|
17
19
|
|
|
18
|
-
/**
|
|
19
|
-
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
20
|
-
* Use it with cautious.
|
|
20
|
+
/**
|
|
21
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
22
|
+
* Use it with cautious.
|
|
21
23
|
*/
|
|
22
24
|
export const FocusedInputEvents = {
|
|
23
25
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
@@ -25,9 +27,29 @@ export const FocusedInputEvents = {
|
|
|
25
27
|
export const WindowDimensionsEvents = {
|
|
26
28
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
27
29
|
};
|
|
28
|
-
export const KeyboardControllerView =
|
|
30
|
+
export const KeyboardControllerView = KeyboardControllerViewNativeComponentModule.default;
|
|
31
|
+
export const KeyboardControllerViewCommands = KeyboardControllerViewNativeComponentModule.Commands;
|
|
29
32
|
export const KeyboardGestureArea = Platform.OS === "android" && Platform.Version >= 30 || Platform.OS === "ios" ? require("./specs/KeyboardGestureAreaNativeComponent").default : ({
|
|
30
33
|
children
|
|
31
34
|
}) => children;
|
|
32
35
|
export const RCTOverKeyboardView = require("./specs/OverKeyboardViewNativeComponent").default;
|
|
36
|
+
export const ClippingScrollView = Platform.OS === "android" || Platform.OS === "harmony" ? require("./specs/ClippingScrollViewDecoratorViewNativeComponent").default : ({
|
|
37
|
+
children
|
|
38
|
+
}) => children;
|
|
39
|
+
export const KeyboardBackgroundView = /*#__PURE__*/React.forwardRef(({
|
|
40
|
+
style,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) => {
|
|
43
|
+
const colorScheme = useColorScheme();
|
|
44
|
+
const backgroundColor = colorScheme === "dark" ? "#2c2c2e" : "#eceff3";
|
|
45
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
46
|
+
ref,
|
|
47
|
+
style: [{
|
|
48
|
+
backgroundColor
|
|
49
|
+
}, style],
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
export const RCTKeyboardExtender = View;
|
|
54
|
+
export const RCTKeyboardToolbarGroupView = require("./specs/KeyboardToolbarGroupViewNativeComponent").default;
|
|
33
55
|
//# sourceMappingURL=bindings.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","
|
|
1
|
+
{"version":3,"names":["React","NativeEventEmitter","Platform","useColorScheme","View","LINKING_ERROR","select","ios","default","KeyboardControllerViewNativeComponentModule","require","RCTKeyboardController","KeyboardControllerNative","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardControllerViewCommands","Commands","KeyboardGestureArea","OS","Version","children","RCTOverKeyboardView","ClippingScrollView","KeyboardBackgroundView","forwardRef","style","props","ref","colorScheme","backgroundColor","createElement","RCTKeyboardExtender","RCTKeyboardToolbarGroupView"],"sources":["bindings.native.ts"],"sourcesContent":["import React from \"react\";\nimport {\n NativeEventEmitter,\n Platform,\n useColorScheme,\n View,\n} from \"react-native\";\n\nimport type {\n ClippingScrollViewProps,\n FocusedInputEventsModule,\n KeyboardBackgroundViewProps,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardExtenderProps,\n KeyboardGestureAreaProps,\n KeyboardToolbarGroupViewProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { View as RNView } from \"react-native\";\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\n \"- You rebuilt the app after installing the package\\n\" +\n \"- You are not using Expo Go\\n\";\n\nconst KeyboardControllerViewNativeComponentModule = require(\"./specs/KeyboardControllerViewNativeComponent\");\nconst RCTKeyboardController =\n require(\"./specs/NativeKeyboardController\").default;\n\nexport const KeyboardControllerNative = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerNativeModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardControllerNative);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\n\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n KeyboardControllerViewNativeComponentModule.default;\nexport const KeyboardControllerViewCommands =\n KeyboardControllerViewNativeComponentModule.Commands;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n (Platform.OS === \"android\" && Platform.Version >= 30) || Platform.OS === \"ios\"\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\nexport const RCTOverKeyboardView: React.FC<OverKeyboardViewProps> =\n require(\"./specs/OverKeyboardViewNativeComponent\").default;\nexport const ClippingScrollView: React.FC<ClippingScrollViewProps> =\n Platform.OS === \"android\" || (Platform.OS as string) === \"harmony\"\n ? require(\"./specs/ClippingScrollViewDecoratorViewNativeComponent\").default\n : ({ children }: ClippingScrollViewProps) => children;\nexport const KeyboardBackgroundView = React.forwardRef<\n RNView,\n KeyboardBackgroundViewProps\n>(({ style, ...props }, ref) => {\n const colorScheme = useColorScheme();\n const backgroundColor = colorScheme === \"dark\" ? \"#2c2c2e\" : \"#eceff3\";\n\n return React.createElement(View, {\n ref,\n style: [{ backgroundColor }, style],\n ...props,\n });\n});\nexport const RCTKeyboardExtender =\n View as unknown as React.FC<KeyboardExtenderProps>;\nexport const RCTKeyboardToolbarGroupView: React.FC<KeyboardToolbarGroupViewProps> =\n require(\"./specs/KeyboardToolbarGroupViewNativeComponent\").default;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,kBAAkB,EAClBC,QAAQ,EACRC,cAAc,EACdC,IAAI,QACC,cAAc;AAiBrB,MAAMC,aAAa,GACjB,2FAA2F,GAC3FH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,2CAA2C,GAAGC,OAAO,CAAC,+CAA+C,CAAC;AAC5G,MAAMC,qBAAqB,GACzBD,OAAO,CAAC,kCAAkC,CAAC,CAACF,OAAO;AAErD,OAAO,MAAMI,wBAAwB,GACnCD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CA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,CAAC,KAAKA,QAAQ;AACzD,OAAO,MAAMG,sBAAsB,gBAAGjC,KAAK,CAACkC,UAAU,CAGpD,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC9B,MAAMC,WAAW,GAAGnC,cAAc,CAAC,CAAC;EACpC,MAAMoC,eAAe,GAAGD,WAAW,KAAK,MAAM,GAAG,SAAS,GAAG,SAAS;EAEtE,oBAAOtC,KAAK,CAACwC,aAAa,CAACpC,IAAI,EAAE;IAC/BiC,GAAG;IACHF,KAAK,EAAE,CAAC;MAAEI;IAAgB,CAAC,EAAEJ,KAAK,CAAC;IACnC,GAAGC;EACL,CAAC,CAAC;AACJ,CAAC,CAAC;AACF,OAAO,MAAMK,mBAAmB,GAC9BrC,IAAkD;AACpD,OAAO,MAAMsC,2BAAoE,GAC/EhC,OAAO,CAAC,iDAAiD,CAAC,CAACF,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useSharedValue } from "react-native-reanimated";
|
|
2
|
+
import { useKeyboardHandler } from "./hooks";
|
|
3
|
+
export const KeyboardState = {
|
|
4
|
+
UNKNOWN: 0,
|
|
5
|
+
OPENING: 1,
|
|
6
|
+
OPEN: 2,
|
|
7
|
+
CLOSING: 3,
|
|
8
|
+
CLOSED: 4
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Compatibility layer for migrating from Reanimated's useAnimatedKeyboard. */
|
|
12
|
+
export const useAnimatedKeyboard = () => {
|
|
13
|
+
const height = useSharedValue(0);
|
|
14
|
+
const state = useSharedValue(KeyboardState.UNKNOWN);
|
|
15
|
+
useKeyboardHandler({
|
|
16
|
+
onStart: event => {
|
|
17
|
+
"worklet";
|
|
18
|
+
|
|
19
|
+
state.value = event.height > 0 ? KeyboardState.OPENING : KeyboardState.CLOSING;
|
|
20
|
+
},
|
|
21
|
+
onMove: event => {
|
|
22
|
+
"worklet";
|
|
23
|
+
|
|
24
|
+
height.value = event.height;
|
|
25
|
+
},
|
|
26
|
+
onInteractive: event => {
|
|
27
|
+
"worklet";
|
|
28
|
+
|
|
29
|
+
height.value = event.height;
|
|
30
|
+
},
|
|
31
|
+
onEnd: event => {
|
|
32
|
+
"worklet";
|
|
33
|
+
|
|
34
|
+
state.value = event.height > 0 ? KeyboardState.OPEN : KeyboardState.CLOSED;
|
|
35
|
+
height.value = event.height;
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
return {
|
|
39
|
+
height,
|
|
40
|
+
state
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSharedValue","useKeyboardHandler","KeyboardState","UNKNOWN","OPENING","OPEN","CLOSING","CLOSED","useAnimatedKeyboard","height","state","onStart","event","value","onMove","onInteractive","onEnd"],"sources":["compat.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"./hooks\";\n\nexport const KeyboardState = {\n UNKNOWN: 0,\n OPENING: 1,\n OPEN: 2,\n CLOSING: 3,\n CLOSED: 4,\n};\n\n/** Compatibility layer for migrating from Reanimated's useAnimatedKeyboard. */\nexport const useAnimatedKeyboard = () => {\n const height = useSharedValue(0);\n const state = useSharedValue(KeyboardState.UNKNOWN);\n\n useKeyboardHandler(\n {\n onStart: (event) => {\n \"worklet\";\n state.value =\n event.height > 0 ? KeyboardState.OPENING : KeyboardState.CLOSING;\n },\n onMove: (event) => {\n \"worklet\";\n height.value = event.height;\n },\n onInteractive: (event) => {\n \"worklet\";\n height.value = event.height;\n },\n onEnd: (event) => {\n \"worklet\";\n state.value =\n event.height > 0 ? KeyboardState.OPEN : KeyboardState.CLOSED;\n height.value = event.height;\n },\n },\n [],\n );\n\n return { height, state };\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,yBAAyB;AAExD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,OAAO,MAAMC,aAAa,GAAG;EAC3BC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE;AACV,CAAC;;AAED;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,MAAM,GAAGT,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMU,KAAK,GAAGV,cAAc,CAACE,aAAa,CAACC,OAAO,CAAC;EAEnDF,kBAAkB,CAChB;IACEU,OAAO,EAAGC,KAAK,IAAK;MAClB,SAAS;;MACTF,KAAK,CAACG,KAAK,GACTD,KAAK,CAACH,MAAM,GAAG,CAAC,GAAGP,aAAa,CAACE,OAAO,GAAGF,aAAa,CAACI,OAAO;IACpE,CAAC;IACDQ,MAAM,EAAGF,KAAK,IAAK;MACjB,SAAS;;MACTH,MAAM,CAACI,KAAK,GAAGD,KAAK,CAACH,MAAM;IAC7B,CAAC;IACDM,aAAa,EAAGH,KAAK,IAAK;MACxB,SAAS;;MACTH,MAAM,CAACI,KAAK,GAAGD,KAAK,CAACH,MAAM;IAC7B,CAAC;IACDO,KAAK,EAAGJ,KAAK,IAAK;MAChB,SAAS;;MACTF,KAAK,CAACG,KAAK,GACTD,KAAK,CAACH,MAAM,GAAG,CAAC,GAAGP,aAAa,CAACG,IAAI,GAAGH,aAAa,CAACK,MAAM;MAC9DE,MAAM,CAACI,KAAK,GAAGD,KAAK,CAACH,MAAM;IAC7B;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEA,MAAM;IAAEC;EAAM,CAAC;AAC1B,CAAC","ignoreList":[]}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { useSharedValue } from "react-native-reanimated";
|
|
2
2
|
import { useKeyboardHandler } from "../../hooks";
|
|
3
3
|
import { useKeyboardContext } from "../../context";
|
|
4
|
-
import {
|
|
4
|
+
import { useLayoutEffect } from "react";
|
|
5
5
|
import { Platform } from "react-native";
|
|
6
6
|
const OS = Platform.OS;
|
|
7
7
|
export const useKeyboardAnimation = () => {
|
|
8
8
|
const {
|
|
9
9
|
reanimated
|
|
10
10
|
} = useKeyboardContext();
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const heightWhenOpened = useSharedValue(0);
|
|
12
|
+
const height = useSharedValue(0);
|
|
13
|
+
const progress = useSharedValue(0);
|
|
14
|
+
const isClosed = useSharedValue(true);
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const initialHeight = -reanimated.height.value;
|
|
17
|
+
const initialProgress = reanimated.progress.value;
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
20
|
+
heightWhenOpened.value = initialHeight;
|
|
21
|
+
height.value = initialHeight;
|
|
22
|
+
progress.value = initialProgress;
|
|
23
|
+
isClosed.value = initialProgress === 0;
|
|
24
|
+
}, []);
|
|
18
25
|
useKeyboardHandler({
|
|
19
26
|
onStart: e => {
|
|
20
27
|
"worklet";
|
|
21
28
|
|
|
22
29
|
if (e.height > 0) {
|
|
23
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
24
30
|
isClosed.value = false;
|
|
25
31
|
heightWhenOpened.value = e.height;
|
|
26
32
|
}
|
|
@@ -71,17 +77,17 @@ export const useTranslateAnimation = () => {
|
|
|
71
77
|
const {
|
|
72
78
|
reanimated
|
|
73
79
|
} = useKeyboardContext();
|
|
74
|
-
|
|
75
|
-
// calculate it only once on mount, to avoid `SharedValue` reads during a render
|
|
76
|
-
const [initialProgress] = useState(() => reanimated.progress.value);
|
|
77
|
-
const padding = useSharedValue(initialProgress);
|
|
80
|
+
const padding = useSharedValue(0);
|
|
78
81
|
const translate = useSharedValue(0);
|
|
82
|
+
useLayoutEffect(() => {
|
|
83
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
84
|
+
padding.value = reanimated.progress.value;
|
|
85
|
+
}, []);
|
|
79
86
|
useKeyboardHandler({
|
|
80
87
|
onStart: e => {
|
|
81
88
|
"worklet";
|
|
82
89
|
|
|
83
90
|
if (e.height === 0) {
|
|
84
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
85
91
|
padding.value = 0;
|
|
86
92
|
}
|
|
87
93
|
if (OS === "ios") {
|
|
@@ -91,7 +97,7 @@ export const useTranslateAnimation = () => {
|
|
|
91
97
|
onMove: e => {
|
|
92
98
|
"worklet";
|
|
93
99
|
|
|
94
|
-
if (OS
|
|
100
|
+
if (OS !== "ios") {
|
|
95
101
|
translate.value = e.progress;
|
|
96
102
|
}
|
|
97
103
|
},
|
|
@@ -105,7 +111,7 @@ export const useTranslateAnimation = () => {
|
|
|
105
111
|
"worklet";
|
|
106
112
|
|
|
107
113
|
padding.value = e.progress;
|
|
108
|
-
if (OS
|
|
114
|
+
if (OS !== "ios") {
|
|
109
115
|
translate.value = e.progress;
|
|
110
116
|
}
|
|
111
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSharedValue","useKeyboardHandler","useKeyboardContext","
|
|
1
|
+
{"version":3,"names":["useSharedValue","useKeyboardHandler","useKeyboardContext","useLayoutEffect","Platform","OS","useKeyboardAnimation","reanimated","heightWhenOpened","height","progress","isClosed","initialHeight","value","initialProgress","onStart","e","onMove","onInteractive","onEnd","duration","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport {useKeyboardHandler} from \"../../hooks\";\nimport {useKeyboardContext} from \"../../context\";\nimport { useLayoutEffect } from \"react\";\nimport { Platform } from \"react-native\";\n\nconst OS = Platform.OS;\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useLayoutEffect(() => {\n const initialHeight = -reanimated.height.value;\n const initialProgress = reanimated.progress.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n heightWhenOpened.value = initialHeight;\n height.value = initialHeight;\n progress.value = initialProgress;\n isClosed.value = initialProgress === 0;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n \n progress.value = e.progress;\n height.value = e.height;\n },\n onInteractive: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n if(Platform.OS as string === 'harmony'){\n heightWhenOpened.value = e.height;\n }\n \n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n\nexport const useTranslateAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const padding = useSharedValue(0);\n const translate = useSharedValue(0);\n\n useLayoutEffect(() => {\n // eslint-disable-next-line react-compiler/react-compiler\n padding.value = reanimated.progress.value;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height === 0) {\n padding.value = 0;\n }\n if (OS === \"ios\") {\n translate.value = e.progress;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (OS !== \"ios\") {\n translate.value = e.progress;\n }\n },\n onInteractive: (e) => {\n \"worklet\";\n\n padding.value = 0;\n\n translate.value = e.progress;\n },\n onEnd: (e) => {\n \"worklet\";\n\n padding.value = e.progress;\n\n if (OS !== \"ios\") {\n translate.value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