react-native-keyboard-controller 1.20.0-beta.0 → 1.20.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/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +18 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +1 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardControllerViewManagerImpl.kt +7 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +2 -2
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +16 -0
- package/ios/KeyboardControllerModule.mm +1 -0
- package/ios/observers/FocusedInputObserver.swift +1 -1
- package/ios/views/KeyboardControllerView.mm +11 -0
- package/ios/views/KeyboardControllerViewManager.mm +3 -0
- package/ios/views/KeyboardControllerViewManager.swift +13 -1
- package/lib/commonjs/animated.js +14 -4
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js +4 -1
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +4 -2
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/compat.js +65 -0
- package/lib/commonjs/compat.js.map +1 -0
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +25 -7
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/context.js +1 -0
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks/index.js +2 -1
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +5 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/types/internal.js.map +1 -1
- package/lib/commonjs/types/module.js.map +1 -1
- package/lib/module/animated.js +16 -6
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js +3 -0
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +3 -1
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/compat.js +58 -0
- package/lib/module/compat.js.map +1 -0
- package/lib/module/components/KeyboardAwareScrollView/index.js +26 -8
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/context.js +1 -0
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js +4 -0
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/module/types/internal.js.map +1 -1
- package/lib/module/types/module.js.map +1 -1
- package/lib/typescript/bindings.d.ts +3 -0
- package/lib/typescript/bindings.native.d.ts +1 -0
- package/lib/typescript/compat.d.ts +27 -0
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +4 -1
- package/lib/typescript/components/index.d.ts +1 -1
- package/lib/typescript/context.d.ts +2 -0
- package/lib/typescript/hooks/index.d.ts +1 -0
- package/lib/typescript/hooks/useKeyboardState/index.d.ts +3 -3
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +4 -0
- package/lib/typescript/types/internal.d.ts +1 -1
- package/lib/typescript/types/module.d.ts +3 -2
- package/package.json +1 -1
- package/src/animated.tsx +32 -6
- package/src/bindings.native.ts +4 -1
- package/src/bindings.ts +5 -0
- package/src/compat.ts +61 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +43 -11
- package/src/components/index.ts +4 -1
- package/src/context.ts +3 -0
- package/src/hooks/index.ts +4 -1
- package/src/hooks/useKeyboardState/index.ts +4 -4
- package/src/index.ts +2 -0
- package/src/specs/KeyboardControllerViewNativeComponent.ts +11 -0
- package/src/types/internal.ts +3 -1
- package/src/types/module.ts +3 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_hooks","_findNodeHandle","_useSmoothKeyboardHandler","_utils","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","KeyboardAwareScrollView","forwardRef","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","Reanimated","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","useAnimatedRef","scrollViewTarget","useSharedValue","scrollPosition","position","useScrollViewOffset","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","useReanimatedFocusedInput","layout","lastSelection","height","useWindowDimensions","onRef","useCallback","assignedRef","current","onScrollViewLayout","value","findNodeHandle","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","interpolate","scrollDistanceWithRespectToSnapPoints","targetScrollY","Math","max","scrollTo","positionOnScreen","topOfScreen","performScrollWithPositionRestoration","newPosition","prevScroll","syncKeyboardFrame","keyboardFrame","updateLayoutFromSelection","_lastSelection$value","_input$value","customHeight","selection","end","y","clamp","scrollFromCurrentPosition","prevLayout","onChangeText","onChangeTextHandler","useMemo","debounce","onSelectionChange","_lastSelection$value2","_lastSelection$value3","lastTarget","target","latestSelection","start","useFocusedInputHandler","useSmoothKeyboardHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","onMove","onEnd","useEffect","runOnUI","useAnimatedReaction","previous","view","useAnimatedStyle","paddingBottom","createElement","scrollEventThrottle","View","style","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useMemo } from \"react\";\nimport Reanimated, {\n clamp,\n interpolate,\n runOnUI,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useScrollViewOffset,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\nimport { findNodeHandle } from \"../../utils/findNodeHandle\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n NativeEvent,\n} from \"react-native-keyboard-controller\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between the keyboard and the caret inside a focused `TextInput` when the keyboard is shown. Default is `0`. */\n bottomOffset?: number;\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\n disableScrollOnKeyboardHide?: boolean;\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true`. */\n enabled?: boolean;\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */\n extraKeyboardSpace?: number;\n /** Custom component for `ScrollView`. Default is `ScrollView`. */\n ScrollViewComponent?: React.ComponentType<ScrollViewProps>;\n} & ScrollViewProps;\n\n// Everything begins from `onStart` handler. This handler is called every time,\n// when keyboard changes its size or when focused `TextInput` was changed. In\n// this handler we are calculating/memoizing values which later will be used\n// during layout movement. For that we calculate:\n// - layout of focused field (`layout`) - to understand whether there will be overlap\n// - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\n// - future keyboard height (`keyboardHeight`) - used in scroll interpolation\n// - current scroll position (`scrollPosition`) - used to scroll from this point\n//\n// Once we've calculated all necessary variables - we can actually start to use them.\n// It happens in `onMove` handler - this function simply calls `maybeScroll` with\n// current keyboard frame height. This functions makes the smooth transition.\n//\n// When the transition has finished we go to `onEnd` handler. In this handler\n// we verify, that the current field is not overlapped within a keyboard frame.\n// For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\n// however there could be some cases, when `onMove` is not called:\n// - on iOS when TextInput was changed - keyboard transition is instant\n// - on Android when TextInput was changed and keyboard size wasn't changed\n// So `onEnd` handler handle the case, when `onMove` wasn't triggered.\n//\n// ====================================================================================================================+\n// -----------------------------------------------------Flow chart-----------------------------------------------------+\n// ====================================================================================================================+\n//\n// +============================+ +============================+ +==================================+\n// + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\n// + + + (run `onStart`) + + `onMove` is getting called +\n// +============================+ +============================+ +==================================+\n//\n// +============================+ +============================+ +=====================================+\n// + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\n// + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\n// +============================+ +============================+ +=====================================+\n//\n\n/**\n * A ScrollView component that automatically handles keyboard appearance and disappearance\n * by adjusting its content position to ensure the focused input remains visible.\n *\n * The component uses a sophisticated animation system to smoothly handle keyboard transitions\n * and maintain proper scroll position during keyboard interactions.\n *\n * @returns A ScrollView component that handles keyboard interactions.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardAwareScrollView bottomOffset={20}>\n * <TextInput placeholder=\"Enter text\" />\n * <TextInput placeholder=\"Another input\" />\n * </KeyboardAwareScrollView>\n * ```\n */\nconst KeyboardAwareScrollView = forwardRef<\n ScrollView,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n ScrollViewComponent = Reanimated.ScrollView,\n snapToOffsets,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const position = useScrollViewOffset(scrollViewAnimatedRef);\n const currentKeyboardFrameHeight = useSharedValue(0);\n const keyboardHeight = useSharedValue(0);\n const keyboardWillAppear = useSharedValue(false);\n const tag = useSharedValue(-1);\n const initialKeyboardSize = useSharedValue(0);\n const scrollBeforeKeyboardMovement = useSharedValue(0);\n const { input } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const lastSelection =\n useSharedValue<FocusedInputSelectionChangedEvent | null>(null);\n\n const { height } = useWindowDimensions();\n\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\n if (typeof ref === \"function\") {\n ref(assignedRef);\n } else if (ref) {\n ref.current = assignedRef;\n }\n\n scrollViewAnimatedRef(assignedRef);\n }, []);\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving.\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (point < 0) {\n const positionOnScreen = visibleRect - bottomOffset;\n const topOfScreen = scrollPosition.value + point;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, snapToOffsets],\n );\n const performScrollWithPositionRestoration = useCallback(\n (newPosition: number) => {\n \"worklet\";\n\n const prevScroll = scrollPosition.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n scrollPosition.value = newPosition;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScroll;\n },\n [scrollPosition, keyboardHeight, maybeScroll],\n );\n const syncKeyboardFrame = useCallback(\n (e: NativeEvent) => {\n \"worklet\";\n\n const keyboardFrame = interpolate(\n e.height,\n [0, keyboardHeight.value],\n [0, keyboardHeight.value + extraKeyboardSpace],\n );\n\n currentKeyboardFrameHeight.value = keyboardFrame;\n },\n [extraKeyboardSpace],\n );\n\n const updateLayoutFromSelection = useCallback(() => {\n \"worklet\";\n\n const customHeight = lastSelection.value?.selection.end.y;\n\n if (!input.value?.layout || !customHeight) {\n return false;\n }\n\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n // when we have multiline input with limited amount of lines, then custom height can be very big\n // so we clamp it to max input height\n height: clamp(customHeight, 0, input.value.layout.height),\n },\n };\n\n return true;\n }, [input, lastSelection, layout]);\n const scrollFromCurrentPosition = useCallback(() => {\n \"worklet\";\n\n const prevLayout = layout.value;\n\n if (!updateLayoutFromSelection()) {\n return;\n }\n\n performScrollWithPositionRestoration(position.value);\n\n layout.value = prevLayout;\n }, [performScrollWithPositionRestoration]);\n const onChangeText = useCallback(() => {\n \"worklet\";\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n const lastTarget = lastSelection.value?.target;\n const latestSelection = lastSelection.value?.selection;\n\n lastSelection.value = e;\n\n if (e.target !== lastTarget) {\n // ignore this event, because \"focus changed\" event handled in `useSmoothKeyboardHandler`\n return;\n }\n // caret in the end + end coordinates has been changed -> we moved to a new line\n // so input may grow\n if (\n e.selection.end.position === e.selection.start.position &&\n latestSelection?.end.y !== e.selection.end.y\n ) {\n return scrollFromCurrentPosition();\n }\n // selection has been changed\n if (e.selection.start.position !== e.selection.end.position) {\n return scrollFromCurrentPosition();\n }\n\n onChangeTextHandler();\n },\n [scrollFromCurrentPosition, onChangeTextHandler],\n );\n\n useFocusedInputHandler(\n {\n onSelectionChange: onSelectionChange,\n },\n [onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n }\n\n if (\n keyboardWillAppear.value ||\n keyboardWillChangeSize ||\n focusWasChanged\n ) {\n // persist scroll value\n scrollPosition.value = position.value;\n // just persist height - later will be used in interpolation\n keyboardHeight.value = e.height;\n }\n\n // focus was changed\n if (focusWasChanged) {\n tag.value = e.target;\n // save position of focused text input when keyboard starts to move\n updateLayoutFromSelection();\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && !keyboardWillAppear.value) {\n // update position on scroll value, so `onEnd` handler\n // will pick up correct values\n position.value += maybeScroll(e.height, true);\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n syncKeyboardFrame(e);\n },\n },\n [maybeScroll, disableScrollOnKeyboardHide, syncKeyboardFrame],\n );\n\n useEffect(() => {\n runOnUI(performScrollWithPositionRestoration)(\n scrollBeforeKeyboardMovement.value,\n );\n }, [bottomOffset]);\n\n useAnimatedReaction(\n () => input.value,\n (current, previous) => {\n if (\n current?.target === previous?.target &&\n current?.layout.height !== previous?.layout.height\n ) {\n // input has changed layout - let's check if we need to scroll\n // may happen when you paste text, then onSelectionChange will be\n // fired earlier than text actually changes its layout\n scrollFromCurrentPosition();\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\n // re-calculation on every animation frame and it helps to achieve smooth animation.\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\n paddingBottom: currentKeyboardFrameHeight.value + 1,\n }\n : {},\n [enabled],\n );\n\n return (\n <ScrollViewComponent\n ref={onRef}\n {...rest}\n scrollEventThrottle={16}\n onLayout={onScrollViewLayout}\n >\n {children}\n {enabled && <Reanimated.View style={view} />}\n </ScrollViewComponent>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAYA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA0E,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,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,CAA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MACA;MACA;MACA;MACA0C,yBAAyB,CAAC,CAAC;IAC7B;EACF,CAAC,EACD,EACF,CAAC;EAED,MAAMyB,IAAI,GAAG,IAAAC,uCAAgB,EAC3B,MACE7F,OAAO,GACH;IACE;IACA;IACA;IACA;IACA;IACA;IACA8F,aAAa,EAAE/E,0BAA0B,CAACiB,KAAK,GAAG;EACpD,CAAC,GACD,CAAC,CAAC,EACR,CAAChC,OAAO,CACV,CAAC;EAED,oBACEvC,MAAA,CAAAkB,OAAA,CAAAoH,aAAA,CAAC7F,mBAAmB,EAAAd,QAAA;IAClBmB,GAAG,EAAEoB;EAAM,GACPrB,IAAI;IACR0F,mBAAmB,EAAE,EAAG;IACxBnG,QAAQ,EAAEkC;EAAmB,IAE5BnC,QAAQ,EACRI,OAAO,iBAAIvC,MAAA,CAAAkB,OAAA,CAAAoH,aAAA,CAACnI,sBAAA,CAAAe,OAAU,CAACsH,IAAI;IAACC,KAAK,EAAEN;EAAK,CAAE,CACxB,CAAC;AAE1B,CACF,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAzH,OAAA,GAEae,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_hooks","_findNodeHandle","_useSmoothKeyboardHandler","_utils","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","KeyboardAwareScrollView","forwardRef","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","Reanimated","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","useAnimatedRef","scrollViewRef","React","useRef","scrollViewTarget","useSharedValue","scrollPosition","position","useScrollViewOffset","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","update","useReanimatedFocusedInput","layout","lastSelection","height","useWindowDimensions","onRef","useCallback","assignedRef","current","onScrollViewLayout","value","findNodeHandle","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","interpolate","scrollDistanceWithRespectToSnapPoints","targetScrollY","Math","max","scrollTo","positionOnScreen","topOfScreen","performScrollWithPositionRestoration","newPosition","prevScroll","syncKeyboardFrame","keyboardFrame","updateLayoutFromSelection","_lastSelection$value","_input$value","customHeight","selection","end","y","clamp","scrollFromCurrentPosition","prevLayout","onChangeText","onChangeTextHandler","useMemo","debounce","onSelectionChange","_lastSelection$value2","_lastSelection$value3","lastTarget","target","latestSelection","start","useFocusedInputHandler","useSmoothKeyboardHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","onMove","onEnd","synchronize","runOnUI","useImperativeHandle","scrollView","existingMethods","assureFocusedInputVisible","useEffect","useAnimatedReaction","previous","view","useAnimatedStyle","paddingBottom","createElement","scrollEventThrottle","View","style","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n} from \"react\";\nimport Reanimated, {\n clamp,\n interpolate,\n runOnUI,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useScrollViewOffset,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\nimport { findNodeHandle } from \"../../utils/findNodeHandle\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type {\n FocusedInputLayoutChangedEvent,\n FocusedInputSelectionChangedEvent,\n NativeEvent,\n} from \"react-native-keyboard-controller\";\n\nexport type KeyboardAwareScrollViewProps = {\n /** The distance between the keyboard and the caret inside a focused `TextInput` when the keyboard is shown. Default is `0`. */\n bottomOffset?: number;\n /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */\n disableScrollOnKeyboardHide?: boolean;\n /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true`. */\n enabled?: boolean;\n /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */\n extraKeyboardSpace?: number;\n /** Custom component for `ScrollView`. Default is `ScrollView`. */\n ScrollViewComponent?: React.ComponentType<ScrollViewProps>;\n} & ScrollViewProps;\nexport type KeyboardAwareScrollViewRef = {\n assureFocusedInputVisible: () => void;\n} & ScrollView;\n\n// Everything begins from `onStart` handler. This handler is called every time,\n// when keyboard changes its size or when focused `TextInput` was changed. In\n// this handler we are calculating/memoizing values which later will be used\n// during layout movement. For that we calculate:\n// - layout of focused field (`layout`) - to understand whether there will be overlap\n// - initial keyboard size (`initialKeyboardSize`) - used in scroll interpolation\n// - future keyboard height (`keyboardHeight`) - used in scroll interpolation\n// - current scroll position (`scrollPosition`) - used to scroll from this point\n//\n// Once we've calculated all necessary variables - we can actually start to use them.\n// It happens in `onMove` handler - this function simply calls `maybeScroll` with\n// current keyboard frame height. This functions makes the smooth transition.\n//\n// When the transition has finished we go to `onEnd` handler. In this handler\n// we verify, that the current field is not overlapped within a keyboard frame.\n// For full `onStart`/`onMove`/`onEnd` flow it may look like a redundant thing,\n// however there could be some cases, when `onMove` is not called:\n// - on iOS when TextInput was changed - keyboard transition is instant\n// - on Android when TextInput was changed and keyboard size wasn't changed\n// So `onEnd` handler handle the case, when `onMove` wasn't triggered.\n//\n// ====================================================================================================================+\n// -----------------------------------------------------Flow chart-----------------------------------------------------+\n// ====================================================================================================================+\n//\n// +============================+ +============================+ +==================================+\n// + User Press on TextInput + => + Keyboard starts showing + => + As keyboard moves frame by frame + =>\n// + + + (run `onStart`) + + `onMove` is getting called +\n// +============================+ +============================+ +==================================+\n//\n// +============================+ +============================+ +=====================================+\n// + Keyboard is shown and we + => + User moved focus to + => + Only `onStart`/`onEnd` maybe called +\n// + call `onEnd` handler + + another `TextInput` + + (without involving `onMove`) +\n// +============================+ +============================+ +=====================================+\n//\n\n/**\n * A ScrollView component that automatically handles keyboard appearance and disappearance\n * by adjusting its content position to ensure the focused input remains visible.\n *\n * The component uses a sophisticated animation system to smoothly handle keyboard transitions\n * and maintain proper scroll position during keyboard interactions.\n *\n * @returns A ScrollView component that handles keyboard interactions.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardAwareScrollView bottomOffset={20}>\n * <TextInput placeholder=\"Enter text\" />\n * <TextInput placeholder=\"Another input\" />\n * </KeyboardAwareScrollView>\n * ```\n */\nconst KeyboardAwareScrollView = forwardRef<\n KeyboardAwareScrollViewRef,\n React.PropsWithChildren<KeyboardAwareScrollViewProps>\n>(\n (\n {\n children,\n onLayout,\n bottomOffset = 0,\n disableScrollOnKeyboardHide = false,\n enabled = true,\n extraKeyboardSpace = 0,\n ScrollViewComponent = Reanimated.ScrollView,\n snapToOffsets,\n ...rest\n },\n ref,\n ) => {\n const scrollViewAnimatedRef = useAnimatedRef<Reanimated.ScrollView>();\n const scrollViewRef = React.useRef<ScrollView>(null);\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const position = useScrollViewOffset(scrollViewAnimatedRef);\n const currentKeyboardFrameHeight = useSharedValue(0);\n const keyboardHeight = useSharedValue(0);\n const keyboardWillAppear = useSharedValue(false);\n const tag = useSharedValue(-1);\n const initialKeyboardSize = useSharedValue(0);\n const scrollBeforeKeyboardMovement = useSharedValue(0);\n const { input, update } = useReanimatedFocusedInput();\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const lastSelection =\n useSharedValue<FocusedInputSelectionChangedEvent | null>(null);\n\n const { height } = useWindowDimensions();\n\n const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {\n scrollViewRef.current = assignedRef;\n\n scrollViewAnimatedRef(assignedRef);\n }, []);\n const onScrollViewLayout = useCallback(\n (e: LayoutChangeEvent) => {\n scrollViewTarget.value = findNodeHandle(scrollViewAnimatedRef.current);\n\n onLayout?.(e);\n },\n [onLayout],\n );\n\n /**\n * Function that will scroll a ScrollView as keyboard gets moving.\n */\n const maybeScroll = useCallback(\n (e: number, animated: boolean = false) => {\n \"worklet\";\n\n if (!enabled) {\n return 0;\n }\n\n // input belongs to ScrollView\n if (layout.value?.parentScrollViewTarget !== scrollViewTarget.value) {\n return 0;\n }\n\n const visibleRect = height - keyboardHeight.value;\n const absoluteY = layout.value?.layout.absoluteY || 0;\n const inputHeight = layout.value?.layout.height || 0;\n const point = absoluteY + inputHeight;\n\n if (visibleRect - point <= bottomOffset) {\n const relativeScrollTo =\n keyboardHeight.value - (height - point) + bottomOffset;\n const interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [\n 0,\n scrollDistanceWithRespectToSnapPoints(\n relativeScrollTo + scrollPosition.value,\n snapToOffsets,\n ) - scrollPosition.value,\n ],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (point < 0) {\n const positionOnScreen = visibleRect - bottomOffset;\n const topOfScreen = scrollPosition.value + point;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled, height, snapToOffsets],\n );\n const performScrollWithPositionRestoration = useCallback(\n (newPosition: number) => {\n \"worklet\";\n\n const prevScroll = scrollPosition.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n scrollPosition.value = newPosition;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScroll;\n },\n [scrollPosition, keyboardHeight, maybeScroll],\n );\n const syncKeyboardFrame = useCallback(\n (e: NativeEvent) => {\n \"worklet\";\n\n const keyboardFrame = interpolate(\n e.height,\n [0, keyboardHeight.value],\n [0, keyboardHeight.value + extraKeyboardSpace],\n );\n\n currentKeyboardFrameHeight.value = keyboardFrame;\n },\n [extraKeyboardSpace],\n );\n\n const updateLayoutFromSelection = useCallback(() => {\n \"worklet\";\n\n const customHeight = lastSelection.value?.selection.end.y;\n\n if (!input.value?.layout || !customHeight) {\n return false;\n }\n\n layout.value = {\n ...input.value,\n layout: {\n ...input.value.layout,\n // when we have multiline input with limited amount of lines, then custom height can be very big\n // so we clamp it to max input height\n height: clamp(customHeight, 0, input.value.layout.height),\n },\n };\n\n return true;\n }, [input, lastSelection, layout]);\n const scrollFromCurrentPosition = useCallback(() => {\n \"worklet\";\n\n const prevLayout = layout.value;\n\n if (!updateLayoutFromSelection()) {\n return;\n }\n\n performScrollWithPositionRestoration(position.value);\n\n layout.value = prevLayout;\n }, [performScrollWithPositionRestoration]);\n const onChangeText = useCallback(() => {\n \"worklet\";\n scrollFromCurrentPosition();\n }, [scrollFromCurrentPosition]);\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n const onSelectionChange = useCallback(\n (e: FocusedInputSelectionChangedEvent) => {\n \"worklet\";\n\n const lastTarget = lastSelection.value?.target;\n const latestSelection = lastSelection.value?.selection;\n\n lastSelection.value = e;\n\n if (e.target !== lastTarget) {\n // ignore this event, because \"focus changed\" event handled in `useSmoothKeyboardHandler`\n return;\n }\n // caret in the end + end coordinates has been changed -> we moved to a new line\n // so input may grow\n if (\n e.selection.end.position === e.selection.start.position &&\n latestSelection?.end.y !== e.selection.end.y\n ) {\n return scrollFromCurrentPosition();\n }\n // selection has been changed\n if (e.selection.start.position !== e.selection.end.position) {\n return scrollFromCurrentPosition();\n }\n\n onChangeTextHandler();\n },\n [scrollFromCurrentPosition, onChangeTextHandler],\n );\n\n useFocusedInputHandler(\n {\n onSelectionChange: onSelectionChange,\n },\n [onSelectionChange],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\n\n const keyboardWillHide = e.height === 0;\n const focusWasChanged =\n (tag.value !== e.target && e.target !== -1) ||\n keyboardWillChangeSize;\n\n if (keyboardWillChangeSize) {\n initialKeyboardSize.value = keyboardHeight.value;\n }\n\n if (keyboardWillHide) {\n // on back transition need to interpolate as [0, keyboardHeight]\n initialKeyboardSize.value = 0;\n scrollPosition.value = scrollBeforeKeyboardMovement.value;\n }\n\n if (\n keyboardWillAppear.value ||\n keyboardWillChangeSize ||\n focusWasChanged\n ) {\n // persist scroll value\n scrollPosition.value = position.value;\n // just persist height - later will be used in interpolation\n keyboardHeight.value = e.height;\n }\n\n // focus was changed\n if (focusWasChanged) {\n tag.value = e.target;\n // save position of focused text input when keyboard starts to move\n updateLayoutFromSelection();\n // save current scroll position - when keyboard will hide we'll reuse\n // this value to achieve smooth hide effect\n scrollBeforeKeyboardMovement.value = position.value;\n }\n\n if (focusWasChanged && !keyboardWillAppear.value) {\n // update position on scroll value, so `onEnd` handler\n // will pick up correct values\n position.value += maybeScroll(e.height, true);\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n // if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens\n if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {\n maybeScroll(e.height);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n syncKeyboardFrame(e);\n },\n },\n [maybeScroll, disableScrollOnKeyboardHide, syncKeyboardFrame],\n );\n\n const synchronize = useCallback(async () => {\n await update();\n\n runOnUI(() => {\n \"worklet\";\n\n scrollFromCurrentPosition();\n })();\n }, [update, scrollFromCurrentPosition]);\n\n useImperativeHandle(\n ref,\n () => {\n const scrollView = scrollViewRef.current;\n\n const existingMethods = scrollView ? { ...scrollView } : {};\n\n return {\n ...existingMethods,\n\n assureFocusedInputVisible: () => {\n synchronize();\n },\n } as KeyboardAwareScrollViewRef;\n },\n [synchronize],\n );\n\n useEffect(() => {\n synchronize();\n }, [bottomOffset]);\n\n useAnimatedReaction(\n () => input.value,\n (current, previous) => {\n if (\n current?.target === previous?.target &&\n current?.layout.height !== previous?.layout.height\n ) {\n // input has changed layout - let's check if we need to scroll\n // may happen when you paste text, then onSelectionChange will be\n // fired earlier than text actually changes its layout\n scrollFromCurrentPosition();\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)\n // this happens because the layout recalculates on every frame. To avoid this we slightly increase padding\n // by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation\n // from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout\n // re-calculation on every animation frame and it helps to achieve smooth animation.\n // see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342\n paddingBottom: currentKeyboardFrameHeight.value + 1,\n }\n : {},\n [enabled],\n );\n\n return (\n <ScrollViewComponent\n ref={onRef}\n {...rest}\n scrollEventThrottle={16}\n onLayout={onScrollViewLayout}\n >\n {children}\n {enabled && <Reanimated.View style={view} />}\n </ScrollViewComponent>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAYA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA0E,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAA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,CAAC,GACD,CAAC,CAAC,EACR,CAACpC,OAAO,CACV,CAAC;EAED,oBACEvC,MAAA,CAAAkB,OAAA,CAAA6H,aAAA,CAACtG,mBAAmB,EAAAd,QAAA;IAClBmB,GAAG,EAAEwB;EAAM,GACPzB,IAAI;IACRmG,mBAAmB,EAAE,EAAG;IACxB5G,QAAQ,EAAEsC;EAAmB,IAE5BvC,QAAQ,EACRI,OAAO,iBAAIvC,MAAA,CAAAkB,OAAA,CAAA6H,aAAA,CAAC5I,sBAAA,CAAAe,OAAU,CAAC+H,IAAI;IAACC,KAAK,EAAEN;EAAK,CAAE,CACxB,CAAC;AAE1B,CACF,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAlI,OAAA,GAEae,uBAAuB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","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 type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {
|
|
1
|
+
{"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","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 type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\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;AAG2B,SAAAI,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,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,SAAAP,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
|
package/lib/commonjs/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Animated","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","exports","createContext","useKeyboardContext","context","useContext","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport type { FocusedInputLayoutChangedEvent } from \"./types\";\nimport type React from \"react\";\nimport type {\n EventHandlerProcessed,\n SharedValue,\n} from \"react-native-reanimated\";\n\nexport type AnimatedContext = {\n /**\n * A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.\n * Represented as `Animated.Value`.\n */\n progress: Animated.Value;\n /** Height of the keyboard. Represented as `Animated.Value`. */\n height: Animated.AnimatedMultiplication<number>;\n};\nexport type ReanimatedContext = {\n /**\n * A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.\n * Represented as `SharedValue`.\n */\n progress: SharedValue<number>;\n /** Height of the keyboard. Represented as `SharedValue`. */\n height: SharedValue<number>;\n};\nexport type KeyboardAnimationContext = {\n /** Whether KeyboardController library is active or not. */\n enabled: boolean;\n /** Object that stores animated values that reflect the keyboard’s current position and movement. */\n animated: AnimatedContext;\n /** Object that stores reanimated values that reflect the keyboard’s current position and movement. */\n reanimated: ReanimatedContext;\n /** Layout of the focused `TextInput` represented as `SharedValue`. */\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\n /** Method for setting workletized keyboard handlers. */\n setKeyboardHandlers: (\n handlers: EventHandlerProcessed<never, never>,\n ) => () => void;\n /** Method for setting workletized handlers for tracking focused input events. */\n setInputHandlers: (\n handlers: EventHandlerProcessed<never, never>,\n ) => () => void;\n /** Method to enable/disable KeyboardController library. */\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\n};\nconst NOOP = () => {};\nconst NESTED_NOOP = () => NOOP;\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\n value,\n addListener: NOOP,\n removeListener: NOOP,\n modify: NOOP,\n get: () => value,\n set: NOOP,\n});\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\n null,\n);\nconst defaultContext: KeyboardAnimationContext = {\n enabled: true,\n animated: {\n progress: new Animated.Value(0),\n height: new Animated.Value(0),\n },\n reanimated: {\n progress: DEFAULT_SHARED_VALUE,\n height: DEFAULT_SHARED_VALUE,\n },\n layout: DEFAULT_LAYOUT,\n setKeyboardHandlers: NESTED_NOOP,\n setInputHandlers: NESTED_NOOP,\n setEnabled: NOOP,\n};\n\nexport const KeyboardContext = createContext(defaultContext);\n\n/**\n * A hook that returns a reference to {@link KeyboardAnimationContext} object.\n *\n * @returns Object {@link KeyboardAnimationContext|containing} keyboard-controller context.\n * @example\n * ```ts\n * const context = useKeyboardContext();\n *\n * useLayoutEffect(() => {\n * const cleanup = context.setInputHandlers(handler);\n *\n * return () => cleanup();\n * }, deps);\n * ```\n */\nexport const useKeyboardContext = () => {\n const context = useContext(KeyboardContext);\n\n if (__DEV__ && context === defaultContext) {\n console.warn(\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\n );\n }\n\n return context;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","NOOP","NESTED_NOOP","withSharedValue","value","addListener","removeListener","modify","get","set","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Animated","Value","height","reanimated","layout","update","Promise","resolve","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","exports","createContext","useKeyboardContext","context","useContext","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport type { FocusedInputLayoutChangedEvent } from \"./types\";\nimport type React from \"react\";\nimport type {\n EventHandlerProcessed,\n SharedValue,\n} from \"react-native-reanimated\";\n\nexport type AnimatedContext = {\n /**\n * A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.\n * Represented as `Animated.Value`.\n */\n progress: Animated.Value;\n /** Height of the keyboard. Represented as `Animated.Value`. */\n height: Animated.AnimatedMultiplication<number>;\n};\nexport type ReanimatedContext = {\n /**\n * A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.\n * Represented as `SharedValue`.\n */\n progress: SharedValue<number>;\n /** Height of the keyboard. Represented as `SharedValue`. */\n height: SharedValue<number>;\n};\nexport type KeyboardAnimationContext = {\n /** Whether KeyboardController library is active or not. */\n enabled: boolean;\n /** Object that stores animated values that reflect the keyboard’s current position and movement. */\n animated: AnimatedContext;\n /** Object that stores reanimated values that reflect the keyboard’s current position and movement. */\n reanimated: ReanimatedContext;\n /** Layout of the focused `TextInput` represented as `SharedValue`. */\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\n /** Method for updating info about focused input layout. */\n update: () => Promise<void>;\n /** Method for setting workletized keyboard handlers. */\n setKeyboardHandlers: (\n handlers: EventHandlerProcessed<never, never>,\n ) => () => void;\n /** Method for setting workletized handlers for tracking focused input events. */\n setInputHandlers: (\n handlers: EventHandlerProcessed<never, never>,\n ) => () => void;\n /** Method to enable/disable KeyboardController library. */\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\n};\nconst NOOP = () => {};\nconst NESTED_NOOP = () => NOOP;\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\n value,\n addListener: NOOP,\n removeListener: NOOP,\n modify: NOOP,\n get: () => value,\n set: NOOP,\n});\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\n null,\n);\nconst defaultContext: KeyboardAnimationContext = {\n enabled: true,\n animated: {\n progress: new Animated.Value(0),\n height: new Animated.Value(0),\n },\n reanimated: {\n progress: DEFAULT_SHARED_VALUE,\n height: DEFAULT_SHARED_VALUE,\n },\n layout: DEFAULT_LAYOUT,\n update: Promise.resolve,\n setKeyboardHandlers: NESTED_NOOP,\n setInputHandlers: NESTED_NOOP,\n setEnabled: NOOP,\n};\n\nexport const KeyboardContext = createContext(defaultContext);\n\n/**\n * A hook that returns a reference to {@link KeyboardAnimationContext} object.\n *\n * @returns Object {@link KeyboardAnimationContext|containing} keyboard-controller context.\n * @example\n * ```ts\n * const context = useKeyboardContext();\n *\n * useLayoutEffect(() => {\n * const cleanup = context.setInputHandlers(handler);\n *\n * return () => cleanup();\n * }, deps);\n * ```\n */\nexport const useKeyboardContext = () => {\n const context = useContext(KeyboardContext);\n\n if (__DEV__ && context === defaultContext) {\n console.warn(\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\n );\n }\n\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AAIF,OAAO,KAAKnB,cAAc,EAAE;IACzCsB,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOJ,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNativeReanimated","_constants","_context","_module","_useWindowDimensions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useKeyboardState","useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useKeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","doDependenciesDiffer","useHandler","eventHandler","useEvent","event","eventName","endsWith","_handler$onStart","onStart","_handler$onMove","onMove","_handler$onEnd","onEnd","_handler$onInteractiv","onInteractive","useLayoutEffect","cleanup","setKeyboardHandlers","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","_handler$onChangeText","onChangeText","_handler$onSelectionC","onSelectionChange","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\nimport { useEvent, useHandler } from \"react-native-reanimated\";\n\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\nimport { KeyboardController } from \"../module\";\n\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\nimport type {\n FocusedInputHandler,\n FocusedInputSelectionChangedEvent,\n FocusedInputTextChangedEvent,\n KeyboardHandler,\n NativeEvent,\n} from \"../types\";\n\n/**\n * Hook that sets the Android soft input mode to adjust resize on mount and\n * restores default mode on unmount. This ensures the keyboard behavior is consistent\n * on all Android versions.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * useResizeMode();\n * return <View />;\n * }\n * ```\n */\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\n/**\n * Hook that provides animated (`height`/`progress`) values for tracking keyboard movement.\n * Automatically sets the resize mode for Android.\n *\n * @returns Object {@link AnimatedContext|containing} animated values for keyboard movement.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-animation|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { height, progress } = useKeyboardAnimation();\n * return <Animated.View style={{ transform: [{ translateY: height }] }} />;\n * }\n * ```\n */\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.animated;\n};\n\n/**\n * Hook that provides reanimated (`height`/`progress`) values for tracking keyboard movement.\n * Automatically sets the resize mode for Android.\n *\n * @returns Object {@link ReanimatedContext|containing} reanimated values for keyboard movement.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-reanimated-keyboard-animation|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { height, progress } = useReanimatedKeyboardAnimation();\n * return <Reanimated.View style={{ transform: [{ translateY: height }] }} />;\n * }\n * ```\n */\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.reanimated;\n};\n\n/**\n * An alternative to {@link useKeyboardHandler} that doesn't set resize mode on mount. If your\n * app already uses `adjustResize`, then you can use this hook instead of `useKeyboardHandler`.\n *\n * @param handler - Object containing keyboard event handlers.\n * @param [deps] - Dependencies array for the effect.\n * @example\n * ```tsx\n * function MyComponent() {\n * const height = useSharedValue(0);\n * const progress = useSharedValue(0);\n *\n * useGenericKeyboardHandler({\n * onMove: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * onEnd: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * }, []);\n *\n * return <Reanimated.View style={{ height: height }] }} />;\n * }\n * ```\n */\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: unknown[],\n) {\n const context = useKeyboardContext();\n\n const { doDependenciesDiffer } = useHandler(handler, deps);\n\n const eventHandler = useEvent<NativeEvent>(\n (event) => {\n \"worklet\";\n\n if (event.eventName.endsWith(\"onKeyboardMoveStart\")) {\n handler.onStart?.(event);\n }\n\n if (event.eventName.endsWith(\"onKeyboardMove\")) {\n handler.onMove?.(event);\n }\n\n if (event.eventName.endsWith(\"onKeyboardMoveEnd\")) {\n handler.onEnd?.(event);\n }\n\n if (event.eventName.endsWith(\"onKeyboardMoveInteractive\")) {\n handler.onInteractive?.(event);\n }\n },\n [\n \"onKeyboardMoveStart\",\n \"onKeyboardMove\",\n \"onKeyboardMoveEnd\",\n \"onKeyboardMoveInteractive\",\n ],\n doDependenciesDiffer,\n );\n\n useLayoutEffect(() => {\n const cleanup = context.setKeyboardHandlers(eventHandler);\n\n return () => cleanup();\n }, deps);\n}\n\n/**\n * Hook that gives an access to each aspect of keyboard movement with workletized `onStart`/`onMove`/`onInteractive`/`onEnd` handlers.\n *\n * @param handler - Object containing keyboard event handlers.\n * @param [deps] - Dependencies array for the effect.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-handler|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const height = useSharedValue(0);\n * const progress = useSharedValue(0);\n *\n * useKeyboardHandler({\n * onMove: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * onEnd: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * }, []);\n *\n * return <Reanimated.View style={{ height: height }] }} />;\n * }\n * ```\n */\nexport function useKeyboardHandler(handler: KeyboardHandler, deps?: unknown[]) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n\n/**\n * Hook for controlling keyboard controller module.\n * Allows to disable/enable it and check the actual state (whether it's enabled or not).\n * When disabled it fallbacks to default android keyboard handling and stops tracking all\n * the events that are exposed from this library.\n *\n * @property {Function} setEnabled - Function to enable/disable keyboard handling.\n * @property {boolean} enabled - Current enabled state.\n * @returns Object containing keyboard control functions and state.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/module/use-keyboard-controller|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { setEnabled, enabled } = useKeyboardController();\n * return (\n * <Button\n * title={enabled ? 'Disable' : 'Enable'}\n * onPress={() => setEnabled(!enabled)}\n * />\n * );\n * }\n * ```\n */\nexport function useKeyboardController() {\n const context = useKeyboardContext();\n\n return { setEnabled: context.setEnabled, enabled: context.enabled };\n}\n\n/**\n * Hook that provides access to the layout of the currently focused input.\n *\n * @returns Object containing reanimated values for focused input.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/input/use-reanimated-focused-input|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { input } = useReanimatedFocusedInput();\n * return <Reanimated.View style={{ height: input.value?.layout.height }} />;\n * }\n * ```\n */\nexport function useReanimatedFocusedInput() {\n const context = useKeyboardContext();\n\n return { input: context.layout };\n}\n\n/**\n * Hook for handling focused input events, such as changes of selection, text etc.\n *\n * @param handler - Object containing focused input event handlers.\n * @param [deps] - Dependencies array for the effect.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/input/use-focused-input-handler|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * useFocusedInputHandler({\n * onChangeText: (e) => console.log('Text changed:', e.text),\n * onSelectionChange: (e) => console.log('Selection changed:', e.selection)\n * });\n * return <View />;\n * }\n * ```\n */\nexport function useFocusedInputHandler(\n handler: FocusedInputHandler,\n deps?: unknown[],\n) {\n const context = useKeyboardContext();\n\n const { doDependenciesDiffer } = useHandler<never, never>(handler, deps);\n\n const eventHandler = useEvent<\n FocusedInputSelectionChangedEvent | FocusedInputTextChangedEvent\n >(\n (event) => {\n \"worklet\";\n\n if (event.eventName.endsWith(\"onFocusedInputTextChanged\")) {\n handler.onChangeText?.(event as FocusedInputTextChangedEvent);\n }\n\n if (event.eventName.endsWith(\"onFocusedInputSelectionChanged\")) {\n handler.onSelectionChange?.(event as FocusedInputSelectionChangedEvent);\n }\n },\n [\"onFocusedInputTextChanged\", \"onFocusedInputSelectionChanged\"],\n doDependenciesDiffer,\n );\n\n useLayoutEffect(() => {\n const cleanup = context.setInputHandlers(eventHandler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\nexport * from \"./useKeyboardState\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AA8RA,IAAAK,oBAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,oBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,oBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,oBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAlB,OAAA;AAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpC3B,OAA4B,EAC5BC,IAAgB,EAChB;EACA,MAAMP,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,MAAM;IAAEO;EAAqB,CAAC,GAAG,IAAAC,iCAAU,EAAeH,OAAO,EAAEC,IAAI,CAAC;EAExE,MAAMG,YAAY,GAAG,IAAAC,+BAAQ,EAG1BC,KAAK,IAAK;IACT,SAAS;;IAET,IAAIA,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,2BAA2B,CAAC,EAAE;MAAA,IAAAoB,qBAAA;MACzD,CAAAA,qBAAA,GAAA5B,OAAO,CAAC6B,YAAY,cAAAD,qBAAA,eAApBA,qBAAA,CAAAjD,IAAA,CAAAqB,OAAO,EAAgBM,KAAqC,CAAC;IAC/D;IAEA,IAAIA,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,gCAAgC,CAAC,EAAE;MAAA,IAAAsB,qBAAA;MAC9D,CAAAA,qBAAA,GAAA9B,OAAO,CAAC+B,iBAAiB,cAAAD,qBAAA,eAAzBA,qBAAA,CAAAnD,IAAA,CAAAqB,OAAO,EAAqBM,KAA0C,CAAC;IACzE;EACF,CAAC,EACD,CAAC,2BAA2B,EAAE,gCAAgC,CAAC,EAC/DJ,oBACF,CAAC;EAED,IAAAe,sBAAe,EAAC,MAAM;IACpB,MAAMC,OAAO,GAAGxB,OAAO,CAACsC,gBAAgB,CAAC5B,YAAY,CAAC;IAEtD,OAAO,MAAMc,OAAO,CAAC,CAAC;EACxB,CAAC,EAAEjB,IAAI,CAAC;AACV","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeReanimated","_constants","_context","_module","_useWindowDimensions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useKeyboardState","useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useKeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","doDependenciesDiffer","useHandler","eventHandler","useEvent","event","eventName","endsWith","_handler$onStart","onStart","_handler$onMove","onMove","_handler$onEnd","onEnd","_handler$onInteractiv","onInteractive","useLayoutEffect","cleanup","setKeyboardHandlers","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","update","useFocusedInputHandler","_handler$onChangeText","onChangeText","_handler$onSelectionC","onSelectionChange","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\nimport { useEvent, useHandler } from \"react-native-reanimated\";\n\nimport { AndroidSoftInputModes } from \"../constants\";\nimport { useKeyboardContext } from \"../context\";\nimport { KeyboardController } from \"../module\";\n\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\nimport type {\n FocusedInputHandler,\n FocusedInputSelectionChangedEvent,\n FocusedInputTextChangedEvent,\n KeyboardHandler,\n NativeEvent,\n} from \"../types\";\n\n/**\n * Hook that sets the Android soft input mode to adjust resize on mount and\n * restores default mode on unmount. This ensures the keyboard behavior is consistent\n * on all Android versions.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * useResizeMode();\n * return <View />;\n * }\n * ```\n */\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n\n/**\n * Hook that provides animated (`height`/`progress`) values for tracking keyboard movement.\n * Automatically sets the resize mode for Android.\n *\n * @returns Object {@link AnimatedContext|containing} animated values for keyboard movement.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-animation|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { height, progress } = useKeyboardAnimation();\n * return <Animated.View style={{ transform: [{ translateY: height }] }} />;\n * }\n * ```\n */\nexport const useKeyboardAnimation = (): AnimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.animated;\n};\n\n/**\n * Hook that provides reanimated (`height`/`progress`) values for tracking keyboard movement.\n * Automatically sets the resize mode for Android.\n *\n * @returns Object {@link ReanimatedContext|containing} reanimated values for keyboard movement.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-reanimated-keyboard-animation|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { height, progress } = useReanimatedKeyboardAnimation();\n * return <Reanimated.View style={{ transform: [{ translateY: height }] }} />;\n * }\n * ```\n */\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\n useResizeMode();\n const context = useKeyboardContext();\n\n return context.reanimated;\n};\n\n/**\n * An alternative to {@link useKeyboardHandler} that doesn't set resize mode on mount. If your\n * app already uses `adjustResize`, then you can use this hook instead of `useKeyboardHandler`.\n *\n * @param handler - Object containing keyboard event handlers.\n * @param [deps] - Dependencies array for the effect.\n * @example\n * ```tsx\n * function MyComponent() {\n * const height = useSharedValue(0);\n * const progress = useSharedValue(0);\n *\n * useGenericKeyboardHandler({\n * onMove: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * onEnd: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * }, []);\n *\n * return <Reanimated.View style={{ height: height }] }} />;\n * }\n * ```\n */\nexport function useGenericKeyboardHandler(\n handler: KeyboardHandler,\n deps?: unknown[],\n) {\n const context = useKeyboardContext();\n\n const { doDependenciesDiffer } = useHandler(handler, deps);\n\n const eventHandler = useEvent<NativeEvent>(\n (event) => {\n \"worklet\";\n\n if (event.eventName.endsWith(\"onKeyboardMoveStart\")) {\n handler.onStart?.(event);\n }\n\n if (event.eventName.endsWith(\"onKeyboardMove\")) {\n handler.onMove?.(event);\n }\n\n if (event.eventName.endsWith(\"onKeyboardMoveEnd\")) {\n handler.onEnd?.(event);\n }\n\n if (event.eventName.endsWith(\"onKeyboardMoveInteractive\")) {\n handler.onInteractive?.(event);\n }\n },\n [\n \"onKeyboardMoveStart\",\n \"onKeyboardMove\",\n \"onKeyboardMoveEnd\",\n \"onKeyboardMoveInteractive\",\n ],\n doDependenciesDiffer,\n );\n\n useLayoutEffect(() => {\n const cleanup = context.setKeyboardHandlers(eventHandler);\n\n return () => cleanup();\n }, deps);\n}\n\n/**\n * Hook that gives an access to each aspect of keyboard movement with workletized `onStart`/`onMove`/`onInteractive`/`onEnd` handlers.\n *\n * @param handler - Object containing keyboard event handlers.\n * @param [deps] - Dependencies array for the effect.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-handler|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const height = useSharedValue(0);\n * const progress = useSharedValue(0);\n *\n * useKeyboardHandler({\n * onMove: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * onEnd: (e) => {\n * \"worklet\";\n *\n * height.value = e.height;\n * progress.value = e.progress;\n * },\n * }, []);\n *\n * return <Reanimated.View style={{ height: height }] }} />;\n * }\n * ```\n */\nexport function useKeyboardHandler(handler: KeyboardHandler, deps?: unknown[]) {\n useResizeMode();\n useGenericKeyboardHandler(handler, deps);\n}\n\n/**\n * Hook for controlling keyboard controller module.\n * Allows to disable/enable it and check the actual state (whether it's enabled or not).\n * When disabled it fallbacks to default android keyboard handling and stops tracking all\n * the events that are exposed from this library.\n *\n * @property {Function} setEnabled - Function to enable/disable keyboard handling.\n * @property {boolean} enabled - Current enabled state.\n * @returns Object containing keyboard control functions and state.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/module/use-keyboard-controller|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { setEnabled, enabled } = useKeyboardController();\n * return (\n * <Button\n * title={enabled ? 'Disable' : 'Enable'}\n * onPress={() => setEnabled(!enabled)}\n * />\n * );\n * }\n * ```\n */\nexport function useKeyboardController() {\n const context = useKeyboardContext();\n\n return { setEnabled: context.setEnabled, enabled: context.enabled };\n}\n\n/**\n * Hook that provides access to the layout of the currently focused input.\n *\n * @returns Object containing reanimated values for focused input.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/input/use-reanimated-focused-input|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { input } = useReanimatedFocusedInput();\n * return <Reanimated.View style={{ height: input.value?.layout.height }} />;\n * }\n * ```\n */\nexport function useReanimatedFocusedInput() {\n const context = useKeyboardContext();\n\n return {\n input: context.layout,\n update: context.update,\n };\n}\n\n/**\n * Hook for handling focused input events, such as changes of selection, text etc.\n *\n * @param handler - Object containing focused input event handlers.\n * @param [deps] - Dependencies array for the effect.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/input/use-focused-input-handler|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * useFocusedInputHandler({\n * onChangeText: (e) => console.log('Text changed:', e.text),\n * onSelectionChange: (e) => console.log('Selection changed:', e.selection)\n * });\n * return <View />;\n * }\n * ```\n */\nexport function useFocusedInputHandler(\n handler: FocusedInputHandler,\n deps?: unknown[],\n) {\n const context = useKeyboardContext();\n\n const { doDependenciesDiffer } = useHandler<never, never>(handler, deps);\n\n const eventHandler = useEvent<\n FocusedInputSelectionChangedEvent | FocusedInputTextChangedEvent\n >(\n (event) => {\n \"worklet\";\n\n if (event.eventName.endsWith(\"onFocusedInputTextChanged\")) {\n handler.onChangeText?.(event as FocusedInputTextChangedEvent);\n }\n\n if (event.eventName.endsWith(\"onFocusedInputSelectionChanged\")) {\n handler.onSelectionChange?.(event as FocusedInputSelectionChangedEvent);\n }\n },\n [\"onFocusedInputTextChanged\", \"onFocusedInputSelectionChanged\"],\n doDependenciesDiffer,\n );\n\n useLayoutEffect(() => {\n const cleanup = context.setInputHandlers(eventHandler);\n\n return () => cleanup();\n }, deps);\n}\n\nexport * from \"./useWindowDimensions\";\nexport * from \"./useKeyboardState\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAiSA,IAAAK,oBAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,oBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,oBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,oBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAlB,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAW,iBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,iBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,U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AEzD,OAAO,MAAMc,OAAO,CAAC,CAAC;EACxB,CAAC,EAAEjB,IAAI,CAAC;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmB,kBAAkBA,CAACpB,OAAwB,EAAEC,IAAgB,EAAE;EAC7Ef,aAAa,CAAC,CAAC;EACfa,yBAAyB,CAACC,OAAO,EAAEC,IAAI,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASoB,qBAAqBA,CAAA,EAAG;EACtC,MAAM3B,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,OAAO;IAAE2B,UAAU,EAAE5B,OAAO,CAAC4B,UAAU;IAAEC,OAAO,EAAE7B,OAAO,CAAC6B;EAAQ,CAAC;AACrE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,MAAM9B,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,OAAO;IACL8B,KAAK,EAAE/B,OAAO,CAACgC,MAAM;IACrBC,MAAM,EAAEjC,OAAO,CAACiC;EAClB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpC5B,OAA4B,EAC5BC,IAAgB,EAChB;EACA,MAAMP,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,MAAM;IAAEO;EAAqB,CAAC,GAAG,IAAAC,iCAAU,EAAeH,OAAO,EAAEC,IAAI,CAAC;EAExE,MAAMG,YAAY,GAAG,IAAAC,+BAAQ,EAG1BC,KAAK,IAAK;IACT,SAAS;;IAET,IAAIA,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,2BAA2B,CAAC,EAAE;MAAA,IAAAqB,qBAAA;MACzD,CAAAA,qBAAA,GAAA7B,OAAO,CAAC8B,YAAY,cAAAD,qBAAA,eAApBA,qBAAA,CAAAlD,IAAA,CAAAqB,OAAO,EAAgBM,KAAqC,CAAC;IAC/D;IAEA,IAAIA,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,gCAAgC,CAAC,EAAE;MAAA,IAAAuB,qBAAA;MAC9D,CAAAA,qBAAA,GAAA/B,OAAO,CAACgC,iBAAiB,cAAAD,qBAAA,eAAzBA,qBAAA,CAAApD,IAAA,CAAAqB,OAAO,EAAqBM,KAA0C,CAAC;IACzE;EACF,CAAC,EACD,CAAC,2BAA2B,EAAE,gCAAgC,CAAC,EAC/DJ,oBACF,CAAC;EAED,IAAAe,sBAAe,EAAC,MAAM;IACpB,MAAMC,OAAO,GAAGxB,OAAO,CAACuC,gBAAgB,CAAC7B,YAAY,CAAC;IAEtD,OAAO,MAAMc,OAAO,CAAC,CAAC;EACxB,CAAC,EAAEjB,IAAI,CAAC;AACV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_bindings","_module","EVENTS","getLatestState","KeyboardController","state","isVisible","defaultSelector","useKeyboardState","selector","setState","useState","useEffect","subscriptions","map","event","KeyboardEvents","addListener","willShowSubscription","e","appearance","forEach","subscription","remove"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type {
|
|
1
|
+
{"version":3,"names":["_react","require","_bindings","_module","EVENTS","getLatestState","KeyboardController","state","isVisible","defaultSelector","useKeyboardState","selector","setState","useState","useEffect","subscriptions","map","event","KeyboardEvents","addListener","willShowSubscription","e","appearance","forEach","subscription","remove"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type { IKeyboardState } from \"../../types\";\n\nconst EVENTS = [\"keyboardDidShow\", \"keyboardDidHide\"] as const;\n\nconst getLatestState = () => ({\n ...KeyboardController.state(),\n isVisible: KeyboardController.isVisible(),\n});\n\ntype KeyboardStateSelector<T> = (state: IKeyboardState) => T;\n\nconst defaultSelector: KeyboardStateSelector<IKeyboardState> = (state) => state;\n\n/**\n * React Hook that represents the current keyboard state on iOS and Android.\n * It tracks keyboard visibility, height, appearance, type and other properties.\n * This hook subscribes to keyboard events and updates the state reactively.\n *\n * @template T - A type of the returned object from the `selector`.\n * @param selector - A function that receives the current keyboard state and picks only necessary properties to avoid frequent re-renders.\n * @returns Object {@link KeyboardState|containing} keyboard state information.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-state|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const isVisible = useKeyboardState((state) => state.isVisible);\n * const height = useKeyboardState((state) => state.height);\n *\n * return (\n * <View>\n * <Text>Keyboard is {isVisible ? 'visible' : 'hidden'}</Text>\n * <Text>Keyboard height: {height}</Text>\n * </View>\n * );\n * }\n * ```\n */\nfunction useKeyboardState<T = IKeyboardState>(\n selector: KeyboardStateSelector<T> = defaultSelector as KeyboardStateSelector<T>,\n): T {\n const [state, setState] = useState<T>(() => selector(getLatestState()));\n\n useEffect(() => {\n const subscriptions = EVENTS.map((event) =>\n KeyboardEvents.addListener(event, () =>\n // state will be updated by global listener first,\n // so we simply read it and don't derive data from the event\n setState(selector(getLatestState())),\n ),\n );\n // update `appearance` prematurely\n const willShowSubscription = KeyboardEvents.addListener(\n \"keyboardWillShow\",\n (e) =>\n setState(selector({ ...getLatestState(), appearance: e.appearance })),\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setState(selector(getLatestState()));\n\n return () => {\n subscriptions.forEach((subscription) => subscription.remove());\n willShowSubscription.remove();\n };\n }, []);\n\n return state;\n}\n\nexport { useKeyboardState };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,MAAMG,MAAM,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU;AAE9D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGC,0BAAkB,CAACC,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEF,0BAAkB,CAACE,SAAS,CAAC;AAC1C,CAAC,CAAC;AAIF,MAAMC,eAAsD,GAAIF,KAAK,IAAKA,KAAK;;AAE/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,gBAAgBA,CACvBC,QAAkC,GAAGF,eAA2C,EAC7E;EACH,MAAM,CAACF,KAAK,EAAEK,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAI,MAAMF,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CAAC;EAEvE,IAAAS,gBAAS,EAAC,MAAM;IACd,MAAMC,aAAa,GAAGX,MAAM,CAACY,GAAG,CAAEC,KAAK,IACrCC,wBAAc,CAACC,WAAW,CAACF,KAAK,EAAE;IAChC;IACA;IACAL,QAAQ,CAACD,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CACrC,CACF,CAAC;IACD;IACA,MAAMe,oBAAoB,GAAGF,wBAAc,CAACC,WAAW,CACrD,kBAAkB,EACjBE,CAAC,IACAT,QAAQ,CAACD,QAAQ,CAAC;MAAE,GAAGN,cAAc,CAAC,CAAC;MAAEiB,UAAU,EAAED,CAAC,CAACC;IAAW,CAAC,CAAC,CACxE,CAAC;;IAED;IACA;IACA;IACAV,QAAQ,CAACD,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,MAAM;MACXU,aAAa,CAACQ,OAAO,CAAEC,YAAY,IAAKA,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC;MAC9DL,oBAAoB,CAACK,MAAM,CAAC,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOlB,KAAK;AACd","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -138,6 +138,18 @@ Object.keys(_types).forEach(function (key) {
|
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
|
+
var _compat = require("./compat");
|
|
142
|
+
Object.keys(_compat).forEach(function (key) {
|
|
143
|
+
if (key === "default" || key === "__esModule") return;
|
|
144
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
145
|
+
if (key in exports && exports[key] === _compat[key]) return;
|
|
146
|
+
Object.defineProperty(exports, key, {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () {
|
|
149
|
+
return _compat[key];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
141
153
|
var _components = require("./components");
|
|
142
154
|
var _views = require("./views");
|
|
143
155
|
//# sourceMappingURL=index.js.map
|
|
@@ -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","_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\";\n\nexport {\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,SAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,SAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,QAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,QAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,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AAAAC,MAAA,CAAAC,IAAA,CAAAe,OAAA,EAAAd,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAa,OAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,OAAA,CAAAb,GAAA;IAAA;EAAA;AAAA;AACA,IAAAc,MAAA,GAAAlB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAgB,MAAA,EAAAf,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAc,MAAA,CAAAd,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,MAAA,CAAAd,GAAA;IAAA;EAAA;AAAA;
|
|
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 KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,SAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,SAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,QAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,QAAA,EAAAX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GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,OAAA,CAAAf,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAgB,WAAA,GAAApB,OAAA;AAeA,IAAAqB,MAAA,GAAArB,OAAA","ignoreList":[]}
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.Commands = void 0;
|
|
7
|
+
var _codegenNativeCommands = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
|
|
7
8
|
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const Commands = exports.Commands = (0, _codegenNativeCommands.default)({
|
|
11
|
+
supportedCommands: ["synchronizeFocusedInputLayout"]
|
|
12
|
+
});
|
|
9
13
|
var _default = exports.default = (0, _codegenNativeComponent.default)("KeyboardControllerView", {
|
|
10
14
|
interfaceOnly: true
|
|
11
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_codegenNativeCommands","_interopRequireDefault","require","_codegenNativeComponent","e","__esModule","default","Commands","exports","codegenNativeCommands","supportedCommands","_default","codegenNativeComponent","interfaceOnly"],"sources":["KeyboardControllerViewNativeComponent.ts"],"sourcesContent":["import codegenNativeCommands from \"react-native/Libraries/Utilities/codegenNativeCommands\";\nimport codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\nimport type {\n DirectEventHandler,\n Double,\n Int32,\n} from \"react-native/Libraries/Types/CodegenTypes\";\n\ntype KeyboardMoveEvent = Readonly<{\n height: Double;\n progress: Double;\n duration: Int32;\n target: Int32;\n}>;\n\ntype FocusedInputLayoutChangedEvent = Readonly<{\n target: Int32;\n parentScrollViewTarget: Int32;\n layout: {\n x: Double;\n y: Double;\n width: Double;\n height: Double;\n absoluteX: Double;\n absoluteY: Double;\n };\n}>;\n\ntype FocusedInputTextChangedEvent = Readonly<{\n text: string;\n}>;\n\ntype FocusedInputSelectionChangedEvent = Readonly<{\n target: Int32;\n selection: {\n start: {\n x: Double;\n y: Double;\n position: Int32;\n };\n end: {\n x: Double;\n y: Double;\n position: Int32;\n };\n };\n}>;\n\nexport interface NativeProps extends ViewProps {\n // props\n enabled?: boolean;\n statusBarTranslucent?: boolean;\n navigationBarTranslucent?: boolean;\n preserveEdgeToEdge?: boolean;\n // callbacks\n /// keyboard\n onKeyboardMoveStart?: DirectEventHandler<KeyboardMoveEvent>;\n onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;\n onKeyboardMoveEnd?: DirectEventHandler<KeyboardMoveEvent>;\n onKeyboardMoveInteractive?: DirectEventHandler<KeyboardMoveEvent>;\n /// focused input\n onFocusedInputLayoutChanged?: DirectEventHandler<FocusedInputLayoutChangedEvent>;\n onFocusedInputTextChanged?: DirectEventHandler<FocusedInputTextChangedEvent>;\n onFocusedInputSelectionChanged?: DirectEventHandler<FocusedInputSelectionChangedEvent>;\n}\n\ninterface NativeCommands {\n synchronizeFocusedInputLayout: (\n viewRef: React.ElementRef<HostComponent<NativeProps>>,\n ) => void;\n}\n\nexport const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({\n supportedCommands: [\"synchronizeFocusedInputLayout\"],\n});\n\nexport default codegenNativeComponent<NativeProps>(\"KeyboardControllerView\", {\n interfaceOnly: true,\n}) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA0EtF,MAAMG,QAAwB,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAAE,8BAAqB,EAAiB;EAC5EC,iBAAiB,EAAE,CAAC,+BAA+B;AACrD,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAH,OAAA,CAAAF,OAAA,GAEY,IAAAM,+BAAsB,EAAc,wBAAwB,EAAE;EAC3EC,aAAa,EAAE;AACjB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["internal.ts"],"sourcesContent":["import type { EmitterSubscription } from \"react-native\";\n\nexport type FocusedInputAvailableEvents
|
|
1
|
+
{"version":3,"names":[],"sources":["internal.ts"],"sourcesContent":["import type { EmitterSubscription } from \"react-native\";\n\nexport type FocusedInputAvailableEvents =\n | \"focusDidSet\"\n | \"layoutDidSynchronize\";\nexport type FocusedInputEventData = {\n current: number;\n count: number;\n};\nexport type FocusedInputEventsModule = {\n addListener: (\n name: FocusedInputAvailableEvents,\n cb: (e: FocusedInputEventData) => void,\n ) => EmitterSubscription;\n};\nexport type WindowDimensionsAvailableEvents = \"windowDidResize\";\nexport type WindowDimensionsEventData = {\n width: number;\n height: number;\n};\nexport type WindowDimensionsEventsModule = {\n addListener: (\n name: WindowDimensionsAvailableEvents,\n cb: (e: WindowDimensionsEventData) => void,\n ) => EmitterSubscription;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["module.ts"],"sourcesContent":["import type { EmitterSubscription, TextInputProps } from \"react-native\";\n\n// Event module declarations\nexport type KeyboardControllerEvents =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\";\nexport type KeyboardEventData = {\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Timestamp of the last keyboard event. */\n timestamp: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n /** `keyboardType` property from focused `TextInput`. */\n type: NonNullable<TextInputProps[\"keyboardType\"]>;\n /** Keyboard appearance. Can be one of `dark` or `light`. */\n appearance: \"dark\" | \"light\";\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type
|
|
1
|
+
{"version":3,"names":[],"sources":["module.ts"],"sourcesContent":["import type { EmitterSubscription, TextInputProps } from \"react-native\";\n\n// Event module declarations\nexport type KeyboardControllerEvents =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\";\nexport type KeyboardEventData = {\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Timestamp of the last keyboard event. */\n timestamp: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n /** `keyboardType` property from focused `TextInput`. */\n type: NonNullable<TextInputProps[\"keyboardType\"]>;\n /** Keyboard appearance. Can be one of `dark` or `light`. */\n appearance: \"dark\" | \"light\";\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type IKeyboardState = {\n /** Whether the keyboard is currently visible. */\n isVisible: boolean;\n} & KeyboardEventData;\nexport type KeyboardEventsModule = {\n /**\n * The `addListener` function connects a JavaScript function to an identified native\n * keyboard notification event.\n *\n * This function then returns the reference to the listener.\n *\n * `name` is the string that identifies the event you're listening for. This\n * can be any of the following:\n *\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n */\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEventData) => void,\n ) => EmitterSubscription;\n};\nexport type Direction = \"next\" | \"prev\" | \"current\";\nexport type DismissOptions = {\n /**\n * A boolean property indicating whether focus should be kept on the input after dismissing the keyboard. Default is `false`.\n */\n keepFocus: boolean;\n /**\n * A boolean property controlling whether dismissal should be animated. Default is `true`.\n */\n animated: boolean;\n};\nexport type KeyboardControllerModule = {\n // android only\n /**\n * Sets default `windowSoftInputMode` (the one that declared in `AndroidManifest.xml`).\n *\n * @platform android\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setdefaultmode-|docs} page for more details.\n */\n setDefaultMode: () => void;\n /**\n * Changes `windowSoftInputMode` on Android.\n *\n * @platform android\n * @see AndroidSoftInputModes for all possible values and {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|docs} page for more details.\n */\n setInputMode: (mode: number) => void;\n // ios only\n /**\n * A method that preloads the keyboard. It's useful when you want to avoid a delay when the user focuses the first input.\n *\n * @platform ios\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#preload-|docs} page for more details.\n */\n preload: () => void;\n // all platforms\n /**\n * Dismisses the active keyboard. Removes a focus by default, but allows to pass `{keepFocus: true}` to keep focus.\n * If you want to close keyboard immediately pass `{animated: false}`.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#dismiss|docs} page for more details.\n */\n dismiss: (options?: Partial<DismissOptions>) => Promise<void>;\n /**\n * Moves focus to the specified direction (`next`, `prev` or `current` to restore a focus).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setfocusto|docs} page for more details.\n */\n setFocusTo: (direction: Direction) => void;\n /**\n * Whether the keyboard is fully visible.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#isvisible|docs} page for more details.\n */\n isVisible: () => boolean;\n /**\n * Method that returns current keyboard state.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#state|docs} page for more details.\n */\n state: () => KeyboardEventData;\n};\nexport type KeyboardControllerNativeModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // ios only\n preload: () => void;\n // all platforms\n dismiss: (keepFocus: boolean, animated: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/module/animated.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint react/jsx-sort-props: off */
|
|
2
|
-
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Animated, Platform, StyleSheet } from "react-native";
|
|
4
4
|
import { controlEdgeToEdgeValues, isEdgeToEdge } from "react-native-is-edge-to-edge";
|
|
5
5
|
import Reanimated, { useSharedValue } from "react-native-reanimated";
|
|
6
|
-
import { KeyboardControllerView } from "./bindings";
|
|
6
|
+
import { FocusedInputEvents, KeyboardControllerView, KeyboardControllerViewCommands } from "./bindings";
|
|
7
7
|
import { KeyboardContext } from "./context";
|
|
8
8
|
import { useAnimatedValue, useEventHandlerRegistration } from "./internal";
|
|
9
9
|
import { KeyboardController } from "./module";
|
|
@@ -47,7 +47,7 @@ export const KeyboardProvider = props => {
|
|
|
47
47
|
preload = true
|
|
48
48
|
} = props;
|
|
49
49
|
// ref
|
|
50
|
-
const
|
|
50
|
+
const viewRef = useRef(null);
|
|
51
51
|
// state
|
|
52
52
|
const [enabled, setEnabled] = useState(initiallyEnabled);
|
|
53
53
|
// animated values
|
|
@@ -57,8 +57,17 @@ export const KeyboardProvider = props => {
|
|
|
57
57
|
const progressSV = useSharedValue(0);
|
|
58
58
|
const heightSV = useSharedValue(0);
|
|
59
59
|
const layout = useSharedValue(null);
|
|
60
|
-
const setKeyboardHandlers = useEventHandlerRegistration(
|
|
61
|
-
const setInputHandlers = useEventHandlerRegistration(
|
|
60
|
+
const setKeyboardHandlers = useEventHandlerRegistration(viewRef);
|
|
61
|
+
const setInputHandlers = useEventHandlerRegistration(viewRef);
|
|
62
|
+
const update = useCallback(async () => {
|
|
63
|
+
KeyboardControllerViewCommands.synchronizeFocusedInputLayout(viewRef.current);
|
|
64
|
+
await new Promise(resolve => {
|
|
65
|
+
const subscription = FocusedInputEvents.addListener("layoutDidSynchronize", () => {
|
|
66
|
+
subscription.remove();
|
|
67
|
+
resolve(null);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}, []);
|
|
62
71
|
// memo
|
|
63
72
|
const context = useMemo(() => ({
|
|
64
73
|
enabled,
|
|
@@ -71,6 +80,7 @@ export const KeyboardProvider = props => {
|
|
|
71
80
|
height: heightSV
|
|
72
81
|
},
|
|
73
82
|
layout,
|
|
83
|
+
update,
|
|
74
84
|
setKeyboardHandlers,
|
|
75
85
|
setInputHandlers,
|
|
76
86
|
setEnabled
|
|
@@ -150,7 +160,7 @@ export const KeyboardProvider = props => {
|
|
|
150
160
|
return /*#__PURE__*/React.createElement(KeyboardContext.Provider, {
|
|
151
161
|
value: context
|
|
152
162
|
}, /*#__PURE__*/React.createElement(KeyboardControllerViewAnimated, {
|
|
153
|
-
ref:
|
|
163
|
+
ref: viewRef,
|
|
154
164
|
enabled: enabled,
|
|
155
165
|
navigationBarTranslucent: IS_EDGE_TO_EDGE || navigationBarTranslucent,
|
|
156
166
|
statusBarTranslucent: IS_EDGE_TO_EDGE || statusBarTranslucent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","controlEdgeToEdgeValues","isEdgeToEdge","Reanimated","useSharedValue","KeyboardControllerView","KeyboardContext","useAnimatedValue","useEventHandlerRegistration","KeyboardController","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","IS_EDGE_TO_EDGE","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewTagRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","setInputHandlers","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","__DEV__","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (if you try to change this prop after component mount it will not have any effect).\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n /**\n * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration(viewTagRef);\n const setInputHandlers = useEventHandlerRegistration(viewTagRef);\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnE,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,SACEC,uBAAuB,EACvBC,YAAY,QACP,8BAA8B;AACrC,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SAASC,sBAAsB,QAAQ,YA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,UAAW;IAChBH,OAAO,EAAEA,OAAQ;IACjBF,wBAAwB,EAAEf,eAAe,IAAIe,wBAAyB;IACtED,oBAAoB,EAAEd,eAAe,IAAIc,oBAAqB;IAC9DE,kBAAkB,EAAEhB,eAAe,IAAIgB,kBAAmB;IAC1DiB,KAAK,EAAE9B,MAAM,CAACE;IACd;IAAA;IACAoD,wBAAwB,EAAEZ,eAAgB;IAC1CC,mBAAmB,EAAEpC,EAAE,KAAK,KAAK,GAAG2B,cAAc,GAAGqB,SAAU;IAC/DrB,cAAc,EAAE3B,EAAE,KAAK,SAAS,GAAG2B,cAAc,GAAGqB,SAAU;IAC9DX,yBAAyB,EAAEV,cAAe;IAC1CW,iBAAiB,EAAEtC,EAAE,KAAK,SAAS,GAAG2B,cAAc,GAAGqB,SAAU;IACjEC,qCAAqC,EAAEV;EAAmB,GAEzDpC,QAC6B,CAAC,eACjChC,KAAA,CAAAyE,aAAA,CAACpE,QAAQ,CAAC0E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA3B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","controlEdgeToEdgeValues","isEdgeToEdge","Reanimated","useSharedValue","FocusedInputEvents","KeyboardControllerView","KeyboardControllerViewCommands","KeyboardContext","useAnimatedValue","useEventHandlerRegistration","KeyboardController","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","IS_EDGE_TO_EDGE","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","setInputHandlers","update","synchronizeFocusedInputLayout","current","Promise","resolve","subscription","addListener","remove","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","__DEV__","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n FocusedInputEvents,\n KeyboardControllerView,\n KeyboardControllerViewCommands,\n} from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (if you try to change this prop after component mount it will not have any effect).\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n /**\n * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration(viewRef);\n const setInputHandlers = useEventHandlerRegistration(viewRef);\n const update = useCallback(async () => {\n KeyboardControllerViewCommands.synchronizeFocusedInputLayout(\n viewRef.current,\n );\n\n await new Promise((resolve) => {\n const subscription = FocusedInputEvents.addListener(\n \"layoutDidSynchronize\",\n () => {\n subscription.remove();\n resolve(null);\n },\n );\n });\n }, []);\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n update,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,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oF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA3B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
package/lib/module/bindings.js
CHANGED
|
@@ -43,6 +43,9 @@ export const WindowDimensionsEvents = {
|
|
|
43
43
|
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.
|
|
44
44
|
*/
|
|
45
45
|
export const KeyboardControllerView = View;
|
|
46
|
+
export const KeyboardControllerViewCommands = {
|
|
47
|
+
synchronizeFocusedInputLayout: _ref => {}
|
|
48
|
+
};
|
|
46
49
|
/**
|
|
47
50
|
* A view that defines a region on the screen, where gestures will control the keyboard position.
|
|
48
51
|
*
|