@react-native-ohos/react-native-keyboard-controller 1.16.8 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.OpenSource +2 -2
- package/README.md +105 -29
- package/harmony/keyboard_controller/BuildProfile.ets +1 -1
- package/harmony/keyboard_controller/Index.ets +1 -0
- package/harmony/keyboard_controller/oh-package-lock.json5 +7 -7
- package/harmony/keyboard_controller/oh-package.json5 +1 -1
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentDescriptor.h +86 -0
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.cpp +104 -0
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewComponentInstance.h +64 -0
- package/harmony/keyboard_controller/src/main/cpp/ClippingScrollViewJSIBinder.h +60 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +8 -1
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +2 -2
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentDescriptor.h +46 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.cpp +37 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewComponentInstance.h +32 -0
- package/harmony/keyboard_controller/src/main/cpp/KeyboardToolbarGroupViewJSIBinder.h +23 -0
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +58 -1
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +20 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +65 -44
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +22 -3
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +17 -4
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +9 -1
- package/harmony/keyboard_controller/src/main/ets/{RNKeyboardControllerPackage.ts → RNKeyboardControllerPackage.ets} +9 -5
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +29 -5
- package/harmony/keyboard_controller/src/main/ets/Type.ts +2 -1
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +20 -9
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/architecture.js +8 -0
- package/lib/commonjs/architecture.js.map +1 -0
- package/lib/commonjs/bindings.js +37 -2
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +25 -2
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/compat.js +50 -0
- package/lib/commonjs/compat.js.map +1 -0
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +21 -15
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +36 -11
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +51 -16
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +2 -2
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/hooks.js +13 -0
- package/lib/commonjs/components/KeyboardChatScrollView/hooks.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/index.js +122 -0
- package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/types.js +6 -0
- package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +221 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +149 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +240 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js +6 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js +40 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +92 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js +13 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js +25 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js +58 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js +49 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js +49 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js +42 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js +6 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/components/types.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/context.js +17 -0
- package/lib/commonjs/components/KeyboardToolbar/compound/context.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/constants.js +17 -0
- package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js +95 -84
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +120 -0
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -0
- package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js +15 -0
- package/lib/commonjs/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
- package/lib/commonjs/components/hooks/useColorScheme.js +1 -1
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
- package/lib/commonjs/components/hooks/useCombinedRef.js +24 -0
- package/lib/commonjs/components/hooks/useCombinedRef.js.map +1 -0
- package/lib/commonjs/components/hooks/useScrollState.js +62 -0
- package/lib/commonjs/components/hooks/useScrollState.js.map +1 -0
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/constants.js +3 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/context.js +1 -0
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks/index.js +14 -1
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardState/index.js +39 -0
- package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -0
- package/lib/commonjs/index.js +27 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +36 -0
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/module.js +21 -12
- package/lib/commonjs/module.js.map +1 -1
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +12 -0
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +8 -2
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js +12 -0
- package/lib/commonjs/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/findNodeHandle/index.js +9 -0
- package/lib/commonjs/utils/findNodeHandle/index.js.map +1 -0
- package/lib/commonjs/utils/findNodeHandle/index.native.js +13 -0
- package/lib/commonjs/utils/findNodeHandle/index.native.js.map +1 -0
- package/lib/commonjs/views/KeyboardExtender/index.js +30 -0
- package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
- package/lib/commonjs/views/index.js +7 -0
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/animated.js +22 -11
- package/lib/module/animated.js.map +1 -1
- package/lib/module/architecture.js +2 -0
- package/lib/module/architecture.js.map +1 -0
- package/lib/module/bindings.js +36 -2
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +24 -2
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/compat.js +43 -0
- package/lib/module/compat.js.map +1 -0
- package/lib/module/components/KeyboardAvoidingView/hooks.js +22 -16
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +35 -11
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +54 -19
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +2 -2
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/hooks.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/hooks.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/index.js +115 -0
- package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/types.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js +207 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +143 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +234 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js +2 -0
- package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useEndVisible.js +33 -0
- package/lib/module/components/KeyboardChatScrollView/useEndVisible.js.map +1 -0
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +87 -0
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/Button.js +2 -2
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/compound/components/Background.js +6 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Background.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Content.js +18 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Content.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Done.js +50 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Done.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Next.js +41 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Next.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Prev.js +41 -0
- package/lib/module/components/KeyboardToolbar/compound/components/Prev.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/index.js +6 -0
- package/lib/module/components/KeyboardToolbar/compound/components/index.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/components/types.js +2 -0
- package/lib/module/components/KeyboardToolbar/compound/components/types.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/compound/context.js +10 -0
- package/lib/module/components/KeyboardToolbar/compound/context.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/constants.js +11 -0
- package/lib/module/components/KeyboardToolbar/constants.js.map +1 -0
- package/lib/module/components/KeyboardToolbar/index.js +95 -85
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/module/components/ScrollViewWithBottomPadding/index.js +112 -0
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -0
- package/lib/module/components/ScrollViewWithBottomPadding/styles.js +9 -0
- package/lib/module/components/ScrollViewWithBottomPadding/styles.js.map +1 -0
- package/lib/module/components/hooks/useColorScheme.js +1 -1
- package/lib/module/components/hooks/useColorScheme.js.map +1 -1
- package/lib/module/components/hooks/useCombinedRef.js +18 -0
- package/lib/module/components/hooks/useCombinedRef.js.map +1 -0
- package/lib/module/components/hooks/useScrollState.js +56 -0
- package/lib/module/components/hooks/useScrollState.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/constants.js +3 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/context.js +1 -0
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js +3 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useKeyboardState/index.js +33 -0
- package/lib/module/hooks/useKeyboardState/index.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +35 -0
- package/lib/module/internal.js.map +1 -1
- package/lib/module/module.js +21 -12
- package/lib/module/module.js.map +1 -1
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +6 -0
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +7 -1
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +2 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js +5 -0
- package/lib/module/specs/KeyboardToolbarGroupViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/findNodeHandle/index.js +2 -0
- package/lib/module/utils/findNodeHandle/index.js.map +1 -0
- package/lib/module/utils/findNodeHandle/index.native.js +3 -0
- package/lib/module/utils/findNodeHandle/index.native.js.map +1 -0
- package/lib/module/views/KeyboardExtender/index.js +23 -0
- package/lib/module/views/KeyboardExtender/index.js.map +1 -0
- package/lib/module/views/index.js +1 -0
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/animated.d.ts +2 -38
- package/lib/typescript/architecture.d.ts +1 -0
- package/lib/typescript/bindings.d.ts +15 -1
- package/lib/typescript/bindings.native.d.ts +10 -1
- package/lib/typescript/compat.d.ts +12 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +5 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +4 -1
- package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
- package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +17 -0
- package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +113 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts +132 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.d.ts +18 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/index.ios.d.ts +21 -0
- package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +37 -0
- package/lib/typescript/components/KeyboardChatScrollView/useEndVisible.d.ts +17 -0
- package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +45 -0
- package/lib/typescript/components/KeyboardToolbar/Button.d.ts +2 -2
- package/lib/typescript/components/KeyboardToolbar/compound/components/Background.d.ts +6 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Content.d.ts +7 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Done.d.ts +7 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Next.d.ts +4 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/Prev.d.ts +4 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/index.d.ts +5 -0
- package/lib/typescript/components/KeyboardToolbar/compound/components/types.d.ts +14 -0
- package/lib/typescript/components/KeyboardToolbar/compound/context.d.ts +9 -0
- package/lib/typescript/components/KeyboardToolbar/constants.d.ts +10 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +12 -45
- package/lib/typescript/components/KeyboardToolbar/types.d.ts +24 -1
- package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +30 -0
- package/lib/typescript/components/ScrollViewWithBottomPadding/styles.d.ts +7 -0
- package/lib/typescript/components/hooks/useCombinedRef.d.ts +3 -0
- package/lib/typescript/components/hooks/useScrollState.d.ts +17 -0
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/constants.d.ts +1 -0
- package/lib/typescript/context.d.ts +1 -0
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/useKeyboardState/index.d.ts +4 -0
- package/lib/typescript/index.d.ts +4 -3
- package/lib/typescript/internal.d.ts +4 -0
- package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +4 -0
- package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +6 -2
- package/lib/typescript/types.d.ts +80 -5
- package/lib/typescript/utils/findNodeHandle/index.d.ts +4 -0
- package/lib/typescript/utils/findNodeHandle/index.native.d.ts +2 -0
- package/lib/typescript/views/KeyboardExtender/index.d.ts +5 -0
- package/lib/typescript/views/index.d.ts +1 -0
- package/package.json +15 -9
- package/src/animated.tsx +41 -48
- package/src/architecture.ts +1 -0
- package/src/bindings.native.ts +37 -2
- package/src/bindings.ts +40 -1
- package/src/compat.ts +44 -0
- package/src/components/KeyboardAvoidingView/hooks.ts +24 -17
- package/src/components/KeyboardAvoidingView/index.tsx +62 -18
- package/src/components/KeyboardAwareScrollView/index.tsx +75 -20
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +2 -2
- package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
- package/src/components/KeyboardChatScrollView/index.tsx +164 -0
- package/src/components/KeyboardChatScrollView/types.ts +117 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts +268 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +260 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +374 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
- package/src/components/KeyboardChatScrollView/useEndVisible.ts +66 -0
- package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +149 -0
- package/src/components/KeyboardToolbar/Arrow.tsx +2 -2
- package/src/components/KeyboardToolbar/Button.tsx +4 -4
- package/src/components/KeyboardToolbar/compound/components/Background.tsx +9 -0
- package/src/components/KeyboardToolbar/compound/components/Content.tsx +25 -0
- package/src/components/KeyboardToolbar/compound/components/Done.tsx +57 -0
- package/src/components/KeyboardToolbar/compound/components/Next.tsx +49 -0
- package/src/components/KeyboardToolbar/compound/components/Prev.tsx +49 -0
- package/src/components/KeyboardToolbar/compound/components/index.ts +5 -0
- package/src/components/KeyboardToolbar/compound/components/types.ts +15 -0
- package/src/components/KeyboardToolbar/compound/context.ts +25 -0
- package/src/components/KeyboardToolbar/constants.ts +14 -0
- package/src/components/KeyboardToolbar/index.tsx +143 -146
- package/src/components/KeyboardToolbar/types.ts +33 -1
- package/src/components/ScrollViewWithBottomPadding/index.tsx +216 -0
- package/src/components/ScrollViewWithBottomPadding/styles.ts +10 -0
- package/src/components/hooks/useColorScheme.ts +2 -1
- package/src/components/hooks/useCombinedRef.ts +22 -0
- package/src/components/hooks/useScrollState.ts +81 -0
- package/src/components/index.ts +3 -0
- package/src/constants.ts +4 -0
- package/src/context.ts +2 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useKeyboardState/index.ts +52 -0
- package/src/index.ts +5 -1
- package/src/internal.ts +62 -0
- package/src/module.ts +21 -9
- package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +19 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +14 -3
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +1 -0
- package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
- package/src/specs/NativeKeyboardController.ts +6 -2
- package/src/types.ts +91 -5
- package/src/utils/findNodeHandle/index.native.ts +3 -0
- package/src/utils/findNodeHandle/index.ts +6 -0
- package/src/views/KeyboardExtender/index.tsx +30 -0
- package/src/views/index.ts +1 -0
- package/lib/commonjs/monkey-patch.android.js +0 -57
- package/lib/commonjs/monkey-patch.android.js.map +0 -1
- package/lib/commonjs/monkey-patch.js +0 -11
- package/lib/commonjs/monkey-patch.js.map +0 -1
- package/lib/module/monkey-patch.android.js +0 -47
- package/lib/module/monkey-patch.android.js.map +0 -1
- package/lib/module/monkey-patch.js +0 -5
- package/lib/module/monkey-patch.js.map +0 -1
- package/lib/typescript/monkey-patch.android.d.ts +0 -2
- package/lib/typescript/monkey-patch.d.ts +0 -2
- package/src/monkey-patch.android.ts +0 -44
- package/src/monkey-patch.ts +0 -4
- /package/harmony/keyboard_controller/{ts.ts → ts.ets} +0 -0
|
@@ -3,13 +3,17 @@ import { TurboModuleRegistry } from "react-native";
|
|
|
3
3
|
import type { TurboModule } from "react-native";
|
|
4
4
|
|
|
5
5
|
export interface Spec extends TurboModule {
|
|
6
|
-
readonly getConstants: () => {
|
|
6
|
+
readonly getConstants: () => {
|
|
7
|
+
keyboardBorderRadius: number;
|
|
8
|
+
};
|
|
7
9
|
|
|
8
10
|
// methods
|
|
9
11
|
setInputMode(mode: number): void;
|
|
10
12
|
setDefaultMode(): void;
|
|
11
|
-
|
|
13
|
+
preload(): void;
|
|
14
|
+
dismiss(keepFocus: boolean, animated: boolean): void;
|
|
12
15
|
setFocusTo(direction: string): void;
|
|
16
|
+
viewPositionInWindow(viewTag: number): Promise<object>;
|
|
13
17
|
|
|
14
18
|
// event emitter
|
|
15
19
|
addListener: (eventName: string) => void;
|
package/src/types.ts
CHANGED
|
@@ -6,6 +6,50 @@ import type {
|
|
|
6
6
|
ViewProps,
|
|
7
7
|
} from "react-native";
|
|
8
8
|
|
|
9
|
+
export type KeyboardProviderProps = {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Set the value to `true`, if you use translucent status bar on Android.
|
|
13
|
+
* If you already control status bar translucency via `react-native-screens`
|
|
14
|
+
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
15
|
+
* Defaults to `false`.
|
|
16
|
+
*
|
|
17
|
+
* @platform android
|
|
18
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
19
|
+
*/
|
|
20
|
+
statusBarTranslucent?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
23
|
+
* Defaults to `false`.
|
|
24
|
+
*
|
|
25
|
+
* @platform android
|
|
26
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
27
|
+
*/
|
|
28
|
+
navigationBarTranslucent?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
31
|
+
* Defaults to `false`.
|
|
32
|
+
*
|
|
33
|
+
* @platform android
|
|
34
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
35
|
+
*/
|
|
36
|
+
preserveEdgeToEdge?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
39
|
+
* (if you try to change this prop after component mount it will not have any effect).
|
|
40
|
+
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
41
|
+
* Defaults to `true`.
|
|
42
|
+
*/
|
|
43
|
+
enabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.
|
|
46
|
+
* Defaults to `true`.
|
|
47
|
+
*
|
|
48
|
+
* @platform ios
|
|
49
|
+
*/
|
|
50
|
+
preload?: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
9
53
|
// DirectEventHandler events declaration
|
|
10
54
|
export type NativeEvent = {
|
|
11
55
|
progress: number;
|
|
@@ -117,30 +161,67 @@ export type KeyboardGestureAreaProps = {
|
|
|
117
161
|
export type OverKeyboardViewProps = PropsWithChildren<{
|
|
118
162
|
visible: boolean;
|
|
119
163
|
}>;
|
|
164
|
+
export type ClippingScrollViewProps = PropsWithChildren<
|
|
165
|
+
ViewProps & {
|
|
166
|
+
/** An additional space that gets applied to the bottom of the ScrollView content. Default is 0. */
|
|
167
|
+
contentInsetBottom?: number;
|
|
168
|
+
/** An additional space that gets applied to the top of the ScrollView content. Default is 0. */
|
|
169
|
+
contentInsetTop?: number;
|
|
170
|
+
applyWorkaroundForContentInsetHitTestBug?: boolean;
|
|
171
|
+
}
|
|
172
|
+
>;
|
|
173
|
+
export type KeyboardBackgroundViewProps = PropsWithChildren<ViewProps>;
|
|
174
|
+
export type KeyboardToolbarGroupViewProps = PropsWithChildren<ViewProps>;
|
|
175
|
+
export type KeyboardExtenderProps = PropsWithChildren<{
|
|
176
|
+
/** Controls whether this `KeyboardExtender` instance should take effect. Default is `true`. */
|
|
177
|
+
enabled?: boolean;
|
|
178
|
+
}>;
|
|
120
179
|
|
|
121
180
|
export type Direction = "next" | "prev" | "current";
|
|
122
181
|
export type DismissOptions = {
|
|
123
182
|
keepFocus: boolean;
|
|
183
|
+
animated: boolean;
|
|
124
184
|
};
|
|
125
185
|
export type KeyboardControllerModule = {
|
|
126
186
|
// android only
|
|
127
187
|
setDefaultMode: () => void;
|
|
128
188
|
setInputMode: (mode: number) => void;
|
|
189
|
+
// ios only
|
|
190
|
+
preload: () => void;
|
|
129
191
|
// all platforms
|
|
130
|
-
dismiss: (options?: DismissOptions) => Promise<void>;
|
|
192
|
+
dismiss: (options?: Partial<DismissOptions>) => Promise<void>;
|
|
131
193
|
setFocusTo: (direction: Direction) => void;
|
|
132
194
|
isVisible: () => boolean;
|
|
133
|
-
state: () => KeyboardEventData
|
|
195
|
+
state: () => KeyboardEventData;
|
|
134
196
|
addListener: (eventName: string) => void;
|
|
135
197
|
removeListeners: (count: number) => void;
|
|
198
|
+
// constants
|
|
199
|
+
getConstants: () => {
|
|
200
|
+
keyboardBorderRadius: number;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
export type ViewPositionInWindowResult = {
|
|
204
|
+
x: number;
|
|
205
|
+
y: number;
|
|
206
|
+
width: number;
|
|
207
|
+
height: number;
|
|
136
208
|
};
|
|
137
209
|
export type KeyboardControllerNativeModule = {
|
|
138
210
|
// android only
|
|
139
211
|
setDefaultMode: () => void;
|
|
140
212
|
setInputMode: (mode: number) => void;
|
|
213
|
+
// ios only
|
|
214
|
+
preload: () => void;
|
|
141
215
|
// all platforms
|
|
142
|
-
dismiss: (keepFocus: boolean) => void;
|
|
216
|
+
dismiss: (keepFocus: boolean, animated: boolean) => void;
|
|
143
217
|
setFocusTo: (direction: Direction) => void;
|
|
218
|
+
viewPositionInWindow: (
|
|
219
|
+
viewTag: number,
|
|
220
|
+
) => Promise<ViewPositionInWindowResult>;
|
|
221
|
+
// constants
|
|
222
|
+
getConstants: () => {
|
|
223
|
+
keyboardBorderRadius: number;
|
|
224
|
+
};
|
|
144
225
|
// native event module stuff
|
|
145
226
|
addListener: (eventName: string) => void;
|
|
146
227
|
removeListeners: (count: number) => void;
|
|
@@ -159,15 +240,20 @@ export type KeyboardEventData = {
|
|
|
159
240
|
timestamp: number;
|
|
160
241
|
target: number;
|
|
161
242
|
type: NonNullable<TextInputProps["keyboardType"]>;
|
|
162
|
-
appearance:
|
|
243
|
+
appearance: "dark" | "light";
|
|
163
244
|
};
|
|
245
|
+
export type IKeyboardState = {
|
|
246
|
+
isVisible: boolean;
|
|
247
|
+
} & KeyboardEventData;
|
|
164
248
|
export type KeyboardEventsModule = {
|
|
165
249
|
addListener: (
|
|
166
250
|
name: KeyboardControllerEvents,
|
|
167
251
|
cb: (e: KeyboardEventData) => void,
|
|
168
252
|
) => EmitterSubscription;
|
|
169
253
|
};
|
|
170
|
-
export type FocusedInputAvailableEvents =
|
|
254
|
+
export type FocusedInputAvailableEvents =
|
|
255
|
+
| "focusDidSet"
|
|
256
|
+
| "layoutDidSynchronize";
|
|
171
257
|
export type FocusedInputEventData = {
|
|
172
258
|
current: number;
|
|
173
259
|
count: number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { KeyboardBackgroundView } from "../../bindings";
|
|
5
|
+
import { KeyboardStickyView } from "../../components";
|
|
6
|
+
import { useKeyboardAnimation } from "../../hooks";
|
|
7
|
+
|
|
8
|
+
import type { KeyboardExtenderProps } from "../../types";
|
|
9
|
+
import type { PropsWithChildren } from "react";
|
|
10
|
+
|
|
11
|
+
const AnimatedKeyboardBackgroundView = Animated.createAnimatedComponent(
|
|
12
|
+
KeyboardBackgroundView,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const KeyboardExtender = ({
|
|
16
|
+
children,
|
|
17
|
+
enabled = true,
|
|
18
|
+
}: PropsWithChildren<KeyboardExtenderProps>) => {
|
|
19
|
+
const { progress } = useKeyboardAnimation();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<KeyboardStickyView enabled={enabled}>
|
|
23
|
+
<AnimatedKeyboardBackgroundView style={{ opacity: progress }}>
|
|
24
|
+
{children}
|
|
25
|
+
</AnimatedKeyboardBackgroundView>
|
|
26
|
+
</KeyboardStickyView>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default KeyboardExtender;
|
package/src/views/index.ts
CHANGED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.revertMonkeyPatch = exports.applyMonkeyPatch = void 0;
|
|
7
|
-
var NativeAndroidManager = _interopRequireWildcard(require("react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid"));
|
|
8
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
-
// @ts-expect-error because there is no corresponding type definition
|
|
10
|
-
|
|
11
|
-
const RCTStatusBarManagerCompat =
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
-
require("./specs/NativeStatusBarManagerCompat").default;
|
|
14
|
-
|
|
15
|
-
// Copy original default manager to keep its original state and methods
|
|
16
|
-
const OriginalNativeAndroidManager = {
|
|
17
|
-
...NativeAndroidManager.default
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Create a new object that modifies the necessary methods
|
|
21
|
-
// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
|
|
22
|
-
// in order to use library on all available platforms we have to monkey patch
|
|
23
|
-
// default RN implementation and use modern `WindowInsetsControllerCompat`.
|
|
24
|
-
const ModifiedNativeAndroidManager = {
|
|
25
|
-
...NativeAndroidManager.default,
|
|
26
|
-
// Spread original properties to keep existing functionality
|
|
27
|
-
setColor: (color, animated) => {
|
|
28
|
-
RCTStatusBarManagerCompat.setColor(color, animated);
|
|
29
|
-
},
|
|
30
|
-
setTranslucent: translucent => {
|
|
31
|
-
RCTStatusBarManagerCompat.setTranslucent(translucent);
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* - statusBarStyles can be:
|
|
35
|
-
* - 'default'
|
|
36
|
-
* - 'dark-content'
|
|
37
|
-
*/
|
|
38
|
-
setStyle: statusBarStyle => {
|
|
39
|
-
RCTStatusBarManagerCompat.setStyle(statusBarStyle);
|
|
40
|
-
},
|
|
41
|
-
setHidden: hidden => {
|
|
42
|
-
RCTStatusBarManagerCompat.setHidden(hidden);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// Define a function to apply the monkey patch
|
|
47
|
-
const applyMonkeyPatch = () => {
|
|
48
|
-
Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// Define a function to revert changes back to the original state
|
|
52
|
-
exports.applyMonkeyPatch = applyMonkeyPatch;
|
|
53
|
-
const revertMonkeyPatch = () => {
|
|
54
|
-
Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);
|
|
55
|
-
};
|
|
56
|
-
exports.revertMonkeyPatch = revertMonkeyPatch;
|
|
57
|
-
//# sourceMappingURL=monkey-patch.android.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAndroidManager","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RCTStatusBarManagerCompat","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","assign","exports","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\n\nconst RCTStatusBarManagerCompat =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"./specs/NativeStatusBarManagerCompat\").default;\n\n// Copy original default manager to keep its original state and methods\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\n\n// Create a new object that modifies the necessary methods\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nconst ModifiedNativeAndroidManager = {\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\n setColor: (color: number, animated: boolean): void => {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n setTranslucent: (translucent: boolean): void => {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n /**\n * - statusBarStyles can be:\n * - 'default'\n * - 'dark-content'\n */\n setStyle: (statusBarStyle?: string): void => {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n setHidden: (hidden: boolean): void => {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n};\n\n// Define a function to apply the monkey patch\nexport const applyMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);\n};\n\n// Define a function to revert changes back to the original state\nexport const revertMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);\n};\n"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAkH,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,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;AADlH;;AAGA,MAAMkB,yBAAyB;AAC7B;AACApB,OAAO,CAAC,sCAAsC,CAAC,CAACW,OAAO;;AAEzD;AACA,MAAMU,4BAA4B,GAAG;EAAE,GAAGvB,oBAAoB,CAACa;AAAQ,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAMW,4BAA4B,GAAG;EACnC,GAAGxB,oBAAoB,CAACa,OAAO;EAAE;EACjCY,QAAQ,EAAEA,CAACC,KAAa,EAAEC,QAAiB,KAAW;IACpDL,yBAAyB,CAACG,QAAQ,CAACC,KAAK,EAAEC,QAAQ,CAAC;EACrD,CAAC;EACDC,cAAc,EAAGC,WAAoB,IAAW;IAC9CP,yBAAyB,CAACM,cAAc,CAACC,WAAW,CAAC;EACvD,CAAC;EACD;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAGC,cAAuB,IAAW;IAC3CT,yBAAyB,CAACQ,QAAQ,CAACC,cAAc,CAAC;EACpD,CAAC;EACDC,SAAS,EAAGC,MAAe,IAAW;IACpCX,yBAAyB,CAACU,SAAS,CAACC,MAAM,CAAC;EAC7C;AACF,CAAC;;AAED;AACO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpCf,MAAM,CAACgB,MAAM,CAACnC,oBAAoB,CAACa,OAAO,EAAEW,4BAA4B,CAAC;AAC3E,CAAC;;AAED;AAAAY,OAAA,CAAAF,gBAAA,GAAAA,gBAAA;AACO,MAAMG,iBAAiB,GAAGA,CAAA,KAAM;EACrClB,MAAM,CAACgB,MAAM,CAACnC,oBAAoB,CAACa,OAAO,EAAEU,4BAA4B,CAAC;AAC3E,CAAC;AAACa,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.revertMonkeyPatch = exports.applyMonkeyPatch = void 0;
|
|
7
|
-
// stub for all platforms
|
|
8
|
-
const NOOP = () => {};
|
|
9
|
-
const applyMonkeyPatch = exports.applyMonkeyPatch = NOOP;
|
|
10
|
-
const revertMonkeyPatch = exports.revertMonkeyPatch = NOOP;
|
|
11
|
-
//# sourceMappingURL=monkey-patch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NOOP","applyMonkeyPatch","exports","revertMonkeyPatch"],"sources":["monkey-patch.ts"],"sourcesContent":["// stub for all platforms\nconst NOOP = () => {};\nexport const applyMonkeyPatch = NOOP;\nexport const revertMonkeyPatch = NOOP;\n"],"mappings":";;;;;;AAAA;AACA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACd,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGD,IAAI;AAC7B,MAAMG,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAGH,IAAI","ignoreList":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error because there is no corresponding type definition
|
|
2
|
-
import * as NativeAndroidManager from "react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid";
|
|
3
|
-
const RCTStatusBarManagerCompat =
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
-
require("./specs/NativeStatusBarManagerCompat").default;
|
|
6
|
-
|
|
7
|
-
// Copy original default manager to keep its original state and methods
|
|
8
|
-
const OriginalNativeAndroidManager = {
|
|
9
|
-
...NativeAndroidManager.default
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// Create a new object that modifies the necessary methods
|
|
13
|
-
// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
|
|
14
|
-
// in order to use library on all available platforms we have to monkey patch
|
|
15
|
-
// default RN implementation and use modern `WindowInsetsControllerCompat`.
|
|
16
|
-
const ModifiedNativeAndroidManager = {
|
|
17
|
-
...NativeAndroidManager.default,
|
|
18
|
-
// Spread original properties to keep existing functionality
|
|
19
|
-
setColor: (color, animated) => {
|
|
20
|
-
RCTStatusBarManagerCompat.setColor(color, animated);
|
|
21
|
-
},
|
|
22
|
-
setTranslucent: translucent => {
|
|
23
|
-
RCTStatusBarManagerCompat.setTranslucent(translucent);
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* - statusBarStyles can be:
|
|
27
|
-
* - 'default'
|
|
28
|
-
* - 'dark-content'
|
|
29
|
-
*/
|
|
30
|
-
setStyle: statusBarStyle => {
|
|
31
|
-
RCTStatusBarManagerCompat.setStyle(statusBarStyle);
|
|
32
|
-
},
|
|
33
|
-
setHidden: hidden => {
|
|
34
|
-
RCTStatusBarManagerCompat.setHidden(hidden);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// Define a function to apply the monkey patch
|
|
39
|
-
export const applyMonkeyPatch = () => {
|
|
40
|
-
Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Define a function to revert changes back to the original state
|
|
44
|
-
export const revertMonkeyPatch = () => {
|
|
45
|
-
Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=monkey-patch.android.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAndroidManager","RCTStatusBarManagerCompat","require","default","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","Object","assign","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\n\nconst RCTStatusBarManagerCompat =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"./specs/NativeStatusBarManagerCompat\").default;\n\n// Copy original default manager to keep its original state and methods\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\n\n// Create a new object that modifies the necessary methods\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nconst ModifiedNativeAndroidManager = {\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\n setColor: (color: number, animated: boolean): void => {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n setTranslucent: (translucent: boolean): void => {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n /**\n * - statusBarStyles can be:\n * - 'default'\n * - 'dark-content'\n */\n setStyle: (statusBarStyle?: string): void => {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n setHidden: (hidden: boolean): void => {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n};\n\n// Define a function to apply the monkey patch\nexport const applyMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);\n};\n\n// Define a function to revert changes back to the original state\nexport const revertMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);\n};\n"],"mappings":"AAAA;AACA,OAAO,KAAKA,oBAAoB,MAAM,2EAA2E;AAEjH,MAAMC,yBAAyB;AAC7B;AACAC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;;AAEzD;AACA,MAAMC,4BAA4B,GAAG;EAAE,GAAGJ,oBAAoB,CAACG;AAAQ,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAME,4BAA4B,GAAG;EACnC,GAAGL,oBAAoB,CAACG,OAAO;EAAE;EACjCG,QAAQ,EAAEA,CAACC,KAAa,EAAEC,QAAiB,KAAW;IACpDP,yBAAyB,CAACK,QAAQ,CAACC,KAAK,EAAEC,QAAQ,CAAC;EACrD,CAAC;EACDC,cAAc,EAAGC,WAAoB,IAAW;IAC9CT,yBAAyB,CAACQ,cAAc,CAACC,WAAW,CAAC;EACvD,CAAC;EACD;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAGC,cAAuB,IAAW;IAC3CX,yBAAyB,CAACU,QAAQ,CAACC,cAAc,CAAC;EACpD,CAAC;EACDC,SAAS,EAAGC,MAAe,IAAW;IACpCb,yBAAyB,CAACY,SAAS,CAACC,MAAM,CAAC;EAC7C;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpCC,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEE,4BAA4B,CAAC;AAC3E,CAAC;;AAED;AACA,OAAO,MAAMa,iBAAiB,GAAGA,CAAA,KAAM;EACrCF,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEC,4BAA4B,CAAC;AAC3E,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NOOP","applyMonkeyPatch","revertMonkeyPatch"],"sources":["monkey-patch.ts"],"sourcesContent":["// stub for all platforms\nconst NOOP = () => {};\nexport const applyMonkeyPatch = NOOP;\nexport const revertMonkeyPatch = NOOP;\n"],"mappings":"AAAA;AACA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,OAAO,MAAMC,gBAAgB,GAAGD,IAAI;AACpC,OAAO,MAAME,iBAAiB,GAAGF,IAAI","ignoreList":[]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error because there is no corresponding type definition
|
|
2
|
-
import * as NativeAndroidManager from "react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid";
|
|
3
|
-
|
|
4
|
-
const RCTStatusBarManagerCompat =
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
6
|
-
require("./specs/NativeStatusBarManagerCompat").default;
|
|
7
|
-
|
|
8
|
-
// Copy original default manager to keep its original state and methods
|
|
9
|
-
const OriginalNativeAndroidManager = { ...NativeAndroidManager.default };
|
|
10
|
-
|
|
11
|
-
// Create a new object that modifies the necessary methods
|
|
12
|
-
// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
|
|
13
|
-
// in order to use library on all available platforms we have to monkey patch
|
|
14
|
-
// default RN implementation and use modern `WindowInsetsControllerCompat`.
|
|
15
|
-
const ModifiedNativeAndroidManager = {
|
|
16
|
-
...NativeAndroidManager.default, // Spread original properties to keep existing functionality
|
|
17
|
-
setColor: (color: number, animated: boolean): void => {
|
|
18
|
-
RCTStatusBarManagerCompat.setColor(color, animated);
|
|
19
|
-
},
|
|
20
|
-
setTranslucent: (translucent: boolean): void => {
|
|
21
|
-
RCTStatusBarManagerCompat.setTranslucent(translucent);
|
|
22
|
-
},
|
|
23
|
-
/**
|
|
24
|
-
* - statusBarStyles can be:
|
|
25
|
-
* - 'default'
|
|
26
|
-
* - 'dark-content'
|
|
27
|
-
*/
|
|
28
|
-
setStyle: (statusBarStyle?: string): void => {
|
|
29
|
-
RCTStatusBarManagerCompat.setStyle(statusBarStyle);
|
|
30
|
-
},
|
|
31
|
-
setHidden: (hidden: boolean): void => {
|
|
32
|
-
RCTStatusBarManagerCompat.setHidden(hidden);
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// Define a function to apply the monkey patch
|
|
37
|
-
export const applyMonkeyPatch = () => {
|
|
38
|
-
Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Define a function to revert changes back to the original state
|
|
42
|
-
export const revertMonkeyPatch = () => {
|
|
43
|
-
Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);
|
|
44
|
-
};
|
package/src/monkey-patch.ts
DELETED
|
File without changes
|