react-native-keyboard-controller 1.21.0-beta.2 → 1.21.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.md +1 -0
- package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +1 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +14 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +8 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardToolbarGroupViewManager.kt +23 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ReactContext.kt +12 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/FocusedInputObserver.kt +2 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/WindowDimensionListener.kt +5 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardToolbarGroupViewManagerImpl.kt +13 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt +4 -6
- package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +26 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/traversal/ViewHierarchyNavigator.kt +31 -4
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +33 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/KeyboardToolbarGroupReactViewGroup.kt +13 -0
- package/android/src/main/jni/RNKC.h +2 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/ClippingScrollViewDecoratorViewManager.kt +16 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +9 -0
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardToolbarGroupViewManager.kt +15 -0
- package/android/src/turbo/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +2 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewComponentDescriptor.h +27 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewShadowNode.cpp +14 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewShadowNode.h +30 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCClippingScrollViewDecoratorViewState.h +28 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewComponentDescriptor.h +20 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewShadowNode.cpp +7 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewShadowNode.h +23 -0
- package/common/cpp/react/renderer/components/RNKC/RNKCKeyboardToolbarGroupViewState.h +21 -0
- package/ios/KeyboardControllerModule.mm +36 -0
- package/ios/animations/KeyboardAnimation.swift +2 -2
- package/ios/animations/SpringAnimation.swift +1 -1
- package/ios/animations/TimingAnimation.swift +1 -3
- package/ios/delegates/KCTextInputCompositeDelegate.swift +2 -2
- package/ios/extensions/CGFloat.swift +1 -3
- package/ios/extensions/UIApplication.swift +1 -1
- package/ios/interactive/KeyboardAreaExtender.swift +2 -1
- package/ios/observers/FocusedInputObserver.swift +6 -3
- package/ios/observers/movement/KeyboardTrackingView.swift +4 -1
- package/ios/observers/movement/observer/KeyboardMovementObserver+Interactive.swift +2 -0
- package/ios/observers/movement/observer/KeyboardMovementObserver+Listeners.swift +30 -7
- package/ios/observers/movement/observer/KeyboardMovementObserver.swift +2 -48
- package/ios/protocols/TextInput.swift +1 -1
- package/ios/swizzling/UIResponderSwizzle.swift +2 -4
- package/ios/traversal/FocusedInputHolder.swift +3 -3
- package/ios/traversal/KeyboardView.swift +1 -1
- package/ios/traversal/ViewHierarchyNavigator.swift +51 -5
- package/ios/views/ClippingScrollViewDecoratorViewManager.h +26 -0
- package/ios/views/ClippingScrollViewDecoratorViewManager.mm +231 -0
- package/ios/views/KeyboardControllerViewManager.swift +5 -5
- package/ios/views/KeyboardToolbarGroupViewManager.h +28 -0
- package/ios/views/KeyboardToolbarGroupViewManager.mm +88 -0
- package/jest/index.js +12 -4
- package/lib/commonjs/bindings.js +18 -2
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +3 -4
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +30 -4
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +55 -14
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardChatScrollView/index.js +111 -0
- package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -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/useExtraContentPadding/index.js +72 -0
- package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js +3 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +1 -0
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +36 -15
- package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/commonjs/components/hooks/useScrollState.js +20 -1
- package/lib/commonjs/components/hooks/useScrollState.js.map +1 -1
- package/lib/commonjs/components/index.js +7 -7
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.js +1 -2
- package/lib/commonjs/specs/ClippingScrollViewDecoratorViewNativeComponent.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/module.js.map +1 -1
- package/lib/commonjs/types/views.js.map +1 -1
- package/lib/module/bindings.js +17 -1
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +2 -3
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +29 -4
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +55 -14
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/{ChatKit → KeyboardChatScrollView}/hooks.js.map +1 -1
- package/lib/module/components/KeyboardChatScrollView/index.js +104 -0
- package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -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/useExtraContentPadding/index.js +67 -0
- package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -0
- package/lib/module/components/KeyboardStickyView/index.js +3 -1
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +2 -1
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/ScrollViewWithBottomPadding/index.js +38 -17
- package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
- package/lib/module/components/hooks/useScrollState.js +21 -2
- package/lib/module/components/hooks/useScrollState.js.map +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.js +1 -2
- package/lib/module/specs/ClippingScrollViewDecoratorViewNativeComponent.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/module.js.map +1 -1
- package/lib/module/types/views.js.map +1 -1
- package/lib/typescript/bindings.d.ts +12 -2
- package/lib/typescript/bindings.native.d.ts +2 -1
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +44 -13
- package/lib/typescript/components/KeyboardChatScrollView/hooks.d.ts +2 -0
- package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +15 -0
- package/lib/typescript/components/{ChatKit → KeyboardChatScrollView}/types.d.ts +46 -6
- 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/useExtraContentPadding/index.d.ts +43 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +2 -0
- package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +5 -4
- package/lib/typescript/components/hooks/useScrollState.d.ts +3 -0
- package/lib/typescript/components/index.d.ts +2 -2
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/specs/ClippingScrollViewDecoratorViewNativeComponent.d.ts +2 -0
- package/lib/typescript/specs/KeyboardToolbarGroupViewNativeComponent.d.ts +6 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
- package/lib/typescript/types/module.d.ts +7 -0
- package/lib/typescript/types/views.d.ts +4 -0
- package/package.json +6 -2
- package/react-native.config.js +2 -0
- package/src/bindings.native.ts +4 -4
- package/src/bindings.ts +15 -1
- package/src/components/KeyboardAvoidingView/index.tsx +56 -29
- package/src/components/KeyboardAwareScrollView/index.tsx +68 -13
- package/src/components/KeyboardChatScrollView/hooks.ts +2 -0
- package/src/components/KeyboardChatScrollView/index.tsx +150 -0
- package/src/components/{ChatKit → KeyboardChatScrollView}/types.ts +46 -6
- 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 +376 -0
- package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +39 -0
- package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +123 -0
- package/src/components/KeyboardStickyView/index.tsx +4 -3
- package/src/components/KeyboardToolbar/index.tsx +6 -1
- package/src/components/ScrollViewWithBottomPadding/index.tsx +53 -29
- package/src/components/hooks/useScrollState.ts +24 -2
- package/src/components/index.ts +2 -2
- package/src/index.ts +2 -2
- package/src/specs/ClippingScrollViewDecoratorViewNativeComponent.ts +2 -1
- package/src/specs/KeyboardToolbarGroupViewNativeComponent.ts +10 -0
- package/src/specs/NativeKeyboardController.ts +1 -0
- package/src/types/module.ts +9 -0
- package/src/types/views.ts +4 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -2
- package/ios/KeyboardController.xcodeproj/xcuserdata/kirylziusko.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/ios/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/Tests/Tests.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/kirylziusko.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Tests/Tests.xcodeproj/xcuserdata/kirylziusko.xcuserdatad/xcschemes/xcschememanagement.plist +0 -32
- package/lib/commonjs/components/ChatKit/TODO.md +0 -20
- package/lib/commonjs/components/ChatKit/index.js +0 -55
- package/lib/commonjs/components/ChatKit/index.js.map +0 -1
- package/lib/commonjs/components/ChatKit/types.js.map +0 -1
- package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js +0 -101
- package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js.map +0 -1
- package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js +0 -147
- package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js.map +0 -1
- package/lib/module/components/ChatKit/TODO.md +0 -20
- package/lib/module/components/ChatKit/index.js +0 -48
- package/lib/module/components/ChatKit/index.js.map +0 -1
- package/lib/module/components/ChatKit/types.js.map +0 -1
- package/lib/module/components/ChatKit/useChatKeyboard/helpers.js +0 -92
- package/lib/module/components/ChatKit/useChatKeyboard/helpers.js.map +0 -1
- package/lib/module/components/ChatKit/useChatKeyboard/index.js +0 -141
- package/lib/module/components/ChatKit/useChatKeyboard/index.js.map +0 -1
- package/lib/typescript/components/ChatKit/hooks.d.ts +0 -2
- package/lib/typescript/components/ChatKit/index.d.ts +0 -14
- package/lib/typescript/components/ChatKit/useChatKeyboard/helpers.d.ts +0 -57
- package/lib/typescript/components/ChatKit/useChatKeyboard/index.d.ts +0 -36
- package/src/components/ChatKit/TODO.md +0 -20
- package/src/components/ChatKit/hooks.ts +0 -2
- package/src/components/ChatKit/index.tsx +0 -63
- package/src/components/ChatKit/useChatKeyboard/helpers.ts +0 -118
- package/src/components/ChatKit/useChatKeyboard/index.ts +0 -228
- /package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/hooks.js +0 -0
- /package/lib/commonjs/components/{ChatKit → KeyboardChatScrollView}/types.js +0 -0
- /package/lib/module/components/{ChatKit → KeyboardChatScrollView}/hooks.js +0 -0
- /package/lib/module/components/{ChatKit → KeyboardChatScrollView}/types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeReanimated","require","_hooks","_useScrollState","_interopRequireDefault","_helpers","e","__esModule","default","useChatKeyboard","scrollViewRef","options","inverted","keyboardLiftBehavior","freeze","offset","blankSpace","extraContentPadding","padding","useSharedValue","currentHeight","offsetBeforeScroll","targetKeyboardHeight","closing","minimumPaddingFractionOnOpen","actualOpenShift","layout","size","scroll","onLayout","onContentSizeChange","useScrollState","clampScrollIfNeeded","effective","totalPaddingForMaxScroll","paddingForMax","undefined","maxScroll","Math","max","value","height","scrollTo","useKeyboardHandler","onStart","getEffectiveHeight","atEnd","isScrollAtEnd","visibleFraction","getVisibleMinimumPaddingFraction","minimumPaddingAbsorbed","getMinimumPaddingAbsorbed","scrollEffective","getScrollEffective","duration","onMove","actualTotalPadding","wasAtEnd","shouldShiftContent","currentShift","target","keepAt","min","clampedScrollTarget","onEnd","contentOffsetY"],"sources":["index.ts"],"sourcesContent":["import { scrollTo, useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"../../../hooks\";\nimport useScrollState from \"../../hooks/useScrollState\";\n\nimport {\n clampedScrollTarget,\n getEffectiveHeight,\n getMinimumPaddingAbsorbed,\n getScrollEffective,\n getVisibleMinimumPaddingFraction,\n isScrollAtEnd,\n shouldShiftContent,\n} from \"./helpers\";\n\nimport type { UseChatKeyboardOptions, UseChatKeyboardReturn } from \"./types\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\n/**\n * Hook that manages keyboard-driven scrolling for chat-style scroll views.\n * Calculates padding (extra scrollable space) and content shift values,\n * using per-frame scrollTo updates (Android and other platforms).\n *\n * @param scrollViewRef - Animated ref to the scroll view.\n * @param options - Configuration for inverted and keyboardLiftBehavior.\n * @returns Shared values for padding and contentOffsetY (always `undefined`).\n * @example\n * ```tsx\n * const { padding } = useChatKeyboard(ref, { inverted: false, keyboardLiftBehavior: \"always\" });\n * ```\n */\nfunction useChatKeyboard(\n scrollViewRef: AnimatedRef<Reanimated.ScrollView>,\n options: UseChatKeyboardOptions,\n): UseChatKeyboardReturn {\n const {\n inverted,\n keyboardLiftBehavior,\n freeze,\n offset,\n blankSpace,\n extraContentPadding,\n } = options;\n\n const padding = useSharedValue(0);\n const currentHeight = useSharedValue(0);\n const offsetBeforeScroll = useSharedValue(0);\n const targetKeyboardHeight = useSharedValue(0);\n const closing = useSharedValue(false);\n const minimumPaddingFractionOnOpen = useSharedValue(0);\n const actualOpenShift = useSharedValue(0);\n const {\n layout,\n size,\n offset: scroll,\n onLayout,\n onContentSizeChange,\n } = useScrollState(scrollViewRef);\n const clampScrollIfNeeded = (\n effective: number,\n totalPaddingForMaxScroll?: number,\n ) => {\n \"worklet\";\n\n const paddingForMax =\n totalPaddingForMaxScroll !== undefined\n ? totalPaddingForMaxScroll\n : effective;\n const maxScroll = Math.max(\n size.value.height - layout.value.height + paddingForMax,\n 0,\n );\n\n if (scroll.value > maxScroll) {\n scrollTo(scrollViewRef, 0, maxScroll, false);\n }\n };\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n if (e.height > 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n targetKeyboardHeight.value = e.height;\n closing.value = false;\n } else {\n closing.value = true;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n const atEnd = isScrollAtEnd(\n scroll.value,\n layout.value.height,\n size.value.height,\n inverted,\n );\n\n // Scale minimum padding absorption by how much of it is visible.\n // Fully visible → full absorption; fully off-screen → no absorption.\n const visibleFraction = getVisibleMinimumPaddingFraction(\n scroll.value,\n layout.value.height,\n size.value.height,\n blankSpace.value,\n inverted,\n );\n const minimumPaddingAbsorbed =\n visibleFraction >= 1\n ? getMinimumPaddingAbsorbed(\n blankSpace.value,\n extraContentPadding.value,\n )\n : 0;\n const scrollEffective = getScrollEffective(\n effective,\n minimumPaddingAbsorbed,\n );\n\n if (inverted && e.duration === -1) {\n // Android inverted: skip post-interactive snap-back events\n // (duration === -1 means the keyboard is re-establishing its\n // position after an interactive gesture, not a real animation)\n return;\n } else if (e.height > 0) {\n // Android: keyboard opening — set padding + capture scroll position\n minimumPaddingFractionOnOpen.value = visibleFraction >= 1 ? 1 : 0;\n padding.value = effective;\n offsetBeforeScroll.value = scroll.value;\n\n if (!inverted && keyboardLiftBehavior === \"whenAtEnd\" && !atEnd) {\n // Sentinel: don't scroll in onMove (non-inverted only)\n offsetBeforeScroll.value = -1;\n } else if (!inverted && scrollEffective === 0) {\n // blankSpace fully absorbs the keyboard — prevent scroll\n offsetBeforeScroll.value = -1;\n } else if (inverted && scrollEffective === 0) {\n // blankSpace fully absorbs the keyboard — guard for inverted\n offsetBeforeScroll.value = scroll.value;\n }\n } else {\n // Android: keyboard closing — re-capture scroll position\n if (inverted) {\n offsetBeforeScroll.value = scroll.value;\n } else {\n // Preserve \"whenAtEnd\" sentinel: if open didn't shift, close shouldn't either\n if (offsetBeforeScroll.value !== -1) {\n // Use the actual displacement recorded at end of open animation\n // (not the theoretical value) so close is symmetric with open\n offsetBeforeScroll.value = scroll.value - actualOpenShift.value;\n }\n }\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n currentHeight.value = e.height;\n\n if (inverted) {\n // Skip post-interactive snap-back (duration === -1)\n if (e.duration === -1) {\n return;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n const minimumPaddingAbsorbed =\n getMinimumPaddingAbsorbed(\n blankSpace.value,\n extraContentPadding.value,\n ) * minimumPaddingFractionOnOpen.value;\n const scrollEffective = getScrollEffective(\n effective,\n minimumPaddingAbsorbed,\n );\n const actualTotalPadding = Math.max(\n blankSpace.value,\n effective + extraContentPadding.value,\n );\n\n // Check if we should shift content based on position when keyboard started\n const wasAtEnd = isScrollAtEnd(\n offsetBeforeScroll.value,\n layout.value.height,\n size.value.height,\n inverted,\n );\n\n // \"never\" at end: scroll along when keyboard closes to avoid jump\n if (\n keyboardLiftBehavior === \"never\" &&\n wasAtEnd &&\n effective < padding.value\n ) {\n padding.value = effective;\n\n if (scrollEffective === 0 && minimumPaddingAbsorbed > 0) {\n return;\n }\n\n scrollTo(scrollViewRef, 0, 0, false);\n\n return;\n }\n\n if (!shouldShiftContent(keyboardLiftBehavior, wasAtEnd)) {\n // Closing, not shifting: reduce padding to avoid gap\n if (closing.value && effective < padding.value) {\n padding.value = effective;\n clampScrollIfNeeded(effective, actualTotalPadding);\n }\n\n return;\n }\n\n // When blankSpace fully absorbs the keyboard, skip scroll\n if (scrollEffective === 0 && minimumPaddingAbsorbed > 0) {\n return;\n }\n\n // Persistent: don't let shift decrease\n if (keyboardLiftBehavior === \"persistent\") {\n const currentShift =\n offsetBeforeScroll.value + padding.value - scroll.value;\n\n if (effective < currentShift) {\n // When at end, allow scrolling back (snap to end + reduce padding)\n if (wasAtEnd) {\n padding.value = effective;\n scrollTo(scrollViewRef, 0, 0, false);\n } else if (closing.value) {\n // Not at end: reduce padding to avoid gap\n padding.value = effective;\n clampScrollIfNeeded(effective, actualTotalPadding);\n }\n\n return;\n }\n }\n\n const target =\n offsetBeforeScroll.value + padding.value - scrollEffective;\n\n scrollTo(scrollViewRef, 0, target, false);\n } else {\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n const minimumPaddingAbsorbed =\n getMinimumPaddingAbsorbed(\n blankSpace.value,\n extraContentPadding.value,\n ) * minimumPaddingFractionOnOpen.value;\n const scrollEffective = getScrollEffective(\n effective,\n minimumPaddingAbsorbed,\n );\n const actualTotalPadding = Math.max(\n blankSpace.value,\n effective + extraContentPadding.value,\n );\n\n // \"never\" closing: clamp scroll to valid range as inset shrinks\n if (\n keyboardLiftBehavior === \"never\" &&\n closing.value &&\n effective < padding.value\n ) {\n clampScrollIfNeeded(effective, actualTotalPadding);\n\n return;\n }\n\n if (!shouldShiftContent(keyboardLiftBehavior, true)) {\n return;\n }\n\n // \"whenAtEnd\" sentinel check (also used for blankSpace full absorption)\n if (offsetBeforeScroll.value === -1) {\n if (closing.value) {\n // Keyboard didn't shift on open; ensure valid position on close\n clampScrollIfNeeded(effective, actualTotalPadding);\n }\n\n return;\n }\n\n // \"persistent\" closing: maintain position, clamped to valid range\n if (keyboardLiftBehavior === \"persistent\" && closing.value) {\n const keepAt = offsetBeforeScroll.value + padding.value;\n const maxScroll = Math.max(\n size.value.height - layout.value.height + actualTotalPadding,\n 0,\n );\n\n scrollTo(scrollViewRef, 0, Math.min(keepAt, maxScroll), false);\n\n return;\n }\n\n const target = clampedScrollTarget(\n offsetBeforeScroll.value,\n scrollEffective,\n size.value.height,\n layout.value.height,\n actualTotalPadding,\n );\n\n scrollTo(scrollViewRef, 0, target, false);\n\n // Track actual (clamped) displacement during open for symmetric close\n if (!closing.value) {\n actualOpenShift.value = target - offsetBeforeScroll.value;\n }\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n const effective = getEffectiveHeight(\n e.height,\n targetKeyboardHeight.value,\n offset,\n );\n\n padding.value = effective;\n\n // Record actual scroll displacement so close can be symmetric\n if (effective > 0 && offsetBeforeScroll.value !== -1) {\n actualOpenShift.value = scroll.value - offsetBeforeScroll.value;\n }\n },\n },\n [inverted, keyboardLiftBehavior, freeze, offset],\n );\n\n return {\n padding,\n currentHeight,\n contentOffsetY: undefined,\n scroll,\n layout,\n size,\n onLayout,\n onContentSizeChange,\n };\n}\n\nexport { useChatKeyboard };\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAQmB,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,eAAeA,CACtBC,aAAiD,EACjDC,OAA+B,EACR;EACvB,MAAM;IACJC,QAAQ;IACRC,oBAAoB;IACpBC,MAAM;IACNC,MAAM;IACNC,UAAU;IACVC;EACF,CAAC,GAAGN,OAAO;EAEX,MAAMO,OAAO,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EACjC,MAAMC,aAAa,GAAG,IAAAD,qCAAc,EAAC,CAAC,CAAC;EACvC,MAAME,kBAAkB,GAAG,IAAAF,qCAAc,EAAC,CAAC,CAAC;EAC5C,MAAMG,oBAAoB,GAAG,IAAAH,qCAAc,EAAC,CAAC,CAAC;EAC9C,MAAMI,OAAO,GAAG,IAAAJ,qCAAc,EAAC,KAAK,CAAC;EACrC,MAAMK,4BAA4B,GAAG,IAAAL,qCAAc,EAAC,CAAC,CAAC;EACtD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,IAAI,CAACwB,GAAG,CAACD,MAAM,EAAExB,SAAS,CAAC,EAAE,KAAK,CAAC;UAE9D;QACF;QAEA,MAAMuB,MAAM,GAAG,IAAAG,4BAAmB,EAChC1C,kBAAkB,CAACmB,KAAK,EACxBY,eAAe,EACfzB,IAAI,CAACa,KAAK,CAACC,MAAM,EACjBf,MAAM,CAACc,KAAK,CAACC,MAAM,EACnBe,kBACF,CAAC;QAED,IAAAd,+BAAQ,EAAChC,aAAa,EAAE,CAAC,EAAEkD,MAAM,EAAE,KAAK,CAAC;;QAEzC;QACA,IAAI,CAACrC,OAAO,CAACiB,KAAK,EAAE;UAClBf,eAAe,CAACe,KAAK,GAAGoB,MAAM,GAAGvC,kBAAkB,CAACmB,KAAK;QAC3D;MACF;IACF,CAAC;IACDwB,KAAK,EAAG1D,CAAC,IAAK;MACZ,SAAS;;MAET,IAAIQ,MAAM,EAAE;QACV;MACF;MAEA,MAAMmB,SAAS,GAAG,IAAAY,2BAAkB,EAClCvC,CAAC,CAACmC,MAAM,EACRnB,oBAAoB,CAACkB,KAAK,EAC1BzB,MACF,CAAC;MAEDG,OAAO,CAACsB,KAAK,GAAGP,SAAS;;MAEzB;MACA,IAAIA,SAAS,GAAG,CAAC,IAAIZ,kBAAkB,CAACmB,KAAK,KAAK,CAAC,CAAC,EAAE;QACpDf,eAAe,CAACe,KAAK,GAAGZ,MAAM,CAACY,KAAK,GAAGnB,kBAAkB,CAACmB,KAAK;MACjE;IACF;EACF,CAAC,EACD,CAAC5B,QAAQ,EAAEC,oBAAoB,EAAEC,MAAM,EAAEC,MAAM,CACjD,CAAC;EAED,OAAO;IACLG,OAAO;IACPE,aAAa;IACb6C,cAAc,EAAE7B,SAAS;IACzBR,MAAM;IACNF,MAAM;IACNC,IAAI;IACJE,QAAQ;IACRC;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { LayoutChangeEvent } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\ntype KeyboardLiftBehavior = \"always\" | \"whenAtEnd\" | \"persistent\" | \"never\";\n\ntype UseChatKeyboardOptions = {\n inverted: boolean;\n keyboardLiftBehavior: KeyboardLiftBehavior;\n freeze: boolean;\n offset: number;\n blankSpace: SharedValue<number>;\n /** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */\n extraContentPadding: SharedValue<number>;\n};\n\ntype UseChatKeyboardReturn = {\n /** Extra scrollable space (= keyboard height). Used as contentInset on iOS, contentInsetBottom/contentInsetTop on Android. */\n padding: SharedValue<number>;\n /** Raw keyboard height updated every frame in onMove. Used to force Reanimated commits on Fabric. */\n currentHeight: SharedValue<number>;\n /** Absolute Y content offset for iOS (set once in onStart). `undefined` on Android. */\n contentOffsetY: SharedValue<number> | undefined;\n /** Current vertical scroll offset. */\n scroll: SharedValue<number>;\n /** Visible viewport dimensions. */\n layout: SharedValue<{ width: number; height: number }>;\n /** Total content dimensions. */\n size: SharedValue<{ width: number; height: number }>;\n /** Callback to attach to ScrollView's onLayout prop to capture initial viewport dimensions. */\n onLayout: (e: LayoutChangeEvent) => void;\n /** Callback to attach to ScrollView's onContentSizeChange prop to capture initial content dimensions. */\n onContentSizeChange: (w: number, h: number) => void;\n};\n\nexport type {\n KeyboardLiftBehavior,\n UseChatKeyboardOptions,\n UseChatKeyboardReturn,\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useExtraContentPadding = useExtraContentPadding;
|
|
7
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
|
+
var _helpers = require("../useChatKeyboard/helpers");
|
|
9
|
+
/**
|
|
10
|
+
* Hook that reacts to `extraContentPadding` changes and conditionally
|
|
11
|
+
* adjusts the scroll position using `scrollTo` on both iOS and Android.
|
|
12
|
+
*
|
|
13
|
+
* Padding extension (scrollable range) is handled externally via a
|
|
14
|
+
* `useDerivedValue` that sums keyboard padding + extra content padding.
|
|
15
|
+
* This hook only handles the scroll correction.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Configuration and shared values.
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* useExtraContentPadding({ scrollViewRef, extraContentPadding, ... });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function useExtraContentPadding(options) {
|
|
24
|
+
const {
|
|
25
|
+
scrollViewRef,
|
|
26
|
+
extraContentPadding,
|
|
27
|
+
keyboardPadding,
|
|
28
|
+
blankSpace,
|
|
29
|
+
scroll,
|
|
30
|
+
layout,
|
|
31
|
+
size,
|
|
32
|
+
inverted,
|
|
33
|
+
keyboardLiftBehavior,
|
|
34
|
+
freeze
|
|
35
|
+
} = options;
|
|
36
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => extraContentPadding.value, (current, previous) => {
|
|
37
|
+
if (freeze || previous === null) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const rawDelta = current - previous;
|
|
41
|
+
if (rawDelta === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Compute effective delta considering blankSpace floor
|
|
46
|
+
const previousTotal = Math.max(blankSpace.value, keyboardPadding.value + previous);
|
|
47
|
+
const currentTotal = Math.max(blankSpace.value, keyboardPadding.value + current);
|
|
48
|
+
const effectiveDelta = currentTotal - previousTotal;
|
|
49
|
+
if (effectiveDelta === 0) {
|
|
50
|
+
// blankSpace absorbed the change
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const atEnd = (0, _helpers.isScrollAtEnd)(scroll.value, layout.value.height, size.value.height, inverted);
|
|
54
|
+
|
|
55
|
+
// "persistent": scroll on grow, hold position on shrink (unless at end)
|
|
56
|
+
if (keyboardLiftBehavior === "persistent" && effectiveDelta < 0 && !atEnd) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!(0, _helpers.shouldShiftContent)(keyboardLiftBehavior, atEnd)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (inverted) {
|
|
63
|
+
const target = Math.max(scroll.value - effectiveDelta, -currentTotal);
|
|
64
|
+
(0, _reactNativeReanimated.scrollTo)(scrollViewRef, 0, target, false);
|
|
65
|
+
} else {
|
|
66
|
+
const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);
|
|
67
|
+
const target = Math.min(scroll.value + effectiveDelta, maxScroll);
|
|
68
|
+
(0, _reactNativeReanimated.scrollTo)(scrollViewRef, 0, target, false);
|
|
69
|
+
}
|
|
70
|
+
}, [inverted, keyboardLiftBehavior, freeze]);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeReanimated","require","_helpers","useExtraContentPadding","options","scrollViewRef","extraContentPadding","keyboardPadding","blankSpace","scroll","layout","size","inverted","keyboardLiftBehavior","freeze","useAnimatedReaction","value","current","previous","rawDelta","previousTotal","Math","max","currentTotal","effectiveDelta","atEnd","isScrollAtEnd","height","shouldShiftContent","target","scrollTo","maxScroll","min"],"sources":["index.ts"],"sourcesContent":["import { scrollTo, useAnimatedReaction } from \"react-native-reanimated\";\n\nimport { isScrollAtEnd, shouldShiftContent } from \"../useChatKeyboard/helpers\";\n\nimport type { KeyboardLiftBehavior } from \"../useChatKeyboard/types\";\nimport type { AnimatedRef, SharedValue } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\ntype UseExtraContentPaddingOptions = {\n scrollViewRef: AnimatedRef<Reanimated.ScrollView>;\n extraContentPadding: SharedValue<number>;\n /** Keyboard-only padding from useChatKeyboard — used to compute total padding for clamping. */\n keyboardPadding: SharedValue<number>;\n /** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */\n blankSpace: SharedValue<number>;\n /** Current vertical scroll offset. */\n scroll: SharedValue<number>;\n /** Visible viewport dimensions. */\n layout: SharedValue<{ width: number; height: number }>;\n /** Total content dimensions. */\n size: SharedValue<{ width: number; height: number }>;\n inverted: boolean;\n keyboardLiftBehavior: KeyboardLiftBehavior;\n freeze: boolean;\n};\n\n/**\n * Hook that reacts to `extraContentPadding` changes and conditionally\n * adjusts the scroll position using `scrollTo` on both iOS and Android.\n *\n * Padding extension (scrollable range) is handled externally via a\n * `useDerivedValue` that sums keyboard padding + extra content padding.\n * This hook only handles the scroll correction.\n *\n * @param options - Configuration and shared values.\n * @example\n * ```tsx\n * useExtraContentPadding({ scrollViewRef, extraContentPadding, ... });\n * ```\n */\nfunction useExtraContentPadding(options: UseExtraContentPaddingOptions): void {\n const {\n scrollViewRef,\n extraContentPadding,\n keyboardPadding,\n blankSpace,\n scroll,\n layout,\n size,\n inverted,\n keyboardLiftBehavior,\n freeze,\n } = options;\n\n useAnimatedReaction(\n () => extraContentPadding.value,\n (current, previous) => {\n if (freeze || previous === null) {\n return;\n }\n\n const rawDelta = current - previous;\n\n if (rawDelta === 0) {\n return;\n }\n\n // Compute effective delta considering blankSpace floor\n const previousTotal = Math.max(\n blankSpace.value,\n keyboardPadding.value + previous,\n );\n const currentTotal = Math.max(\n blankSpace.value,\n keyboardPadding.value + current,\n );\n const effectiveDelta = currentTotal - previousTotal;\n\n if (effectiveDelta === 0) {\n // blankSpace absorbed the change\n return;\n }\n\n const atEnd = isScrollAtEnd(\n scroll.value,\n layout.value.height,\n size.value.height,\n inverted,\n );\n\n // \"persistent\": scroll on grow, hold position on shrink (unless at end)\n if (\n keyboardLiftBehavior === \"persistent\" &&\n effectiveDelta < 0 &&\n !atEnd\n ) {\n return;\n }\n\n if (!shouldShiftContent(keyboardLiftBehavior, atEnd)) {\n return;\n }\n\n if (inverted) {\n const target = Math.max(scroll.value - effectiveDelta, -currentTotal);\n\n scrollTo(scrollViewRef, 0, target, false);\n } else {\n const maxScroll = Math.max(\n size.value.height - layout.value.height + currentTotal,\n 0,\n );\n const target = Math.min(scroll.value + effectiveDelta, maxScroll);\n\n scrollTo(scrollViewRef, 0, target, false);\n }\n },\n [inverted, keyboardLiftBehavior, freeze],\n );\n}\n\nexport { useExtraContentPadding };\nexport type { UseExtraContentPaddingOptions };\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,sBAAsBA,CAACC,OAAsC,EAAQ;EAC5E,MAAM;IACJC,aAAa;IACbC,mBAAmB;IACnBC,eAAe;IACfC,UAAU;IACVC,MAAM;IACNC,MAAM;IACNC,IAAI;IACJC,QAAQ;IACRC,oBAAoB;IACpBC;EACF,CAAC,GAAGV,OAAO;EAEX,IAAAW,0CAAmB,EACjB,MAAMT,mBAAmB,CAACU,KAAK,EAC/B,CAACC,OAAO,EAAEC,QAAQ,KAAK;IACrB,IAAIJ,MAAM,IAAII,QAAQ,KAAK,IAAI,EAAE;MAC/B;IACF;IAEA,MAAMC,QAAQ,GAAGF,OAAO,GAAGC,QAAQ;IAEnC,IAAIC,QAAQ,KAAK,CAAC,EAAE;MAClB;IACF;;IAEA;IACA,MAAMC,aAAa,GAAGC,IAAI,CAACC,GAAG,CAC5Bd,UAAU,CAACQ,KAAK,EAChBT,eAAe,CAACS,KAAK,GAAGE,QAC1B,CAAC;IACD,MAAMK,YAAY,GAAGF,IAAI,CAACC,GAAG,CAC3Bd,UAAU,CAACQ,KAAK,EAChBT,eAAe,CAACS,KAAK,GAAGC,OAC1B,CAAC;IACD,MAAMO,cAAc,GAAGD,YAAY,GAAGH,aAAa;IAEnD,IAAII,cAAc,KAAK,CAAC,EAAE;MACxB;MACA;IACF;IAEA,MAAMC,KAAK,GAAG,IAAAC,sBAAa,EACzBjB,MAAM,CAACO,KAAK,EACZN,MAAM,CAACM,KAAK,CAACW,MAAM,EACnBhB,IAAI,CAACK,KAAK,CAACW,MAAM,EACjBf,QACF,CAAC;;IAED;IACA,IACEC,oBAAoB,KAAK,YAAY,IACrCW,cAAc,GAAG,CAAC,IAClB,CAACC,KAAK,EACN;MACA;IACF;IAEA,IAAI,CAAC,IAAAG,2BAAkB,EAACf,oBAAoB,EAAEY,KAAK,CAAC,EAAE;MACpD;IACF;IAEA,IAAIb,QAAQ,EAAE;MACZ,MAAMiB,MAAM,GAAGR,IAAI,CAACC,GAAG,CAACb,MAAM,CAACO,KAAK,GAAGQ,cAAc,EAAE,CAACD,YAAY,CAAC;MAErE,IAAAO,+BAAQ,EAACzB,aAAa,EAAE,CAAC,EAAEwB,MAAM,EAAE,KAAK,CAAC;IAC3C,CAAC,MAAM;MACL,MAAME,SAAS,GAAGV,IAAI,CAACC,GAAG,CACxBX,IAAI,CAACK,KAAK,CAACW,MAAM,GAAGjB,MAAM,CAACM,KAAK,CAACW,MAAM,GAAGJ,YAAY,EACtD,CACF,CAAC;MACD,MAAMM,MAAM,GAAGR,IAAI,CAACW,GAAG,CAACvB,MAAM,CAACO,KAAK,GAAGQ,cAAc,EAAEO,SAAS,CAAC;MAEjE,IAAAD,+BAAQ,EAACzB,aAAa,EAAE,CAAC,EAAEwB,MAAM,EAAE,KAAK,CAAC;IAC3C;EACF,CAAC,EACD,CAACjB,QAAQ,EAAEC,oBAAoB,EAAEC,MAAM,CACzC,CAAC;AACH","ignoreList":[]}
|
|
@@ -41,9 +41,11 @@ const KeyboardStickyView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
41
41
|
outputRange: [closed, opened]
|
|
42
42
|
});
|
|
43
43
|
const styles = (0, _react.useMemo)(() => {
|
|
44
|
+
const disabled = _reactNative.Animated.add(_reactNative.Animated.multiply(height, 0), closed);
|
|
45
|
+
const active = _reactNative.Animated.add(height, offset);
|
|
44
46
|
return [{
|
|
45
47
|
transform: [{
|
|
46
|
-
translateY: enabled ?
|
|
48
|
+
translateY: enabled ? active : disabled
|
|
47
49
|
}]
|
|
48
50
|
}, style];
|
|
49
51
|
}, [closed, enabled, height, offset, style]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","KeyboardStickyView","forwardRef","children","offset","closed","opened","style","enabled","props","ref","height","progress","useKeyboardAnimation","interpolate","inputRange","outputRange","styles","useMemo","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_hooks","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","KeyboardStickyView","forwardRef","children","offset","closed","opened","style","enabled","props","ref","height","progress","useKeyboardAnimation","interpolate","inputRange","outputRange","styles","useMemo","disabled","Animated","add","multiply","active","transform","translateY","createElement","View","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport { useKeyboardAnimation } from \"../../hooks\";\n\nimport type { View, ViewProps } from \"react-native\";\n\nexport type KeyboardStickyViewProps = {\n /**\n * Specify additional offset to the view for given keyboard state.\n */\n offset?: {\n /**\n * Adds additional `translateY` when keyboard is close. By default `0`.\n */\n closed?: number;\n /**\n * Adds additional `translateY` when keyboard is open. By default `0`.\n */\n opened?: number;\n };\n\n /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */\n enabled?: boolean;\n} & ViewProps;\n\n/**\n * A View component that sticks to the keyboard and moves with it when it appears or disappears.\n * The view can be configured with custom offsets for both closed and open keyboard states.\n *\n * @returns An animated View component that sticks to the keyboard.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-sticky-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardStickyView offset={{ closed: 0, opened: 20 }}>\n * <Button title=\"Submit\" />\n * </KeyboardStickyView>\n * ```\n */\nconst KeyboardStickyView = forwardRef<\n View,\n React.PropsWithChildren<KeyboardStickyViewProps>\n>(\n (\n {\n children,\n offset: { closed = 0, opened = 0 } = {},\n style,\n enabled = true,\n ...props\n },\n ref,\n ) => {\n const { height, progress } = useKeyboardAnimation();\n\n const offset = progress.interpolate({\n inputRange: [0, 1],\n outputRange: [closed, opened],\n });\n\n const styles = useMemo(() => {\n const disabled = Animated.add(Animated.multiply(height, 0), closed);\n const active = Animated.add(height, offset);\n\n return [\n {\n transform: [{ translateY: enabled ? active : disabled }],\n },\n style,\n ];\n }, [closed, enabled, height, offset, style]);\n\n return (\n <Animated.View ref={ref} style={styles} {...props}>\n {children}\n </Animated.View>\n );\n },\n);\n\nexport default KeyboardStickyView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAAmD,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,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,gBA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WAAW,CAAC;IAClCC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAE,CAACX,MAAM,EAAEC,MAAM;EAC9B,CAAC,CAAC;EAEF,MAAMW,MAAM,GAAG,IAAAC,cAAO,EAAC,MAAM;IAC3B,MAAMC,QAAQ,GAAGC,qBAAQ,CAACC,GAAG,CAACD,qBAAQ,CAACE,QAAQ,CAACX,MAAM,EAAE,CAAC,CAAC,EAAEN,MAAM,CAAC;IACnE,MAAMkB,MAAM,GAAGH,qBAAQ,CAACC,GAAG,CAACV,MAAM,EAAEP,MAAM,CAAC;IAE3C,OAAO,CACL;MACEoB,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAEjB,OAAO,GAAGe,MAAM,GAAGJ;MAAS,CAAC;IACzD,CAAC,EACDZ,KAAK,CACN;EACH,CAAC,EAAE,CAACF,MAAM,EAAEG,OAAO,EAAEG,MAAM,EAAEP,MAAM,EAAEG,KAAK,CAAC,CAAC;EAE5C,oBACEpC,MAAA,CAAAe,OAAA,CAAAwC,aAAA,CAACpD,YAAA,CAAA8C,QAAQ,CAACO,IAAI,EAAAhC,QAAA;IAACe,GAAG,EAAEA,GAAI;IAACH,KAAK,EAAEU;EAAO,GAAKR,KAAK,GAC9CN,QACY,CAAC;AAEpB,CACF,CAAC;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAA3C,OAAA,GAEae,kBAAkB","ignoreList":[]}
|
|
@@ -182,5 +182,6 @@ KeyboardToolbar.Content = _components.Content;
|
|
|
182
182
|
KeyboardToolbar.Prev = _components.Prev;
|
|
183
183
|
KeyboardToolbar.Next = _components.Next;
|
|
184
184
|
KeyboardToolbar.Done = _components.Done;
|
|
185
|
+
KeyboardToolbar.Group = _bindings.RCTKeyboardToolbarGroupView;
|
|
185
186
|
var _default = exports.default = KeyboardToolbar;
|
|
186
187
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","_KeyboardStickyView","_interopRequireDefault","_Arrow","_Button","_colors","_components","_context","_constants","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","KeyboardToolbar","props","children","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","DEFAULT_OPACITY","offset","closed","opened","enabled","insets","rest","colorScheme","useKeyboardState","state","appearance","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","buttonContainer","Button","iconContainer","Arrow","useEffect","subscription","FocusedInputEvents","addListener","remove","toolbarStyle","useMemo","styles","toolbar","backgroundColor","background","KEYBOARD_HAS_ROUNDED_CORNERS","paddingLeft","left","paddingRight","right","floating","containerStyle","marginLeft","marginRight","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","backgroundElement","arrowsElement","contentContainer","doneElement","prevChild","nextChild","contentChild","doneChild","backgroundChild","React","Children","forEach","child","isValidElement","type","Background","Content","Prev","Next","Done","createElement","View","style","arrows","onPress","text","contextValue","ToolbarContext","Provider","value","testID","TEST_ID_KEYBOARD_TOOLBAR","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","alignSelf","borderRadius","overflow","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport { FocusedInputEvents } from \"../../bindings\";\nimport { useKeyboardState } from \"../../hooks\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport { Background, Content, Done, Next, Prev } from \"./compound/components\";\nimport { ToolbarContext } from \"./compound/context\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n} from \"./constants\";\n\nimport type { KeyboardToolbarProps } from \"./types\";\nimport type { ReactNode } from \"react\";\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and\n * `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.\n *\n * @param props - Component props.\n * @returns A component that is shown above the keyboard with `Prev`/`Next` and `Done` buttons.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-toolbar|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardToolbar>\n * <KeyboardToolbar.Done text=\"Close\" />\n * </KeyboardToolbar>\n * ```\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> & {\n Background: typeof Background;\n Content: typeof Content;\n Prev: typeof Prev;\n Next: typeof Next;\n Done: typeof Done;\n} = (props) => {\n const {\n children,\n content,\n theme = colors,\n doneText = \"Done\",\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n offset: { closed = 0, opened = 0 } = {},\n enabled = true,\n insets,\n ...rest\n } = props;\n const colorScheme = useKeyboardState((state) => state.appearance);\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n const buttonContainer = button ?? Button;\n const iconContainer = icon ?? Arrow;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n !KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n paddingLeft: insets?.left,\n paddingRight: insets?.right,\n }\n : null,\n KEYBOARD_HAS_ROUNDED_CORNERS ? styles.floating : null,\n ],\n [colorScheme, opacity, theme, insets],\n );\n const containerStyle = useMemo(\n () => [\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n marginLeft: (insets?.left ?? 0) + 16,\n marginRight: (insets?.right ?? 0) + 16,\n }\n : null,\n ],\n [insets],\n );\n const offset = useMemo(\n () => ({\n closed: closed + KEYBOARD_TOOLBAR_HEIGHT,\n opened: opened + OPENED_OFFSET,\n }),\n [closed, opened],\n );\n\n let backgroundElement: ReactNode = null;\n let arrowsElement: ReactNode = null;\n let contentContainer: ReactNode = null;\n let doneElement: ReactNode = null;\n\n if (children) {\n let prevChild: ReactNode = null;\n let nextChild: ReactNode = null;\n let contentChild: ReactNode = null;\n let doneChild: ReactNode = null;\n let backgroundChild: ReactNode = null;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n const type = child.type;\n\n if (type === Background) {\n backgroundChild = child;\n } else if (type === Content) {\n contentChild = child;\n } else if (type === Prev) {\n prevChild = child;\n } else if (type === Next) {\n nextChild = child;\n } else if (type === Done) {\n doneChild = child;\n }\n });\n\n backgroundElement = backgroundChild;\n doneElement = doneChild;\n arrowsElement =\n prevChild || nextChild ? (\n <View style={styles.arrows}>\n {prevChild}\n {nextChild}\n </View>\n ) : null;\n contentContainer = contentChild ?? <Content>{contentChild}</Content>;\n } else {\n backgroundElement = blur;\n arrowsElement = showArrows ? (\n <View style={styles.arrows}>\n <Prev\n button={buttonContainer}\n icon={iconContainer}\n onPress={onPrevCallback}\n />\n <Next\n button={buttonContainer}\n icon={iconContainer}\n onPress={onNextCallback}\n />\n </View>\n ) : null;\n contentContainer = <Content>{content}</Content>;\n doneElement = doneText ? (\n <Done button={buttonContainer} text={doneText} onPress={onDoneCallback} />\n ) : null;\n }\n\n const contextValue = useMemo(\n () => ({\n theme,\n isPrevDisabled,\n isNextDisabled,\n }),\n [theme, isPrevDisabled, isNextDisabled],\n );\n\n return (\n <ToolbarContext.Provider value={contextValue}>\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {backgroundElement}\n {arrowsElement}\n {contentContainer}\n {doneElement}\n </View>\n </KeyboardStickyView>\n </ToolbarContext.Provider>\n );\n};\n\nconst styles = StyleSheet.create({\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n },\n arrows: {\n flexDirection: \"row\",\n paddingLeft: 8,\n },\n floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nKeyboardToolbar.Background = Background;\nKeyboardToolbar.Content = Content;\nKeyboardToolbar.Prev = Prev;\nKeyboardToolbar.Next = Next;\nKeyboardToolbar.Done = Done;\n\nexport { colors as DefaultKeyboardToolbarTheme, KeyboardToolbarProps };\nexport default KeyboardToolbar;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,OAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAMqB,SAAAK,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAb,wBAAAa,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAjB,uBAAA,Y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AAEC;EAAyB,IACnE/B,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,EAChBC,WACG,CACY,CACG,CAAC;AAE9B,CAAC;AAED,MAAMlB,MAAM,GAAG+C,uBAAU,CAACC,MAAM,CAAC;EAC/B/C,OAAO,EAAE;IACPgD,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAEzC;EACV,CAAC;EACDyB,MAAM,EAAE;IACNe,aAAa,EAAE,KAAK;IACpBhD,WAAW,EAAE;EACf,CAAC;EACDI,QAAQ,EAAE;IACR8C,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFrG,eAAe,CAAC0E,UAAU,GAAGA,sBAAU;AACvC1E,eAAe,CAAC2E,OAAO,GAAGA,mBAAO;AACjC3E,eAAe,CAAC4E,IAAI,GAAGA,gBAAI;AAC3B5E,eAAe,CAAC6E,IAAI,GAAGA,gBAAI;AAC3B7E,eAAe,CAAC8E,IAAI,GAAGA,gBAAI;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAA9H,OAAA,GAGbuB,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","_KeyboardStickyView","_interopRequireDefault","_Arrow","_Button","_colors","_components","_context","_constants","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","KeyboardToolbar","props","children","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","DEFAULT_OPACITY","offset","closed","opened","enabled","insets","rest","colorScheme","useKeyboardState","state","appearance","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","buttonContainer","Button","iconContainer","Arrow","useEffect","subscription","FocusedInputEvents","addListener","remove","toolbarStyle","useMemo","styles","toolbar","backgroundColor","background","KEYBOARD_HAS_ROUNDED_CORNERS","paddingLeft","left","paddingRight","right","floating","containerStyle","marginLeft","marginRight","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","backgroundElement","arrowsElement","contentContainer","doneElement","prevChild","nextChild","contentChild","doneChild","backgroundChild","React","Children","forEach","child","isValidElement","type","Background","Content","Prev","Next","Done","createElement","View","style","arrows","onPress","text","contextValue","ToolbarContext","Provider","value","testID","TEST_ID_KEYBOARD_TOOLBAR","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","alignSelf","borderRadius","overflow","Group","RCTKeyboardToolbarGroupView","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n RCTKeyboardToolbarGroupView,\n} from \"../../bindings\";\nimport { useKeyboardState } from \"../../hooks\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport { Background, Content, Done, Next, Prev } from \"./compound/components\";\nimport { ToolbarContext } from \"./compound/context\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n} from \"./constants\";\n\nimport type { KeyboardToolbarProps } from \"./types\";\nimport type { ReactNode } from \"react\";\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and\n * `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.\n *\n * @param props - Component props.\n * @returns A component that is shown above the keyboard with `Prev`/`Next` and `Done` buttons.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-toolbar|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardToolbar>\n * <KeyboardToolbar.Done text=\"Close\" />\n * </KeyboardToolbar>\n * ```\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> & {\n Background: typeof Background;\n Content: typeof Content;\n Prev: typeof Prev;\n Next: typeof Next;\n Done: typeof Done;\n Group: typeof RCTKeyboardToolbarGroupView;\n} = (props) => {\n const {\n children,\n content,\n theme = colors,\n doneText = \"Done\",\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n offset: { closed = 0, opened = 0 } = {},\n enabled = true,\n insets,\n ...rest\n } = props;\n const colorScheme = useKeyboardState((state) => state.appearance);\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n const buttonContainer = button ?? Button;\n const iconContainer = icon ?? Arrow;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n !KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n paddingLeft: insets?.left,\n paddingRight: insets?.right,\n }\n : null,\n KEYBOARD_HAS_ROUNDED_CORNERS ? styles.floating : null,\n ],\n [colorScheme, opacity, theme, insets],\n );\n const containerStyle = useMemo(\n () => [\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n marginLeft: (insets?.left ?? 0) + 16,\n marginRight: (insets?.right ?? 0) + 16,\n }\n : null,\n ],\n [insets],\n );\n const offset = useMemo(\n () => ({\n closed: closed + KEYBOARD_TOOLBAR_HEIGHT,\n opened: opened + OPENED_OFFSET,\n }),\n [closed, opened],\n );\n\n let backgroundElement: ReactNode = null;\n let arrowsElement: ReactNode = null;\n let contentContainer: ReactNode = null;\n let doneElement: ReactNode = null;\n\n if (children) {\n let prevChild: ReactNode = null;\n let nextChild: ReactNode = null;\n let contentChild: ReactNode = null;\n let doneChild: ReactNode = null;\n let backgroundChild: ReactNode = null;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n const type = child.type;\n\n if (type === Background) {\n backgroundChild = child;\n } else if (type === Content) {\n contentChild = child;\n } else if (type === Prev) {\n prevChild = child;\n } else if (type === Next) {\n nextChild = child;\n } else if (type === Done) {\n doneChild = child;\n }\n });\n\n backgroundElement = backgroundChild;\n doneElement = doneChild;\n arrowsElement =\n prevChild || nextChild ? (\n <View style={styles.arrows}>\n {prevChild}\n {nextChild}\n </View>\n ) : null;\n contentContainer = contentChild ?? <Content>{contentChild}</Content>;\n } else {\n backgroundElement = blur;\n arrowsElement = showArrows ? (\n <View style={styles.arrows}>\n <Prev\n button={buttonContainer}\n icon={iconContainer}\n onPress={onPrevCallback}\n />\n <Next\n button={buttonContainer}\n icon={iconContainer}\n onPress={onNextCallback}\n />\n </View>\n ) : null;\n contentContainer = <Content>{content}</Content>;\n doneElement = doneText ? (\n <Done button={buttonContainer} text={doneText} onPress={onDoneCallback} />\n ) : null;\n }\n\n const contextValue = useMemo(\n () => ({\n theme,\n isPrevDisabled,\n isNextDisabled,\n }),\n [theme, isPrevDisabled, isNextDisabled],\n );\n\n return (\n <ToolbarContext.Provider value={contextValue}>\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {backgroundElement}\n {arrowsElement}\n {contentContainer}\n {doneElement}\n </View>\n </KeyboardStickyView>\n </ToolbarContext.Provider>\n );\n};\n\nconst styles = StyleSheet.create({\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n },\n arrows: {\n flexDirection: \"row\",\n paddingLeft: 8,\n },\n floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nKeyboardToolbar.Background = Background;\nKeyboardToolbar.Content = Content;\nKeyboardToolbar.Prev = Prev;\nKeyboardToolbar.Next = Next;\nKeyboardToolbar.Done = Done;\nKeyboardToolbar.Group = RCTKeyboardToolbarGroupView;\n\nexport { colors as DefaultKeyboardToolbarTheme, KeyboardToolbarProps };\nexport default KeyboardToolbar;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,OAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAMqB,SAAAK,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAb,wBAAAa,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAjB,uBAAA,YAAAA,CAAAa,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAA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AAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAEzC;EACV,CAAC;EACDyB,MAAM,EAAE;IACNe,aAAa,EAAE,KAAK;IACpBhD,WAAW,EAAE;EACf,CAAC;EACDI,QAAQ,EAAE;IACR8C,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFrG,eAAe,CAAC0E,UAAU,GAAGA,sBAAU;AACvC1E,eAAe,CAAC2E,OAAO,GAAGA,mBAAO;AACjC3E,eAAe,CAAC4E,IAAI,GAAGA,gBAAI;AAC3B5E,eAAe,CAAC6E,IAAI,GAAGA,gBAAI;AAC3B7E,eAAe,CAAC8E,IAAI,GAAGA,gBAAI;AAC3B9E,eAAe,CAACsG,KAAK,GAAGC,qCAA2B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhI,OAAA,GAGrCuB,eAAe","ignoreList":[]}
|
|
@@ -17,18 +17,24 @@ const ReanimatedClippingScrollView = OS === "android" ? _reactNativeReanimated.d
|
|
|
17
17
|
const ScrollViewWithBottomPadding = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
18
18
|
ScrollViewComponent,
|
|
19
19
|
bottomPadding,
|
|
20
|
+
scrollIndicatorPadding,
|
|
20
21
|
contentInset,
|
|
21
22
|
scrollIndicatorInsets,
|
|
22
23
|
inverted,
|
|
23
24
|
contentOffsetY,
|
|
24
|
-
|
|
25
|
+
applyWorkaroundForContentInsetHitTestBug,
|
|
25
26
|
children,
|
|
26
|
-
style,
|
|
27
27
|
...rest
|
|
28
28
|
}, ref) => {
|
|
29
|
+
const prevContentOffsetY = (0, _reactNativeReanimated.useSharedValue)(null);
|
|
29
30
|
const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
|
|
30
|
-
const
|
|
31
|
-
const
|
|
31
|
+
const insetTop = inverted ? bottomPadding.value : 0;
|
|
32
|
+
const insetBottom = !inverted ? bottomPadding.value : 0;
|
|
33
|
+
const bottom = insetBottom + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom) || 0);
|
|
34
|
+
const top = insetTop + ((contentInset === null || contentInset === void 0 ? void 0 : contentInset.top) || 0);
|
|
35
|
+
const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;
|
|
36
|
+
const indicatorTop = (inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top) || 0);
|
|
37
|
+
const indicatorBottom = (!inverted ? indicatorPadding.value : 0) + ((scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom) || 0);
|
|
32
38
|
const result = {
|
|
33
39
|
// iOS prop
|
|
34
40
|
contentInset: {
|
|
@@ -38,30 +44,45 @@ const ScrollViewWithBottomPadding = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
38
44
|
left: contentInset === null || contentInset === void 0 ? void 0 : contentInset.left
|
|
39
45
|
},
|
|
40
46
|
scrollIndicatorInsets: {
|
|
41
|
-
bottom:
|
|
42
|
-
top:
|
|
47
|
+
bottom: indicatorBottom,
|
|
48
|
+
top: indicatorTop,
|
|
43
49
|
right: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right,
|
|
44
50
|
left: scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left
|
|
45
51
|
},
|
|
46
52
|
// Android prop
|
|
47
|
-
contentInsetBottom:
|
|
53
|
+
contentInsetBottom: insetBottom,
|
|
54
|
+
contentInsetTop: insetTop
|
|
48
55
|
};
|
|
49
56
|
if (contentOffsetY) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
const curr = contentOffsetY.value;
|
|
58
|
+
if (curr !== prevContentOffsetY.value) {
|
|
59
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
60
|
+
prevContentOffsetY.value = curr;
|
|
61
|
+
result.contentOffset = {
|
|
62
|
+
x: 0,
|
|
63
|
+
y: curr
|
|
64
|
+
};
|
|
65
|
+
}
|
|
54
66
|
}
|
|
55
67
|
return result;
|
|
56
68
|
}, [contentInset === null || contentInset === void 0 ? void 0 : contentInset.bottom, contentInset === null || contentInset === void 0 ? void 0 : contentInset.top, contentInset === null || contentInset === void 0 ? void 0 : contentInset.right, contentInset === null || contentInset === void 0 ? void 0 : contentInset.left, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.bottom, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.top, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.right, scrollIndicatorInsets === null || scrollIndicatorInsets === void 0 ? void 0 : scrollIndicatorInsets.left, inverted, contentOffsetY]);
|
|
57
69
|
return /*#__PURE__*/_react.default.createElement(ReanimatedClippingScrollView, {
|
|
58
70
|
animatedProps: animatedProps,
|
|
59
|
-
|
|
71
|
+
applyWorkaroundForContentInsetHitTestBug: applyWorkaroundForContentInsetHitTestBug,
|
|
72
|
+
style: _styles.default.container
|
|
60
73
|
}, /*#__PURE__*/_react.default.createElement(ScrollViewComponent, _extends({
|
|
61
74
|
ref: ref,
|
|
62
|
-
animatedProps: animatedProps
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
animatedProps: animatedProps
|
|
76
|
+
}, rest), inverted ?
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
// The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists
|
|
79
|
+
// don't support this functionality, so we can add additional view here
|
|
80
|
+
// The correct fix would be to add a new prop in ScrollView that allows
|
|
81
|
+
// to customize children extraction logic and skip custom view
|
|
82
|
+
_react.default.createElement(_reactNative.View, {
|
|
83
|
+
collapsable: false,
|
|
84
|
+
nativeID: "container"
|
|
85
|
+
}, children) : children));
|
|
65
86
|
});
|
|
66
87
|
var _default = exports.default = ScrollViewWithBottomPadding;
|
|
67
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_styles","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","OS","Platform","ReanimatedClippingScrollView","Reanimated","createAnimatedComponent","ClippingScrollView","ScrollViewWithBottomPadding","forwardRef","ScrollViewComponent","bottomPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","containerStyle","children","style","rest","ref","animatedProps","useAnimatedProps","bottom","value","top","result","right","left","contentInsetBottom","contentOffset","x","y","createElement","styles","container","undefined","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { Platform } from \"react-native\";\nimport Reanimated, { useAnimatedProps } from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps, StyleProp, ViewStyle } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for ChatKit). */\n contentOffsetY?: SharedValue<number>;\n /** Style applied to the container wrapper (Android only, for ChatKit translateY). */\n containerStyle?: StyleProp<ViewStyle>;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n containerStyle,\n children,\n style,\n ...rest\n },\n ref,\n ) => {\n const animatedProps = useAnimatedProps(() => {\n const bottom = inverted\n ? 0\n : bottomPadding.value + (contentInset?.bottom || 0);\n const top = !inverted\n ? 0\n : bottomPadding.value + (contentInset?.top || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: {\n bottom: bottom,\n top: top,\n right: contentInset?.right,\n left: contentInset?.left,\n },\n scrollIndicatorInsets: {\n bottom: bottom,\n top: top,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: bottomPadding.value,\n };\n\n if (contentOffsetY) {\n result.contentOffset = { x: 0, y: contentOffsetY.value };\n }\n\n return result;\n }, [\n contentInset?.bottom,\n contentInset?.top,\n contentInset?.right,\n contentInset?.left,\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n style={[\n styles.container,\n OS === \"android\" ? containerStyle : undefined,\n ]}\n >\n <ScrollViewComponent\n ref={ref}\n animatedProps={animatedProps}\n style={style}\n {...rest}\n >\n {children}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAA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AI;IACTC,aAAa,EAAEA,aAAc;IAC7BH,KAAK,EAAEA;EAAM,GACTC,IAAI,GAEPF,QACkB,CACO,CAAC;AAEnC,CACF,CAAC;AAAC,IAAAoB,QAAA,GAAAC,OAAA,CAAA3D,OAAA,GAEa6B,2BAA2B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_styles","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","OS","Platform","ReanimatedClippingScrollView","Reanimated","createAnimatedComponent","ClippingScrollView","ScrollViewWithBottomPadding","forwardRef","ScrollViewComponent","bottomPadding","scrollIndicatorPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","applyWorkaroundForContentInsetHitTestBug","children","rest","ref","prevContentOffsetY","useSharedValue","animatedProps","useAnimatedProps","insetTop","value","insetBottom","bottom","top","indicatorPadding","indicatorTop","indicatorBottom","result","right","left","contentInsetBottom","contentInsetTop","curr","contentOffset","x","y","createElement","style","styles","container","View","collapsable","nativeID","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { Platform, View } from \"react-native\";\nimport Reanimated, {\n useAnimatedProps,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Padding for scroll indicator insets (excludes blankSpace). Falls back to bottomPadding when not provided. */\n scrollIndicatorPadding?: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */\n contentOffsetY?: SharedValue<number>;\n applyWorkaroundForContentInsetHitTestBug?: boolean;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n scrollIndicatorPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n applyWorkaroundForContentInsetHitTestBug,\n children,\n ...rest\n },\n ref,\n ) => {\n const prevContentOffsetY = useSharedValue<number | null>(null);\n\n const animatedProps = useAnimatedProps(() => {\n const insetTop = inverted ? bottomPadding.value : 0;\n const insetBottom = !inverted ? bottomPadding.value : 0;\n const bottom = insetBottom + (contentInset?.bottom || 0);\n const top = insetTop + (contentInset?.top || 0);\n\n const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;\n const indicatorTop =\n (inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.top || 0);\n const indicatorBottom =\n (!inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.bottom || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: {\n bottom: bottom,\n top: top,\n right: contentInset?.right,\n left: contentInset?.left,\n },\n scrollIndicatorInsets: {\n bottom: indicatorBottom,\n top: indicatorTop,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: insetBottom,\n contentInsetTop: insetTop,\n };\n\n if (contentOffsetY) {\n const curr = contentOffsetY.value;\n\n if (curr !== prevContentOffsetY.value) {\n // eslint-disable-next-line react-compiler/react-compiler\n prevContentOffsetY.value = curr;\n result.contentOffset = { x: 0, y: curr };\n }\n }\n\n return result;\n }, [\n contentInset?.bottom,\n contentInset?.top,\n contentInset?.right,\n contentInset?.left,\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n style={styles.container}\n >\n <ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>\n {inverted ? (\n // The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists\n // don't support this functionality, so we can add additional view here\n // The correct fix would be to add a new prop in ScrollView that allows\n // to customize children extraction logic and skip custom view\n <View collapsable={false} nativeID=\"container\">\n {children}\n </View>\n ) : (\n children\n )}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA8B,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAA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AQ,EACRC,cAAc,CACf,CAAC;EAEF,oBACE/C,MAAA,CAAAU,OAAA,CAAA+D,aAAA,CAACtC,4BAA4B;IAC3BmB,aAAa,EAAEA,aAAc;IAC7BN,wCAAwC,EACtCA,wCACD;IACD0B,KAAK,EAAEC,eAAM,CAACC;EAAU,gBAExB5E,MAAA,CAAAU,OAAA,CAAA+D,aAAA,CAAChC,mBAAmB,EAAAd,QAAA;IAACwB,GAAG,EAAEA,GAAI;IAACG,aAAa,EAAEA;EAAc,GAAKJ,IAAI,GAClEJ,QAAQ;EAAA;EACP;EACA;EACA;EACA;EACA9C,MAAA,CAAAU,OAAA,CAAA+D,aAAA,CAACtE,YAAA,CAAA0E,IAAI;IAACC,WAAW,EAAE,KAAM;IAACC,QAAQ,EAAC;EAAW,GAC3C9B,QACG,CAAC,GAEPA,QAEiB,CACO,CAAC;AAEnC,CACF,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAvE,OAAA,GAEa6B,2BAA2B","ignoreList":[]}
|
|
@@ -33,10 +33,29 @@ const useScrollState = ref => {
|
|
|
33
33
|
cleanup();
|
|
34
34
|
};
|
|
35
35
|
}, []);
|
|
36
|
+
|
|
37
|
+
// `onContentSizeChange` is synthesized in JS (from the content container's
|
|
38
|
+
// onLayout) and `onLayout` has a different payload shape than scroll events,
|
|
39
|
+
// so neither can be reliably captured via native event registration.
|
|
40
|
+
// Instead we expose callbacks for the consumer to attach as props.
|
|
41
|
+
const onLayout = (0, _react.useCallback)(e => {
|
|
42
|
+
layout.value = {
|
|
43
|
+
width: e.nativeEvent.layout.width,
|
|
44
|
+
height: e.nativeEvent.layout.height
|
|
45
|
+
};
|
|
46
|
+
}, [layout]);
|
|
47
|
+
const onContentSizeChange = (0, _react.useCallback)((w, h) => {
|
|
48
|
+
size.value = {
|
|
49
|
+
width: w,
|
|
50
|
+
height: h
|
|
51
|
+
};
|
|
52
|
+
}, [size]);
|
|
36
53
|
return {
|
|
37
54
|
offset,
|
|
38
55
|
layout,
|
|
39
|
-
size
|
|
56
|
+
size,
|
|
57
|
+
onLayout,
|
|
58
|
+
onContentSizeChange
|
|
40
59
|
};
|
|
41
60
|
};
|
|
42
61
|
var _default = exports.default = useScrollState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNativeReanimated","_internal","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","useSharedValue","layout","width","height","size","register","useEventHandlerRegistration","eventHandler","useEvent","event","value","contentOffset","y","layoutMeasurement","contentSize","useEffect","cleanup","_default","exports","default"],"sources":["useScrollState.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useEvent, useSharedValue } from \"react-native-reanimated\";\n\nimport { useEventHandlerRegistration } from \"../../internal\";\n\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst NATIVE_SCROLL_EVENT_NAMES = [\n \"onScroll\",\n \"onScrollBeginDrag\",\n \"onScrollEndDrag\",\n \"onMomentumScrollBegin\",\n \"onMomentumScrollEnd\",\n];\n\ntype ScrollEvent = {\n contentOffset: {\n x: number;\n y: number;\n };\n layoutMeasurement: {\n width: number;\n height: number;\n };\n contentSize: {\n width: number;\n height: number;\n };\n};\n\nconst useScrollState = (ref: AnimatedRef<Reanimated.ScrollView>) => {\n const offset = useSharedValue(0);\n const layout = useSharedValue({ width: 0, height: 0 });\n const size = useSharedValue({ width: 0, height: 0 });\n\n const register = useEventHandlerRegistration(ref);\n\n const eventHandler = useEvent((event: ScrollEvent) => {\n \"worklet\";\n\n // eslint-disable-next-line react-compiler/react-compiler\n offset.value = event.contentOffset.y;\n layout.value = event.layoutMeasurement;\n size.value = event.contentSize;\n }, NATIVE_SCROLL_EVENT_NAMES);\n\n useEffect(() => {\n const cleanup = register(eventHandler);\n\n return () => {\n cleanup();\n };\n }, []);\n\n return { offset, layout, size };\n};\n\nexport default useScrollState;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeReanimated","_internal","NATIVE_SCROLL_EVENT_NAMES","useScrollState","ref","offset","useSharedValue","layout","width","height","size","register","useEventHandlerRegistration","eventHandler","useEvent","event","value","contentOffset","y","layoutMeasurement","contentSize","useEffect","cleanup","onLayout","useCallback","e","nativeEvent","onContentSizeChange","w","h","_default","exports","default"],"sources":["useScrollState.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\nimport { useEvent, useSharedValue } from \"react-native-reanimated\";\n\nimport { useEventHandlerRegistration } from \"../../internal\";\n\nimport type { LayoutChangeEvent } from \"react-native\";\nimport type { AnimatedRef } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst NATIVE_SCROLL_EVENT_NAMES = [\n \"onScroll\",\n \"onScrollBeginDrag\",\n \"onScrollEndDrag\",\n \"onMomentumScrollBegin\",\n \"onMomentumScrollEnd\",\n];\n\ntype ScrollEvent = {\n contentOffset: {\n x: number;\n y: number;\n };\n layoutMeasurement: {\n width: number;\n height: number;\n };\n contentSize: {\n width: number;\n height: number;\n };\n};\n\nconst useScrollState = (ref: AnimatedRef<Reanimated.ScrollView>) => {\n const offset = useSharedValue(0);\n const layout = useSharedValue({ width: 0, height: 0 });\n const size = useSharedValue({ width: 0, height: 0 });\n\n const register = useEventHandlerRegistration(ref);\n\n const eventHandler = useEvent((event: ScrollEvent) => {\n \"worklet\";\n\n // eslint-disable-next-line react-compiler/react-compiler\n offset.value = event.contentOffset.y;\n layout.value = event.layoutMeasurement;\n size.value = event.contentSize;\n }, NATIVE_SCROLL_EVENT_NAMES);\n\n useEffect(() => {\n const cleanup = register(eventHandler);\n\n return () => {\n cleanup();\n };\n }, []);\n\n // `onContentSizeChange` is synthesized in JS (from the content container's\n // onLayout) and `onLayout` has a different payload shape than scroll events,\n // so neither can be reliably captured via native event registration.\n // Instead we expose callbacks for the consumer to attach as props.\n const onLayout = useCallback(\n (e: LayoutChangeEvent) => {\n layout.value = {\n width: e.nativeEvent.layout.width,\n height: e.nativeEvent.layout.height,\n };\n },\n [layout],\n );\n\n const onContentSizeChange = useCallback(\n (w: number, h: number) => {\n size.value = { width: w, height: h };\n },\n [size],\n );\n\n return { offset, layout, size, onLayout, onContentSizeChange };\n};\n\nexport default useScrollState;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAMA,MAAMG,yBAAyB,GAAG,CAChC,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,CACtB;AAiBD,MAAMC,cAAc,GAAIC,GAAuC,IAAK;EAClE,MAAMC,MAAM,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EAChC,MAAMC,MAAM,GAAG,IAAAD,qCAAc,EAAC;IAAEE,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EACtD,MAAMC,IAAI,GAAG,IAAAJ,qCAAc,EAAC;IAAEE,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC,CAAC;EAEpD,MAAME,QAAQ,GAAG,IAAAC,qCAA2B,EAACR,GAAG,CAAC;EAEjD,MAAMS,YAAY,GAAG,IAAAC,+BAAQ,EAAEC,KAAkB,IAAK;IACpD,SAAS;;IAET;IACAV,MAAM,CAACW,KAAK,GAAGD,KAAK,CAACE,aAAa,CAACC,CAAC;IACpCX,MAAM,CAACS,KAAK,GAAGD,KAAK,CAACI,iBAAiB;IACtCT,IAAI,CAACM,KAAK,GAAGD,KAAK,CAACK,WAAW;EAChC,CAAC,EAAElB,yBAAyB,CAAC;EAE7B,IAAAmB,gBAAS,EAAC,MAAM;IACd,MAAMC,OAAO,GAAGX,QAAQ,CAACE,YAAY,CAAC;IAEtC,OAAO,MAAM;MACXS,OAAO,CAAC,CAAC;IACX,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EACzBC,CAAoB,IAAK;IACxBlB,MAAM,CAACS,KAAK,GAAG;MACbR,KAAK,EAAEiB,CAAC,CAACC,WAAW,CAACnB,MAAM,CAACC,KAAK;MACjCC,MAAM,EAAEgB,CAAC,CAACC,WAAW,CAACnB,MAAM,CAACE;IAC/B,CAAC;EACH,CAAC,EACD,CAACF,MAAM,CACT,CAAC;EAED,MAAMoB,mBAAmB,GAAG,IAAAH,kBAAW,EACrC,CAACI,CAAS,EAAEC,CAAS,KAAK;IACxBnB,IAAI,CAACM,KAAK,GAAG;MAAER,KAAK,EAAEoB,CAAC;MAAEnB,MAAM,EAAEoB;IAAE,CAAC;EACtC,CAAC,EACD,CAACnB,IAAI,CACP,CAAC;EAED,OAAO;IAAEL,MAAM;IAAEE,MAAM;IAAEG,IAAI;IAAEa,QAAQ;IAAEI;EAAoB,CAAC;AAChE,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa7B,cAAc","ignoreList":[]}
|
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "ChatKit", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ChatKit.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
6
|
Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function () {
|
|
@@ -27,6 +21,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
|
|
|
27
21
|
return _KeyboardAwareScrollView.default;
|
|
28
22
|
}
|
|
29
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "KeyboardChatScrollView", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _KeyboardChatScrollView.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
30
|
Object.defineProperty(exports, "KeyboardStickyView", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
@@ -43,7 +43,7 @@ var _KeyboardAvoidingView = _interopRequireDefault(require("./KeyboardAvoidingVi
|
|
|
43
43
|
var _KeyboardStickyView = _interopRequireDefault(require("./KeyboardStickyView"));
|
|
44
44
|
var _KeyboardAwareScrollView = _interopRequireDefault(require("./KeyboardAwareScrollView"));
|
|
45
45
|
var _KeyboardToolbar = _interopRequireWildcard(require("./KeyboardToolbar"));
|
|
46
|
-
var
|
|
46
|
+
var _KeyboardChatScrollView = _interopRequireDefault(require("./KeyboardChatScrollView"));
|
|
47
47
|
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); }
|
|
48
48
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
49
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","
|
|
1
|
+
{"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","_KeyboardChatScrollView","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport { default as KeyboardChatScrollView } from \"./KeyboardChatScrollView\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\nexport type { KeyboardChatScrollViewProps } from \"./KeyboardChatScrollView/types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAIA,IAAAK,uBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAA6E,SAAAI,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;AAAA,SAAAR,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
|
|
7
|
+
KeyboardChatScrollView: true,
|
|
8
8
|
KeyboardAvoidingView: true,
|
|
9
9
|
KeyboardStickyView: true,
|
|
10
10
|
KeyboardAwareScrollView: true,
|
|
@@ -13,12 +13,6 @@ var _exportNames = {
|
|
|
13
13
|
OverKeyboardView: true,
|
|
14
14
|
KeyboardExtender: true
|
|
15
15
|
};
|
|
16
|
-
Object.defineProperty(exports, "ChatKit", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return _components.ChatKit;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
16
|
Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
|
|
23
17
|
enumerable: true,
|
|
24
18
|
get: function () {
|
|
@@ -37,6 +31,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
|
|
|
37
31
|
return _components.KeyboardAwareScrollView;
|
|
38
32
|
}
|
|
39
33
|
});
|
|
34
|
+
Object.defineProperty(exports, "KeyboardChatScrollView", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _components.KeyboardChatScrollView;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
40
|
Object.defineProperty(exports, "KeyboardExtender", {
|
|
41
41
|
enumerable: true,
|
|
42
42
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bindings","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_animated","_context","_hooks","_constants","_module","_types","_compat","_components","_views"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\nexport * from \"./compat\";\n\nexport {\n
|
|
1
|
+
{"version":3,"names":["_bindings","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_animated","_context","_hooks","_constants","_module","_types","_compat","_components","_views"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\nexport * from \"./compat\";\n\nexport {\n KeyboardChatScrollView,\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardChatScrollViewProps,\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardAwareSc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AA,OAAAO,OAAA,CAAAf,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAgB,WAAA,GAAApB,OAAA;AAiBA,IAAAqB,MAAA,GAAArB,OAAA","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _default = exports.default = (0, _reactNative.codegenNativeComponent)("ClippingScrollViewDecoratorView", {
|
|
9
|
-
interfaceOnly: true
|
|
10
|
-
excludedPlatforms: ["iOS"]
|
|
9
|
+
interfaceOnly: true
|
|
11
10
|
});
|
|
12
11
|
//# sourceMappingURL=ClippingScrollViewDecoratorViewNativeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","codegenNativeComponent","interfaceOnly"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","codegenNativeComponent","interfaceOnly"],"sources":["ClippingScrollViewDecoratorViewNativeComponent.ts"],"sourcesContent":["import { codegenNativeComponent } from \"react-native\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native\";\nimport type { Double } from \"react-native/Libraries/Types/CodegenTypes\";\n\nexport interface NativeProps extends ViewProps {\n contentInsetBottom: Double;\n contentInsetTop: Double;\n applyWorkaroundForContentInsetHitTestBug?: boolean;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n \"ClippingScrollViewDecoratorView\",\n {\n interfaceOnly: true,\n },\n) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAsD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAYvC,IAAAC,mCAAsB,EACnC,iCAAiC,EACjC;EACEC,aAAa,EAAE;AACjB,CACF,CAAC","ignoreList":[]}
|