react-native-keyboard-controller 1.21.0-beta.0 → 1.21.0-beta.2

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.
Files changed (77) hide show
  1. package/ios/animations/KeyboardAnimation.swift +2 -2
  2. package/ios/animations/SpringAnimation.swift +1 -1
  3. package/ios/animations/TimingAnimation.swift +3 -1
  4. package/ios/delegates/KCTextInputCompositeDelegate.swift +2 -2
  5. package/ios/extensions/CGFloat.swift +3 -1
  6. package/ios/interactive/KeyboardAreaExtender.swift +1 -2
  7. package/ios/observers/FocusedInputObserver.swift +2 -4
  8. package/ios/observers/movement/KeyboardTrackingView.swift +1 -4
  9. package/ios/protocols/TextInput.swift +1 -1
  10. package/ios/swizzling/UIResponderSwizzle.swift +4 -2
  11. package/ios/traversal/FocusedInputHolder.swift +3 -3
  12. package/ios/traversal/KeyboardView.swift +1 -1
  13. package/ios/traversal/ViewHierarchyNavigator.swift +2 -2
  14. package/ios/views/KeyboardControllerViewManager.swift +5 -5
  15. package/jest/index.js +3 -0
  16. package/lib/commonjs/components/ChatKit/TODO.md +20 -0
  17. package/lib/commonjs/components/ChatKit/hooks.js +13 -0
  18. package/lib/commonjs/components/ChatKit/hooks.js.map +1 -0
  19. package/lib/commonjs/components/ChatKit/index.js +55 -0
  20. package/lib/commonjs/components/ChatKit/index.js.map +1 -0
  21. package/lib/commonjs/components/ChatKit/types.js +6 -0
  22. package/lib/commonjs/components/ChatKit/types.js.map +1 -0
  23. package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js +101 -0
  24. package/lib/commonjs/components/ChatKit/useChatKeyboard/helpers.js.map +1 -0
  25. package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js +147 -0
  26. package/lib/commonjs/components/ChatKit/useChatKeyboard/index.js.map +1 -0
  27. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +7 -36
  28. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  29. package/lib/commonjs/components/KeyboardStickyView/index.js +7 -5
  30. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  31. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +38 -14
  32. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  33. package/lib/commonjs/components/index.js +7 -0
  34. package/lib/commonjs/components/index.js.map +1 -1
  35. package/lib/commonjs/index.js +7 -0
  36. package/lib/commonjs/index.js.map +1 -1
  37. package/lib/module/components/ChatKit/TODO.md +20 -0
  38. package/lib/module/components/ChatKit/hooks.js +2 -0
  39. package/lib/module/components/ChatKit/hooks.js.map +1 -0
  40. package/lib/module/components/ChatKit/index.js +48 -0
  41. package/lib/module/components/ChatKit/index.js.map +1 -0
  42. package/lib/module/components/ChatKit/types.js +2 -0
  43. package/lib/module/components/ChatKit/types.js.map +1 -0
  44. package/lib/module/components/ChatKit/useChatKeyboard/helpers.js +92 -0
  45. package/lib/module/components/ChatKit/useChatKeyboard/helpers.js.map +1 -0
  46. package/lib/module/components/ChatKit/useChatKeyboard/index.js +141 -0
  47. package/lib/module/components/ChatKit/useChatKeyboard/index.js.map +1 -0
  48. package/lib/module/components/KeyboardAwareScrollView/index.js +7 -36
  49. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  50. package/lib/module/components/KeyboardStickyView/index.js +7 -5
  51. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  52. package/lib/module/components/ScrollViewWithBottomPadding/index.js +38 -14
  53. package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  54. package/lib/module/components/index.js +1 -0
  55. package/lib/module/components/index.js.map +1 -1
  56. package/lib/module/index.js +1 -1
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/typescript/components/ChatKit/hooks.d.ts +2 -0
  59. package/lib/typescript/components/ChatKit/index.d.ts +14 -0
  60. package/lib/typescript/components/ChatKit/types.d.ts +49 -0
  61. package/lib/typescript/components/ChatKit/useChatKeyboard/helpers.d.ts +57 -0
  62. package/lib/typescript/components/ChatKit/useChatKeyboard/index.d.ts +36 -0
  63. package/lib/typescript/components/ScrollViewWithBottomPadding/index.d.ts +6 -1
  64. package/lib/typescript/components/index.d.ts +2 -0
  65. package/lib/typescript/index.d.ts +2 -2
  66. package/package.json +10 -3
  67. package/src/components/ChatKit/TODO.md +20 -0
  68. package/src/components/ChatKit/hooks.ts +2 -0
  69. package/src/components/ChatKit/index.tsx +63 -0
  70. package/src/components/ChatKit/types.ts +50 -0
  71. package/src/components/ChatKit/useChatKeyboard/helpers.ts +118 -0
  72. package/src/components/ChatKit/useChatKeyboard/index.ts +228 -0
  73. package/src/components/KeyboardAwareScrollView/index.tsx +7 -43
  74. package/src/components/KeyboardStickyView/index.tsx +4 -5
  75. package/src/components/ScrollViewWithBottomPadding/index.tsx +66 -17
  76. package/src/components/index.ts +2 -0
  77. package/src/index.ts +2 -0
@@ -0,0 +1,48 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { forwardRef } from "react";
3
+ import { useAnimatedRef, useAnimatedStyle } from "react-native-reanimated";
4
+ import Reanimated from "react-native-reanimated";
5
+ import useCombinedRef from "../hooks/useCombinedRef";
6
+ import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";
7
+ import { useChatKeyboard } from "./useChatKeyboard";
8
+ const ChatScrollView = /*#__PURE__*/forwardRef(({
9
+ children,
10
+ ScrollViewComponent = Reanimated.ScrollView,
11
+ inverted = false,
12
+ keyboardLiftBehavior = "always",
13
+ freeze = false,
14
+ offset = 0,
15
+ ...rest
16
+ }, ref) => {
17
+ const scrollViewRef = useAnimatedRef();
18
+ const onRef = useCombinedRef(ref, scrollViewRef);
19
+ const {
20
+ padding,
21
+ contentOffsetY,
22
+ containerTranslateY
23
+ } = useChatKeyboard(scrollViewRef, {
24
+ inverted,
25
+ keyboardLiftBehavior,
26
+ freeze,
27
+ offset
28
+ });
29
+ const containerStyle = useAnimatedStyle(() => ({
30
+ transform: [{
31
+ translateY: containerTranslateY.value
32
+ }]
33
+ }), []);
34
+ return /*#__PURE__*/React.createElement(ScrollViewWithBottomPadding, _extends({
35
+ ref: onRef
36
+ }, rest, {
37
+ bottomPadding: padding,
38
+ containerStyle: containerStyle,
39
+ contentOffsetY: contentOffsetY,
40
+ inverted: inverted,
41
+ ScrollViewComponent: ScrollViewComponent
42
+ }), children);
43
+ });
44
+ const ChatKit = {
45
+ ScrollView: ChatScrollView
46
+ };
47
+ export default ChatKit;
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","useAnimatedRef","useAnimatedStyle","Reanimated","useCombinedRef","ScrollViewWithBottomPadding","useChatKeyboard","ChatScrollView","children","ScrollViewComponent","ScrollView","inverted","keyboardLiftBehavior","freeze","offset","rest","ref","scrollViewRef","onRef","padding","contentOffsetY","containerTranslateY","containerStyle","transform","translateY","value","createElement","_extends","bottomPadding","ChatKit"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { useAnimatedRef, useAnimatedStyle } from \"react-native-reanimated\";\nimport Reanimated from \"react-native-reanimated\";\n\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useChatKeyboard } from \"./useChatKeyboard\";\n\nimport type { ChatKitScrollViewProps } from \"./types\";\n\nconst ChatScrollView = forwardRef<\n Reanimated.ScrollView,\n React.PropsWithChildren<ChatKitScrollViewProps>\n>(\n (\n {\n children,\n ScrollViewComponent = Reanimated.ScrollView,\n inverted = false,\n keyboardLiftBehavior = \"always\",\n freeze = false,\n offset = 0,\n ...rest\n },\n ref,\n ) => {\n const scrollViewRef = useAnimatedRef<Reanimated.ScrollView>();\n const onRef = useCombinedRef(ref, scrollViewRef);\n\n const { padding, contentOffsetY, containerTranslateY } = useChatKeyboard(\n scrollViewRef,\n { inverted, keyboardLiftBehavior, freeze, offset },\n );\n\n const containerStyle = useAnimatedStyle(\n () => ({\n transform: [{ translateY: containerTranslateY.value }],\n }),\n [],\n );\n\n return (\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n bottomPadding={padding}\n containerStyle={containerStyle}\n contentOffsetY={contentOffsetY}\n inverted={inverted}\n ScrollViewComponent={ScrollViewComponent}\n >\n {children}\n </ScrollViewWithBottomPadding>\n );\n },\n);\n\nconst ChatKit = {\n ScrollView: ChatScrollView,\n};\n\nexport default ChatKit;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,yBAAyB;AAC1E,OAAOC,UAAU,MAAM,yBAAyB;AAEhD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,2BAA2B,MAAM,gCAAgC;AAExE,SAASC,eAAe,QAAQ,mBAAmB;AAInD,MAAMC,cAAc,gBAAGP,UAAU,CAI/B,CACE;EACEQ,QAAQ;EACRC,mBAAmB,GAAGN,UAAU,CAACO,UAAU;EAC3CC,QAAQ,GAAG,KAAK;EAChBC,oBAAoB,GAAG,QAAQ;EAC/BC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAG,CAAC;EACV,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,aAAa,GAAGhB,cAAc,CAAwB,CAAC;EAC7D,MAAMiB,KAAK,GAAGd,cAAc,CAACY,GAAG,EAAEC,aAAa,CAAC;EAEhD,MAAM;IAAEE,OAAO;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAAGf,eAAe,CACtEW,aAAa,EACb;IAAEN,QAAQ;IAAEC,oBAAoB;IAAEC,MAAM;IAAEC;EAAO,CACnD,CAAC;EAED,MAAMQ,cAAc,GAAGpB,gBAAgB,CACrC,OAAO;IACLqB,SAAS,EAAE,CAAC;MAAEC,UAAU,EAAEH,mBAAmB,CAACI;IAAM,CAAC;EACvD,CAAC,CAAC,EACF,EACF,CAAC;EAED,oBACE1B,KAAA,CAAA2B,aAAA,CAACrB,2BAA2B,EAAAsB,QAAA;IAC1BX,GAAG,EAAEE;EAAM,GACPH,IAAI;IACRa,aAAa,EAAET,OAAQ;IACvBG,cAAc,EAAEA,cAAe;IAC/BF,cAAc,EAAEA,cAAe;IAC/BT,QAAQ,EAAEA,QAAS;IACnBF,mBAAmB,EAAEA;EAAoB,IAExCD,QAC0B,CAAC;AAElC,CACF,CAAC;AAED,MAAMqB,OAAO,GAAG;EACdnB,UAAU,EAAEH;AACd,CAAC;AAED,eAAesB,OAAO","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { AnimatedScrollViewComponent } from \"../ScrollViewWithBottomPadding\";\nimport type { ScrollViewProps } from \"react-native\";\n\ntype KeyboardLiftBehavior = \"always\" | \"whenAtEnd\" | \"persistent\" | \"never\";\n\nexport type ChatKitScrollViewProps = {\n /** Custom component for `ScrollView`. Default is `ScrollView`. */\n ScrollViewComponent: AnimatedScrollViewComponent;\n /** Whether list are using `inverted` prop. Default is `false`. */\n inverted?: boolean;\n /**\n * The distance (in pixels) between the bottom of the screen and the `ScrollView`.\n * When the keyboard appears, the scroll view will only push content by the effective\n * distance (`keyboardHeight - offset`) instead of the full keyboard height.\n *\n * Useful when the input is not at the very bottom of the screen (e.g., above safe area, above\n * bottom tabs, etc. - in this case offset should be equal to the height of the elements between\n * `ScrollView` and bottom of the screen).\n *\n * Default is `0`.\n */\n offset?: number;\n /**\n * Determines how the chat content should behave when the keyboard appears, specifically whether\n * the scroll view should automatically lift its content to keep it visible above the keyboard.\n *\n * Possible values:\n * - `'always'`: The content always lifts along with the keyboard, ensuring the messages from the bottom part of screen\n * remain visible regardless of the current scroll position. This is the default behavior for most chat applications (used in Telegram).\n * - `'whenAtEnd'`: The content lifts only if the scroll view is at the end (i.e., the last message\n * is visible or near the bottom). This prevents unnecessary adjustments when the user is scrolling\n * through older messages (ChatGPT mobile app behavior).\n * - `'persistent'`: The content always lifts when the keyboard appears (similar to `'always'`), but\n * does not reset (lower) when the keyboard hides. This mimics behaviors where the view remains adjusted\n * after keyboard dismissal to maintain focus on the latest content without shifting back (Claude mobile app behavior).\n * - `'never'`: The content does not lift at all when the keyboard appears. Use this for scenarios\n * when you don't want to disturb user attention with animations (Perplexity mobile app behavior).\n *\n * Default is `'always'`.\n */\n keyboardLiftBehavior?: KeyboardLiftBehavior;\n /**\n * When `true`, freezes all keyboard-driven layout changes (padding, content offset, scroll position).\n * Useful when dismissing the keyboard to open a bottom sheet — prevents visual disruption\n * while the sheet is visible.\n *\n * Default is `false`.\n */\n freeze?: boolean;\n} & ScrollViewProps;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ const AT_END_THRESHOLD = 20;
2
+
3
+ /**
4
+ * Check whether the scroll view is at the end of its content.
5
+ *
6
+ * @param scrollOffset - Current vertical scroll offset.
7
+ * @param layoutHeight - Visible height of the scroll view.
8
+ * @param contentHeight - Total height of the scrollable content.
9
+ * @returns `true` if the scroll position is within the threshold of the content end.
10
+ * @example
11
+ * ```ts
12
+ * const atEnd = isScrollAtEnd(100, 800, 920); // true (100 + 800 >= 920 - 20)
13
+ * ```
14
+ */
15
+ export function isScrollAtEnd(scrollOffset, layoutHeight, contentHeight) {
16
+ "worklet";
17
+
18
+ return scrollOffset + layoutHeight >= contentHeight - AT_END_THRESHOLD;
19
+ }
20
+
21
+ /**
22
+ * Decide whether content should be shifted based on the keyboard lift behavior.
23
+ *
24
+ * @param behavior - The configured keyboard lift behavior.
25
+ * @param isAtEnd - Whether the scroll view is currently at the end.
26
+ * @returns `true` if content should be shifted.
27
+ * @example
28
+ * ```ts
29
+ * shouldShiftContent("always", false); // true
30
+ * shouldShiftContent("whenAtEnd", false); // false
31
+ * ```
32
+ */
33
+ export function shouldShiftContent(behavior, isAtEnd) {
34
+ "worklet";
35
+
36
+ switch (behavior) {
37
+ case "always":
38
+ return true;
39
+ case "never":
40
+ return false;
41
+ case "whenAtEnd":
42
+ return isAtEnd;
43
+ case "persistent":
44
+ return true;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Compute the clamped scroll target for non-inverted lists.
50
+ *
51
+ * @param offsetBeforeScroll - Scroll position before keyboard appeared.
52
+ * @param keyboardHeight - Current keyboard height.
53
+ * @param contentHeight - Total height of the scrollable content.
54
+ * @param layoutHeight - Visible height of the scroll view.
55
+ * @returns Clamped scroll target between 0 and maxScroll.
56
+ * @example
57
+ * ```ts
58
+ * clampedScrollTarget(100, 300, 1000, 800); // 400
59
+ * ```
60
+ */
61
+ export function clampedScrollTarget(offsetBeforeScroll, keyboardHeight, contentHeight, layoutHeight) {
62
+ "worklet";
63
+
64
+ const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);
65
+ return Math.min(Math.max(offsetBeforeScroll + keyboardHeight, 0), maxScroll);
66
+ }
67
+
68
+ /**
69
+ * Compute contentOffset.y for iOS lists.
70
+ *
71
+ * @param relativeScroll - Scroll position relative to current inset.
72
+ * @param keyboardHeight - Target keyboard height.
73
+ * @param contentHeight - Total height of the scrollable content.
74
+ * @param layoutHeight - Visible height of the scroll view.
75
+ * @param inverted - Whether the list is inverted.
76
+ * @returns The absolute contentOffset.y to set.
77
+ * @example
78
+ * ```ts
79
+ * computeIOSContentOffset(100, 300, 1000, 800, false); // 400
80
+ * ```
81
+ */
82
+ export function computeIOSContentOffset(relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted) {
83
+ "worklet";
84
+
85
+ if (inverted) {
86
+ const maxScroll = Math.max(contentHeight - layoutHeight, 0);
87
+ return Math.max(Math.min(relativeScroll - keyboardHeight, maxScroll), -keyboardHeight);
88
+ }
89
+ const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);
90
+ return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);
91
+ }
92
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AT_END_THRESHOLD","isScrollAtEnd","scrollOffset","layoutHeight","contentHeight","shouldShiftContent","behavior","isAtEnd","clampedScrollTarget","offsetBeforeScroll","keyboardHeight","maxScroll","Math","max","min","computeIOSContentOffset","relativeScroll","inverted"],"sources":["helpers.ts"],"sourcesContent":["type KeyboardLiftBehavior = \"always\" | \"whenAtEnd\" | \"persistent\" | \"never\";\n\nconst AT_END_THRESHOLD = 20;\n\n/**\n * Check whether the scroll view is at the end of its content.\n *\n * @param scrollOffset - Current vertical scroll offset.\n * @param layoutHeight - Visible height of the scroll view.\n * @param contentHeight - Total height of the scrollable content.\n * @returns `true` if the scroll position is within the threshold of the content end.\n * @example\n * ```ts\n * const atEnd = isScrollAtEnd(100, 800, 920); // true (100 + 800 >= 920 - 20)\n * ```\n */\nexport function isScrollAtEnd(\n scrollOffset: number,\n layoutHeight: number,\n contentHeight: number,\n): boolean {\n \"worklet\";\n\n return scrollOffset + layoutHeight >= contentHeight - AT_END_THRESHOLD;\n}\n\n/**\n * Decide whether content should be shifted based on the keyboard lift behavior.\n *\n * @param behavior - The configured keyboard lift behavior.\n * @param isAtEnd - Whether the scroll view is currently at the end.\n * @returns `true` if content should be shifted.\n * @example\n * ```ts\n * shouldShiftContent(\"always\", false); // true\n * shouldShiftContent(\"whenAtEnd\", false); // false\n * ```\n */\nexport function shouldShiftContent(\n behavior: KeyboardLiftBehavior,\n isAtEnd: boolean,\n): boolean {\n \"worklet\";\n\n switch (behavior) {\n case \"always\":\n return true;\n case \"never\":\n return false;\n case \"whenAtEnd\":\n return isAtEnd;\n case \"persistent\":\n return true;\n }\n}\n\n/**\n * Compute the clamped scroll target for non-inverted lists.\n *\n * @param offsetBeforeScroll - Scroll position before keyboard appeared.\n * @param keyboardHeight - Current keyboard height.\n * @param contentHeight - Total height of the scrollable content.\n * @param layoutHeight - Visible height of the scroll view.\n * @returns Clamped scroll target between 0 and maxScroll.\n * @example\n * ```ts\n * clampedScrollTarget(100, 300, 1000, 800); // 400\n * ```\n */\nexport function clampedScrollTarget(\n offsetBeforeScroll: number,\n keyboardHeight: number,\n contentHeight: number,\n layoutHeight: number,\n): number {\n \"worklet\";\n\n const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);\n\n return Math.min(Math.max(offsetBeforeScroll + keyboardHeight, 0), maxScroll);\n}\n\n/**\n * Compute contentOffset.y for iOS lists.\n *\n * @param relativeScroll - Scroll position relative to current inset.\n * @param keyboardHeight - Target keyboard height.\n * @param contentHeight - Total height of the scrollable content.\n * @param layoutHeight - Visible height of the scroll view.\n * @param inverted - Whether the list is inverted.\n * @returns The absolute contentOffset.y to set.\n * @example\n * ```ts\n * computeIOSContentOffset(100, 300, 1000, 800, false); // 400\n * ```\n */\nexport function computeIOSContentOffset(\n relativeScroll: number,\n keyboardHeight: number,\n contentHeight: number,\n layoutHeight: number,\n inverted: boolean,\n): number {\n \"worklet\";\n\n if (inverted) {\n const maxScroll = Math.max(contentHeight - layoutHeight, 0);\n\n return Math.max(\n Math.min(relativeScroll - keyboardHeight, maxScroll),\n -keyboardHeight,\n );\n }\n\n const maxScroll = Math.max(contentHeight - layoutHeight + keyboardHeight, 0);\n\n return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);\n}\n"],"mappings":"AAEA,MAAMA,gBAAgB,GAAG,EAAE;;AAE3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAC3BC,YAAoB,EACpBC,YAAoB,EACpBC,aAAqB,EACZ;EACT,SAAS;;EAET,OAAOF,YAAY,GAAGC,YAAY,IAAIC,aAAa,GAAGJ,gBAAgB;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,kBAAkBA,CAChCC,QAA8B,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EL,SAAS,CAAC;AAC1E","ignoreList":[]}
@@ -0,0 +1,141 @@
1
+ import { Platform } from "react-native";
2
+ import { interpolate, scrollTo, useSharedValue } from "react-native-reanimated";
3
+ import { useKeyboardHandler } from "../../../hooks";
4
+ import useScrollState from "../../hooks/useScrollState";
5
+ import { clampedScrollTarget, computeIOSContentOffset, isScrollAtEnd, shouldShiftContent } from "./helpers";
6
+ const OS = Platform.OS;
7
+ /**
8
+ * Hook that manages keyboard-driven scrolling for chat-style scroll views.
9
+ * Calculates padding (extra scrollable space) and content shift values,
10
+ * using the optimal strategy per platform.
11
+ *
12
+ * @param scrollViewRef - Animated ref to the scroll view.
13
+ * @param options - Configuration for inverted and keyboardLiftBehavior.
14
+ * @returns Shared values for padding, contentOffsetY (iOS), and containerTranslateY (Android inverted).
15
+ * @example
16
+ * ```tsx
17
+ * const { padding, contentOffsetY, containerTranslateY } = useChatKeyboard(ref, {
18
+ * inverted: false,
19
+ * keyboardLiftBehavior: "always",
20
+ * });
21
+ * ```
22
+ */
23
+ function useChatKeyboard(scrollViewRef, options) {
24
+ const {
25
+ inverted,
26
+ keyboardLiftBehavior,
27
+ freeze,
28
+ offset
29
+ } = options;
30
+ const padding = useSharedValue(0);
31
+ const contentOffsetY = useSharedValue(0);
32
+ const containerTranslateY = useSharedValue(0);
33
+ const offsetBeforeScroll = useSharedValue(0);
34
+ const targetKeyboardHeight = useSharedValue(0);
35
+ const {
36
+ layout,
37
+ size,
38
+ offset: scroll
39
+ } = useScrollState(scrollViewRef);
40
+ const getEffectiveHeight = height => {
41
+ "worklet";
42
+
43
+ if (offset === 0 || targetKeyboardHeight.value === 0) {
44
+ return height;
45
+ }
46
+ return interpolate(height, [0, targetKeyboardHeight.value], [0, Math.max(targetKeyboardHeight.value - offset, 0)]);
47
+ };
48
+ useKeyboardHandler({
49
+ onStart: e => {
50
+ "worklet";
51
+
52
+ if (freeze) {
53
+ return;
54
+ }
55
+ if (e.height > 0) {
56
+ // eslint-disable-next-line react-compiler/react-compiler
57
+ targetKeyboardHeight.value = e.height;
58
+ }
59
+ const effective = getEffectiveHeight(e.height);
60
+ const atEnd = isScrollAtEnd(scroll.value, layout.value.height, size.value.height);
61
+ if (OS === "ios") {
62
+ // iOS: set padding + contentOffset once in onStart
63
+ const relativeScroll = inverted ? scroll.value + padding.value : scroll.value - padding.value;
64
+ padding.value = effective;
65
+ if (!shouldShiftContent(keyboardLiftBehavior, atEnd)) {
66
+ return;
67
+ }
68
+ if (keyboardLiftBehavior === "persistent" && effective < padding.value) {
69
+ return;
70
+ }
71
+ contentOffsetY.value = computeIOSContentOffset(relativeScroll, effective, size.value.height, layout.value.height, inverted);
72
+ } else if (e.height > 0) {
73
+ // Android: keyboard opening — set padding + capture scroll position
74
+ padding.value = effective;
75
+ offsetBeforeScroll.value = scroll.value;
76
+ if (keyboardLiftBehavior === "whenAtEnd" && !atEnd) {
77
+ // Sentinel: don't scroll in onMove
78
+ offsetBeforeScroll.value = -1;
79
+ }
80
+ } else {
81
+ // Android: keyboard closing — re-capture from current position
82
+ // so onMove smoothly scrolls back from where the user is now
83
+ offsetBeforeScroll.value = scroll.value - padding.value;
84
+ }
85
+ },
86
+ onMove: e => {
87
+ "worklet";
88
+
89
+ if (freeze) {
90
+ return;
91
+ }
92
+
93
+ // iOS doesn't need per-frame updates (contentOffset handles it)
94
+ if (OS === "ios") {
95
+ return;
96
+ }
97
+ if (!shouldShiftContent(keyboardLiftBehavior, true)) {
98
+ return;
99
+ }
100
+
101
+ // "whenAtEnd" sentinel check
102
+ if (offsetBeforeScroll.value === -1) {
103
+ return;
104
+ }
105
+ const effective = getEffectiveHeight(e.height);
106
+ if (inverted) {
107
+ // Android inverted: translateY on container
108
+ if (keyboardLiftBehavior === "persistent" && effective < Math.abs(containerTranslateY.value)) {
109
+ return;
110
+ }
111
+ containerTranslateY.value = -effective;
112
+ } else {
113
+ // Android non-inverted: scrollTo per-frame
114
+ if (keyboardLiftBehavior === "persistent" && effective < scroll.value - offsetBeforeScroll.value) {
115
+ return;
116
+ }
117
+ const target = clampedScrollTarget(offsetBeforeScroll.value, effective, size.value.height, layout.value.height);
118
+ scrollTo(scrollViewRef, 0, target, false);
119
+ }
120
+ },
121
+ onEnd: e => {
122
+ "worklet";
123
+
124
+ if (freeze) {
125
+ return;
126
+ }
127
+ const effective = getEffectiveHeight(e.height);
128
+ padding.value = effective;
129
+ if (OS !== "ios" && inverted && e.height === 0 && keyboardLiftBehavior !== "persistent") {
130
+ containerTranslateY.value = 0;
131
+ }
132
+ }
133
+ }, [inverted, keyboardLiftBehavior, freeze, offset]);
134
+ return {
135
+ padding,
136
+ contentOffsetY: OS === "ios" ? contentOffsetY : undefined,
137
+ containerTranslateY
138
+ };
139
+ }
140
+ export { useChatKeyboard };
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","interpolate","scrollTo","useSharedValue","useKeyboardHandler","useScrollState","clampedScrollTarget","computeIOSContentOffset","isScrollAtEnd","shouldShiftContent","OS","useChatKeyboard","scrollViewRef","options","inverted","keyboardLiftBehavior","freeze","offset","padding","contentOffsetY","containerTranslateY","offsetBeforeScroll","targetKeyboardHeight","layout","size","scroll","getEffectiveHeight","height","value","Math","max","onStart","e","effective","atEnd","relativeScroll","onMove","abs","target","onEnd","undefined"],"sources":["index.ts"],"sourcesContent":["import { Platform } from \"react-native\";\nimport { interpolate, scrollTo, useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"../../../hooks\";\nimport useScrollState from \"../../hooks/useScrollState\";\n\nimport {\n clampedScrollTarget,\n computeIOSContentOffset,\n isScrollAtEnd,\n shouldShiftContent,\n} from \"./helpers\";\n\nimport type { AnimatedRef, SharedValue } from \"react-native-reanimated\";\nimport type Reanimated from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\n\ntype KeyboardLiftBehavior = \"always\" | \"whenAtEnd\" | \"persistent\" | \"never\";\n\ntype UseChatKeyboardOptions = {\n inverted: boolean;\n keyboardLiftBehavior: KeyboardLiftBehavior;\n freeze: boolean;\n offset: number;\n};\n\ntype UseChatKeyboardReturn = {\n /** Extra scrollable space (= keyboard height). Used as contentInset on iOS, contentInsetBottom on Android. */\n padding: SharedValue<number>;\n /** Absolute Y content offset for iOS (set once in onStart). `undefined` on Android. */\n contentOffsetY: SharedValue<number> | undefined;\n /** TranslateY for the container wrapper on Android inverted lists. 0 otherwise. */\n containerTranslateY: SharedValue<number>;\n};\n\n/**\n * Hook that manages keyboard-driven scrolling for chat-style scroll views.\n * Calculates padding (extra scrollable space) and content shift values,\n * using the optimal strategy per platform.\n *\n * @param scrollViewRef - Animated ref to the scroll view.\n * @param options - Configuration for inverted and keyboardLiftBehavior.\n * @returns Shared values for padding, contentOffsetY (iOS), and containerTranslateY (Android inverted).\n * @example\n * ```tsx\n * const { padding, contentOffsetY, containerTranslateY } = useChatKeyboard(ref, {\n * inverted: false,\n * keyboardLiftBehavior: \"always\",\n * });\n * ```\n */\nfunction useChatKeyboard(\n scrollViewRef: AnimatedRef<Reanimated.ScrollView>,\n options: UseChatKeyboardOptions,\n): UseChatKeyboardReturn {\n const { inverted, keyboardLiftBehavior, freeze, offset } = options;\n\n const padding = useSharedValue(0);\n const contentOffsetY = useSharedValue(0);\n const containerTranslateY = useSharedValue(0);\n const offsetBeforeScroll = useSharedValue(0);\n const targetKeyboardHeight = useSharedValue(0);\n\n const { layout, size, offset: scroll } = useScrollState(scrollViewRef);\n\n const getEffectiveHeight = (height: number): number => {\n \"worklet\";\n\n if (offset === 0 || targetKeyboardHeight.value === 0) {\n return height;\n }\n\n return interpolate(\n height,\n [0, targetKeyboardHeight.value],\n [0, Math.max(targetKeyboardHeight.value - offset, 0)],\n );\n };\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n if (e.height > 0) {\n // eslint-disable-next-line react-compiler/react-compiler\n targetKeyboardHeight.value = e.height;\n }\n\n const effective = getEffectiveHeight(e.height);\n\n const atEnd = isScrollAtEnd(\n scroll.value,\n layout.value.height,\n size.value.height,\n );\n\n if (OS === \"ios\") {\n // iOS: set padding + contentOffset once in onStart\n const relativeScroll = inverted\n ? scroll.value + padding.value\n : scroll.value - padding.value;\n\n padding.value = effective;\n\n if (!shouldShiftContent(keyboardLiftBehavior, atEnd)) {\n return;\n }\n\n if (\n keyboardLiftBehavior === \"persistent\" &&\n effective < padding.value\n ) {\n return;\n }\n\n contentOffsetY.value = computeIOSContentOffset(\n relativeScroll,\n effective,\n size.value.height,\n layout.value.height,\n inverted,\n );\n } else if (e.height > 0) {\n // Android: keyboard opening — set padding + capture scroll position\n padding.value = effective;\n offsetBeforeScroll.value = scroll.value;\n\n if (keyboardLiftBehavior === \"whenAtEnd\" && !atEnd) {\n // Sentinel: don't scroll in onMove\n offsetBeforeScroll.value = -1;\n }\n } else {\n // Android: keyboard closing — re-capture from current position\n // so onMove smoothly scrolls back from where the user is now\n offsetBeforeScroll.value = scroll.value - padding.value;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n // iOS doesn't need per-frame updates (contentOffset handles it)\n if (OS === \"ios\") {\n return;\n }\n\n if (!shouldShiftContent(keyboardLiftBehavior, true)) {\n return;\n }\n\n // \"whenAtEnd\" sentinel check\n if (offsetBeforeScroll.value === -1) {\n return;\n }\n\n const effective = getEffectiveHeight(e.height);\n\n if (inverted) {\n // Android inverted: translateY on container\n if (\n keyboardLiftBehavior === \"persistent\" &&\n effective < Math.abs(containerTranslateY.value)\n ) {\n return;\n }\n\n containerTranslateY.value = -effective;\n } else {\n // Android non-inverted: scrollTo per-frame\n if (\n keyboardLiftBehavior === \"persistent\" &&\n effective < scroll.value - offsetBeforeScroll.value\n ) {\n return;\n }\n\n const target = clampedScrollTarget(\n offsetBeforeScroll.value,\n effective,\n size.value.height,\n layout.value.height,\n );\n\n scrollTo(scrollViewRef, 0, target, false);\n }\n },\n onEnd: (e) => {\n \"worklet\";\n\n if (freeze) {\n return;\n }\n\n const effective = getEffectiveHeight(e.height);\n\n padding.value = effective;\n\n if (\n OS !== \"ios\" &&\n inverted &&\n e.height === 0 &&\n keyboardLiftBehavior !== \"persistent\"\n ) {\n containerTranslateY.value = 0;\n }\n },\n },\n [inverted, keyboardLiftBehavior, freeze, offset],\n );\n\n return {\n padding,\n contentOffsetY: OS === \"ios\" ? contentOffsetY : undefined,\n containerTranslateY,\n };\n}\n\nexport { useChatKeyboard };\nexport type { KeyboardLiftBehavior };\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,WAAW,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,yBAAyB;AAE/E,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,OAAOC,cAAc,MAAM,4BAA4B;AAEvD,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,aAAa,EACbC,kBAAkB,QACb,WAAW;AAKlB,MAAMC,EAAE,GAAGV,QAAQ,CAACU,EAAE;AAoBtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CACtBC,aAAiD,EACjDC,OAA+B,EACR;EACvB,MAAM;IAAEC,QAAQ;IAAEC,oBAAoB;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,OAAO;EAElE,MAAMK,OAAO,GAAGf,cAAc,CAAC,CAAC,CAAC;EACjC,MAAMgB,cAAc,GAAGhB,cAAc,CAAC,CAAC,CAAC;EACxC,MAAMiB,mBAAmB,GAAGjB,cAAc,CAAC,CAAC,CAAC;EAC7C,MAAMkB,kBAAkB,GAAGlB,cAAc,CAAC,CAAC,CAAC;EAC5C,MAAMmB,oBAAoB,GAAGnB,cAAc,CAAC,CAAC,CAAC;EAE9C,MAAM;IAAEoB,MAAM;IAAEC,IAAI;IAAEP,MAAM,EAAEQ;EAAO,CAAC,GAAGpB,cAAc,CAACO,aAAa,CAAC;EAEtE,MAAMc,kBAAkB,GAAIC,MAAc,I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AAS,EACTT,IAAI,CAACI,KAAK,CAACD,MAAM,EACjBJ,MAAM,CAACK,KAAK,CAACD,MACf,CAAC;QAEDzB,QAAQ,CAACU,aAAa,EAAE,CAAC,EAAE0B,MAAM,EAAE,KAAK,CAAC;MAC3C;IACF,CAAC;IACDC,KAAK,EAAGP,CAAC,IAAK;MACZ,SAAS;;MAET,IAAIhB,MAAM,EAAE;QACV;MACF;MAEA,MAAMiB,SAAS,GAAGP,kBAAkB,CAACM,CAAC,CAACL,MAAM,CAAC;MAE9CT,OAAO,CAACU,KAAK,GAAGK,SAAS;MAEzB,IACEvB,EAAE,KAAK,KAAK,IACZI,QAAQ,IACRkB,CAAC,CAACL,MAAM,KAAK,CAAC,IACdZ,oBAAoB,KAAK,YAAY,EACrC;QACAK,mBAAmB,CAACQ,KAAK,GAAG,CAAC;MAC/B;IACF;EACF,CAAC,EACD,CAACd,QAAQ,EAAEC,oBAAoB,EAAEC,MAAM,EAAEC,MAAM,CACjD,CAAC;EAED,OAAO;IACLC,OAAO;IACPC,cAAc,EAAET,EAAE,KAAK,KAAK,GAAGS,cAAc,GAAGqB,SAAS;IACzDpB;EACF,CAAC;AACH;AAEA,SAAST,eAAe","ignoreList":[]}
@@ -95,7 +95,6 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
95
95
  const layout = useSharedValue(null);
96
96
  const lastSelection = useSharedValue(null);
97
97
  const ghostViewSpace = useSharedValue(-1);
98
- const pendingSelectionForFocus = useSharedValue(false);
99
98
  const {
100
99
  height
101
100
  } = useWindowDimensions();
@@ -208,17 +207,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
208
207
  const latestSelection = (_lastSelection$value3 = lastSelection.value) === null || _lastSelection$value3 === void 0 ? void 0 : _lastSelection$value3.selection;
209
208
  lastSelection.value = e;
210
209
  if (e.target !== lastTarget) {
211
- if (pendingSelectionForFocus.value) {
212
- // selection arrived after onStart - complete the deferred setup
213
- pendingSelectionForFocus.value = false;
214
- updateLayoutFromSelection();
215
-
216
- // if keyboard was already visible (focus change, no onMove expected),
217
- // perform the deferred scroll now
218
- if (!keyboardWillAppear.value && keyboardHeight.value > 0) {
219
- position.value += maybeScroll(keyboardHeight.value, true);
220
- }
221
- }
210
+ // ignore this event, because "focus changed" event handled in `useSmoothKeyboardHandler`
222
211
  return;
223
212
  }
224
213
  // caret in the end + end coordinates has been changed -> we moved to a new line
@@ -231,7 +220,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
231
220
  return scrollFromCurrentPosition();
232
221
  }
233
222
  onChangeTextHandler();
234
- }, [scrollFromCurrentPosition, onChangeTextHandler, updateLayoutFromSelection, maybeScroll]);
223
+ }, [scrollFromCurrentPosition, onChangeTextHandler]);
235
224
  useFocusedInputHandler({
236
225
  onSelectionChange: onSelectionChange
237
226
  }, [onSelectionChange]);
@@ -250,7 +239,6 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
250
239
  // on back transition need to interpolate as [0, keyboardHeight]
251
240
  initialKeyboardSize.value = 0;
252
241
  scrollPosition.value = scrollBeforeKeyboardMovement.value;
253
- pendingSelectionForFocus.value = false;
254
242
  }
255
243
  if (keyboardWillAppear.value || keyboardWillChangeSize || focusWasChanged) {
256
244
  // persist scroll value
@@ -261,31 +249,17 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
261
249
 
262
250
  // focus was changed
263
251
  if (focusWasChanged) {
264
- var _lastSelection$value4;
265
252
  tag.value = e.target;
266
- if (((_lastSelection$value4 = lastSelection.value) === null || _lastSelection$value4 === void 0 ? void 0 : _lastSelection$value4.target) === e.target) {
267
- // selection arrived before onStart - use it to update layout
268
- updateLayoutFromSelection();
269
- pendingSelectionForFocus.value = false;
270
- } else {
271
- // selection hasn't arrived yet for the new target.
272
- // use input layout as-is; will be refined when selection arrives.
273
- if (input.value) {
274
- layout.value = input.value;
275
- }
276
- pendingSelectionForFocus.value = true;
277
- }
278
-
253
+ // save position of focused text input when keyboard starts to move
254
+ updateLayoutFromSelection();
279
255
  // save current scroll position - when keyboard will hide we'll reuse
280
256
  // this value to achieve smooth hide effect
281
257
  scrollBeforeKeyboardMovement.value = position.value;
282
258
  }
283
259
  if (focusWasChanged && !keyboardWillAppear.value) {
284
- if (!pendingSelectionForFocus.value) {
285
- // update position on scroll value, so `onEnd` handler
286
- // will pick up correct values
287
- position.value += maybeScroll(e.height, true);
288
- }
260
+ // update position on scroll value, so `onEnd` handler
261
+ // will pick up correct values
262
+ position.value += maybeScroll(e.height, true);
289
263
  }
290
264
  ghostViewSpace.value = position.value + scrollViewLayout.value.height - scrollViewContentSize.value.height;
291
265
  if (ghostViewSpace.value > 0) {
@@ -311,9 +285,6 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
311
285
  removeGhostPadding(e.height);
312
286
  keyboardHeight.value = e.height;
313
287
  scrollPosition.value = position.value;
314
- if (e.height === 0) {
315
- lastSelection.value = null;
316
- }
317
288
  syncKeyboardFrame(e);
318
289
  }
319
290
  }, [maybeScroll, removeGhostPadding, disableScrollOnKeyboardHide, syncKeyboardFrame]);
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","Reanimated","clamp","interpolate","runOnUI","scrollTo","useAnimatedReaction","useAnimatedRef","useDerivedValue","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","findNodeHandle","useCombinedRef","useScrollState","ScrollViewWithBottomPadding","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","scrollViewRef","useRef","onRef","scrollViewTarget","scrollPosition","offset","position","layout","scrollViewLayout","size","scrollViewContentSize","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","update","lastSelection","ghostViewSpace","pendingSelectionForFocus","height","onScrollViewLayout","e","value","current","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","targetScrollY","Math","max","positionOnScreen","topOfScreen","removeGhostPadding","performScrollWithPositionRestoration","newPosition","prevScroll","syncKeyboardFrame","keyboardFrame","updateLayoutFromSelection","_lastSelection$value","_input$value","customHeight","selection","end","y","scrollFromCurrentPosition","prevLayout","onChangeText","onChangeTextHandler","onSelectionChange","_lastSelection$value2","_lastSelection$value3","lastTarget","target","latestSelection","start","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","_lastSelection$value4","onMove","onEnd","synchronize","scrollView","existingMethods","assureFocusedInputVisible","previous","padding","createElement","_extends","bottomPadding","scrollEventThrottle"],"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 useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\nimport { findNodeHandle } from \"../../utils/findNodeHandle\";\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport useScrollState from \"../hooks/useScrollState\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type { AnimatedScrollViewComponent } from \"../ScrollViewWithBottomPadding\";\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?: AnimatedScrollViewComponent;\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 onRef = useCombinedRef(scrollViewAnimatedRef, scrollViewRef);\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const {\n offset: position,\n layout: scrollViewLayout,\n size: scrollViewContentSize,\n } = useScrollState(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 const ghostViewSpace = useSharedValue(-1);\n const pendingSelectionForFocus = useSharedValue(false);\n\n const { height } = useWindowDimensions();\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 removeGhostPadding = useCallback((e: number) => {\n \"worklet\";\n\n // new `ScrollViewWithBottomPadding` behavior: if we hide keyboard and we are in the end of `ScrollView`\n // then we always need to scroll back, because we apply a padding that doesn't change layout, so we will\n // not have auto scroll back in this case\n if (!keyboardWillAppear.value && ghostViewSpace.value > 0) {\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n scrollPosition.value -\n interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [ghostViewSpace.value, 0],\n ),\n false,\n );\n\n return true;\n }\n\n return false;\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 if (pendingSelectionForFocus.value) {\n // selection arrived after onStart - complete the deferred setup\n pendingSelectionForFocus.value = false;\n updateLayoutFromSelection();\n\n // if keyboard was already visible (focus change, no onMove expected),\n // perform the deferred scroll now\n if (!keyboardWillAppear.value && keyboardHeight.value > 0) {\n position.value += maybeScroll(keyboardHeight.value, true);\n }\n }\n\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 [\n scrollFromCurrentPosition,\n onChangeTextHandler,\n updateLayoutFromSelection,\n maybeScroll,\n ],\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 pendingSelectionForFocus.value = false;\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\n if (lastSelection.value?.target === e.target) {\n // selection arrived before onStart - use it to update layout\n updateLayoutFromSelection();\n pendingSelectionForFocus.value = false;\n } else {\n // selection hasn't arrived yet for the new target.\n // use input layout as-is; will be refined when selection arrives.\n if (input.value) {\n layout.value = input.value;\n }\n pendingSelectionForFocus.value = true;\n }\n\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 if (!pendingSelectionForFocus.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\n ghostViewSpace.value =\n position.value +\n scrollViewLayout.value.height -\n scrollViewContentSize.value.height;\n\n if (ghostViewSpace.value > 0) {\n scrollPosition.value = position.value;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n if (removeGhostPadding(e.height)) {\n return;\n }\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 removeGhostPadding(e.height);\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n if (e.height === 0) {\n lastSelection.value = null;\n }\n\n syncKeyboardFrame(e);\n },\n },\n [\n maybeScroll,\n removeGhostPadding,\n disableScrollOnKeyboardHide,\n syncKeyboardFrame,\n ],\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 // 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 const padding = useDerivedValue(\n () => (enabled ? currentKeyboardFrameHeight.value + 1 : 0),\n [enabled],\n );\n\n return (\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n bottomPadding={padding}\n scrollEventThrottle={16}\n ScrollViewComponent={ScrollViewComponent}\n onLayout={onScrollViewLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,QACF,OAAO;AACd,OAAOC,UAAU,IACfC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,QAAQ,EACRC,mBAAmB,EACnBC,cAAc,EACdC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,mBAAmB,QACd,aAAa;AACpB,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,2BAA2B,MAAM,gCAAgC;AAExE,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAAQ,EAAEC,qCAAqC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Q,aAARA,QAAQ,uBAARA,QAAQ,CAAExE,MAAM,CAACe,MAAM,GAClD;MACA;MACA;MACA;MACAmC,yBAAyB,CAAC,CAAC;IAC7B;EACF,CAAC,EACD,EACF,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA;EACA,MAAMuB,OAAO,GAAGzG,eAAe,CAC7B,MAAOiB,OAAO,GAAGmB,0BAA0B,CAACc,KAAK,GAAG,CAAC,GAAG,CAAE,EAC1D,CAACjC,OAAO,CACV,CAAC;EAED,oBACE9B,KAAA,CAAAuH,aAAA,CAAClG,2BAA2B,EAAAmG,QAAA;IAC1BpF,GAAG,EAAEI;EAAM,GACPL,IAAI;IACRsF,aAAa,EAAEH,OAAQ;IACvBI,mBAAmB,EAAE,EAAG;IACxB1F,mBAAmB,EAAEA,mBAAoB;IACzCL,QAAQ,EAAEkC;EAAmB,IAE5BnC,QAC0B,CAAC;AAElC,CACF,CAAC;AAED,eAAeD,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","Reanimated","clamp","interpolate","runOnUI","scrollTo","useAnimatedReaction","useAnimatedRef","useDerivedValue","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useWindowDimensions","findNodeHandle","useCombinedRef","useScrollState","ScrollViewWithBottomPadding","useSmoothKeyboardHandler","debounce","scrollDistanceWithRespectToSnapPoints","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","extraKeyboardSpace","ScrollViewComponent","ScrollView","snapToOffsets","rest","ref","scrollViewAnimatedRef","scrollViewRef","useRef","onRef","scrollViewTarget","scrollPosition","offset","position","layout","scrollViewLayout","size","scrollViewContentSize","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","update","lastSelection","ghostViewSpace","height","onScrollViewLayout","e","value","current","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","relativeScrollTo","interpolatedScrollTo","targetScrollY","Math","max","positionOnScreen","topOfScreen","removeGhostPadding","performScrollWithPositionRestoration","newPosition","prevScroll","syncKeyboardFrame","keyboardFrame","updateLayoutFromSelection","_lastSelection$value","_input$value","customHeight","selection","end","y","scrollFromCurrentPosition","prevLayout","onChangeText","onChangeTextHandler","onSelectionChange","_lastSelection$value2","_lastSelection$value3","lastTarget","target","latestSelection","start","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","onMove","onEnd","synchronize","scrollView","existingMethods","assureFocusedInputVisible","previous","padding","createElement","_extends","bottomPadding","scrollEventThrottle"],"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 useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n useWindowDimensions,\n} from \"../../hooks\";\nimport { findNodeHandle } from \"../../utils/findNodeHandle\";\nimport useCombinedRef from \"../hooks/useCombinedRef\";\nimport useScrollState from \"../hooks/useScrollState\";\nimport ScrollViewWithBottomPadding from \"../ScrollViewWithBottomPadding\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce, scrollDistanceWithRespectToSnapPoints } from \"./utils\";\n\nimport type { AnimatedScrollViewComponent } from \"../ScrollViewWithBottomPadding\";\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?: AnimatedScrollViewComponent;\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 onRef = useCombinedRef(scrollViewAnimatedRef, scrollViewRef);\n const scrollViewTarget = useSharedValue<number | null>(null);\n const scrollPosition = useSharedValue(0);\n const {\n offset: position,\n layout: scrollViewLayout,\n size: scrollViewContentSize,\n } = useScrollState(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 const ghostViewSpace = useSharedValue(-1);\n\n const { height } = useWindowDimensions();\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 removeGhostPadding = useCallback((e: number) => {\n \"worklet\";\n\n // new `ScrollViewWithBottomPadding` behavior: if we hide keyboard and we are in the end of `ScrollView`\n // then we always need to scroll back, because we apply a padding that doesn't change layout, so we will\n // not have auto scroll back in this case\n if (!keyboardWillAppear.value && ghostViewSpace.value > 0) {\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n scrollPosition.value -\n interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [ghostViewSpace.value, 0],\n ),\n false,\n );\n\n return true;\n }\n\n return false;\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 ghostViewSpace.value =\n position.value +\n scrollViewLayout.value.height -\n scrollViewContentSize.value.height;\n\n if (ghostViewSpace.value > 0) {\n scrollPosition.value = position.value;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n syncKeyboardFrame(e);\n\n if (removeGhostPadding(e.height)) {\n return;\n }\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 removeGhostPadding(e.height);\n\n keyboardHeight.value = e.height;\n scrollPosition.value = position.value;\n\n syncKeyboardFrame(e);\n },\n },\n [\n maybeScroll,\n removeGhostPadding,\n disableScrollOnKeyboardHide,\n syncKeyboardFrame,\n ],\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 // 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 const padding = useDerivedValue(\n () => (enabled ? currentKeyboardFrameHeight.value + 1 : 0),\n [enabled],\n );\n\n return (\n <ScrollViewWithBottomPadding\n ref={onRef}\n {...rest}\n bottomPadding={padding}\n scrollEventThrottle={16}\n ScrollViewComponent={ScrollViewComponent}\n onLayout={onScrollViewLayout}\n >\n {children}\n </ScrollViewWithBottomPadding>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,QACF,OAAO;AACd,OAAOC,UAAU,IACfC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,QAAQ,EACRC,mBAAmB,EACnBC,cAAc,EACdC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SACEC,sBAAsB,EACtBC,yBAAyB,EACzBC,mBAAmB,QACd,aAAa;AACpB,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,2BAA2B,MAAM,gCAAgC;AAExE,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAAQ,EAAEC,qCAAqC,QAAQ,SAAS;AA8BzE;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;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,gBAAGxB,UAAU,CAIxC,CACE;EACEyB,QAAQ;EACRC,QAAQ;EACRC,YAAY,GAAG,CAAC;EAChBC,2BAA2B,GAAG,KAAK;EACnCC,OAAO,GAAG,IAAI;EACdC,kBAAkB,GAAG,CAAC;EACtBC,mBAAmB,GAAG1B,UAAU,CAAC2B,UAAU;EAC3CC,aAAa;EACb,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,qBAAqB,GAAGzB,cAAc,CAA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AO,CACV,CAAC;EAED,oBACE9B,KAAA,CAAAqH,aAAA,CAAChG,2BAA2B,EAAAiG,QAAA;IAC1BlF,GAAG,EAAEI;EAAM,GACPL,IAAI;IACRoF,aAAa,EAAEH,OAAQ;IACvBI,mBAAmB,EAAE,EAAG;IACxBxF,mBAAmB,EAAEA,mBAAoB;IACzCL,QAAQ,EAAEiC;EAAmB,IAE5BlC,QAC0B,CAAC;AAElC,CACF,CAAC;AAED,eAAeD,uBAAuB","ignoreList":[]}
@@ -33,11 +33,13 @@ const KeyboardStickyView = /*#__PURE__*/forwardRef(({
33
33
  inputRange: [0, 1],
34
34
  outputRange: [closed, opened]
35
35
  });
36
- const styles = useMemo(() => [{
37
- transform: [{
38
- translateY: enabled ? Animated.add(height, offset) : closed
39
- }]
40
- }, style], [closed, enabled, height, offset, style]);
36
+ const styles = useMemo(() => {
37
+ return [{
38
+ transform: [{
39
+ translateY: enabled ? Animated.add(height, offset) : closed
40
+ }]
41
+ }, style];
42
+ }, [closed, enabled, height, offset, style]);
41
43
  return /*#__PURE__*/React.createElement(Animated.View, _extends({
42
44
  ref: ref,
43
45
  style: styles