react-native-keyboard-controller 1.11.5 → 1.11.7
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/main/java/com/reactnativekeyboardcontroller/events/FocusedInputLayoutChangedEvent.kt +1 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/events/FocusedInputTextChangedEvent.kt +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +11 -13
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +12 -14
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/package.json +2 -1
- package/react-native-keyboard-controller.podspec +1 -0
- package/src/components/KeyboardAwareScrollView/index.tsx +88 -89
- package/ios/KeyboardController.xcodeproj/project.pbxproj +0 -387
|
@@ -19,7 +19,7 @@ class FocusedInputLayoutChangedEvent(
|
|
|
19
19
|
surfaceId: Int,
|
|
20
20
|
viewId: Int,
|
|
21
21
|
private val event: FocusedInputLayoutChangedEventData,
|
|
22
|
-
) : Event<
|
|
22
|
+
) : Event<FocusedInputLayoutChangedEvent>(surfaceId, viewId) {
|
|
23
23
|
override fun getEventName() = "topFocusedInputLayoutChanged"
|
|
24
24
|
|
|
25
25
|
// All events for a given view can be coalesced
|
|
@@ -8,7 +8,7 @@ class FocusedInputTextChangedEvent(
|
|
|
8
8
|
surfaceId: Int,
|
|
9
9
|
viewId: Int,
|
|
10
10
|
private val text: String,
|
|
11
|
-
) : Event<
|
|
11
|
+
) : Event<FocusedInputTextChangedEvent>(surfaceId, viewId) {
|
|
12
12
|
override fun getEventName() = "topFocusedInputTextChanged"
|
|
13
13
|
|
|
14
14
|
// All events for a given view can be coalesced
|
|
@@ -57,6 +57,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
57
57
|
bottomOffset = 0,
|
|
58
58
|
disableScrollOnKeyboardHide = false,
|
|
59
59
|
enabled = true,
|
|
60
|
+
onScroll: onScrollProps,
|
|
60
61
|
...rest
|
|
61
62
|
}, ref) => {
|
|
62
63
|
const scrollViewAnimatedRef = (0, _reactNativeReanimated.useAnimatedRef)();
|
|
@@ -76,11 +77,10 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
76
77
|
const {
|
|
77
78
|
height
|
|
78
79
|
} = (0, _reactNative.useWindowDimensions)();
|
|
79
|
-
const onScroll = (0,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, []);
|
|
80
|
+
const onScroll = (0, _react.useCallback)(event => {
|
|
81
|
+
position.value = event.nativeEvent.contentOffset.y;
|
|
82
|
+
onScrollProps === null || onScrollProps === void 0 || onScrollProps(event);
|
|
83
|
+
}, [onScrollProps]);
|
|
84
84
|
const onRef = (0, _react.useCallback)(assignedRef => {
|
|
85
85
|
if (typeof ref === "function") {
|
|
86
86
|
ref(assignedRef);
|
|
@@ -147,7 +147,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
147
147
|
(0, _reactNativeKeyboardController.useFocusedInputHandler)({
|
|
148
148
|
onChangeText: onChangeTextHandler
|
|
149
149
|
}, [onChangeTextHandler]);
|
|
150
|
-
(0, _useSmoothKeyboardHandler.useSmoothKeyboardHandler)(
|
|
150
|
+
(0, _useSmoothKeyboardHandler.useSmoothKeyboardHandler)({
|
|
151
151
|
onStart: e => {
|
|
152
152
|
"worklet";
|
|
153
153
|
|
|
@@ -202,7 +202,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
202
202
|
keyboardHeight.value = e.height;
|
|
203
203
|
scrollPosition.value = position.value;
|
|
204
204
|
}
|
|
205
|
-
}
|
|
205
|
+
}, [height, maybeScroll, disableScrollOnKeyboardHide]);
|
|
206
206
|
(0, _reactNativeReanimated.useAnimatedReaction)(() => input.value, (current, previous) => {
|
|
207
207
|
if ((current === null || current === void 0 ? void 0 : current.target) === (previous === null || previous === void 0 ? void 0 : previous.target) && (current === null || current === void 0 ? void 0 : current.layout.height) !== (previous === null || previous === void 0 ? void 0 : previous.layout.height)) {
|
|
208
208
|
const prevLayout = layout.value;
|
|
@@ -211,7 +211,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
211
211
|
layout.value = prevLayout;
|
|
212
212
|
}
|
|
213
213
|
}, []);
|
|
214
|
-
const view = (0, _reactNativeReanimated.useAnimatedStyle)(() =>
|
|
214
|
+
const view = (0, _reactNativeReanimated.useAnimatedStyle)(() => enabled ? {
|
|
215
215
|
// animations become laggy when scrolling to the end of the `ScrollView` (when the last input is focused)
|
|
216
216
|
// this happens because the layout recalculates on every frame. To avoid this we slightly increase padding
|
|
217
217
|
// by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation
|
|
@@ -219,14 +219,12 @@ const KeyboardAwareScrollView = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
219
219
|
// re-calculation on every animation frame and it helps to achieve smooth animation.
|
|
220
220
|
// see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342
|
|
221
221
|
paddingBottom: currentKeyboardFrameHeight.value + 1
|
|
222
|
-
}
|
|
222
|
+
} : {}, [enabled]);
|
|
223
223
|
return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.ScrollView, _extends({
|
|
224
224
|
ref: onRef
|
|
225
225
|
}, rest, {
|
|
226
|
-
onLayout: onScrollViewLayout
|
|
227
|
-
|
|
228
|
-
,
|
|
229
|
-
onScrollReanimated: onScroll,
|
|
226
|
+
onLayout: onScrollViewLayout,
|
|
227
|
+
onScroll: onScroll,
|
|
230
228
|
scrollEventThrottle: 16
|
|
231
229
|
}), children, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
232
230
|
style: view
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeKeyboardController","_useSmoothKeyboardHandler","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","KeyboardAwareScrollView","forwardRef","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","rest","ref","scrollViewAnimatedRef","useAnimatedRef","scrollViewTarget","useSharedValue","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","useReanimatedFocusedInput","layout","height","useWindowDimensions","onScroll","useAnimatedScrollHandler","value","contentOffset","y","onRef","useCallback","assignedRef","current","onScrollViewLayout","findNodeHandle","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","interpolatedScrollTo","interpolate","targetScrollY","Math","max","scrollTo","positionOnScreen","topOfScreen","onChangeText","_layout$value4","_input$value","prevScrollPosition","prevLayout","onChangeTextHandler","useMemo","debounce","useFocusedInputHandler","useSmoothKeyboardHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","onMove","onEnd","useAnimatedReaction","previous","view","useAnimatedStyle","paddingBottom","createElement","ScrollView","onScrollReanimated","scrollEventThrottle","View","style","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle, useWindowDimensions } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n} from \"react-native-keyboard-controller\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type { FocusedInputLayoutChangedEvent } from \"react-native-keyboard-controller\";\n\ntype KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when 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} & ScrollViewProps;\n\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 * +============================+ +============================+ +=====================================+\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 */\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 ...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 = useSharedValue(0);\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\n const { height } = useWindowDimensions();\n\n const onScroll = useAnimatedScrollHandler(\n {\n onScroll: (e) => {\n position.value = e.contentOffset.y;\n },\n },\n [],\n );\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 interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [0, keyboardHeight.value - (height - point) + bottomOffset],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled],\n );\n\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n scrollPosition.value = position.value;\n layout.value = input.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n }, [maybeScroll]);\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n },\n [onChangeTextHandler],\n );\n\n useSmoothKeyboardHandler(\n enabled\n ? {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n keyboardWillAppear.value =\n e.height > 0 && keyboardHeight.value === 0;\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\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\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 currentKeyboardFrameHeight.value = e.height;\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 }\n : {},\n [height, maybeScroll, disableScrollOnKeyboardHide, enabled],\n );\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 const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () => ({\n // animations become laggy 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 );\n\n return (\n <Reanimated.ScrollView\n ref={onRef}\n {...rest}\n onLayout={onScrollViewLayout}\n // @ts-expect-error `onScrollReanimated` is a fake prop needed for reanimated to intercept scroll events\n onScrollReanimated={onScroll}\n scrollEventThrottle={16}\n >\n {children}\n <Reanimated.View style={view} />\n </Reanimated.ScrollView>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAUA,IAAAG,8BAAA,GAAAH,OAAA;AAKA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAmC,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAA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CAACK,KAAK;MAE/BL,MAAM,CAACK,KAAK,GAAGP,KAAK,CAACO,KAAK;MAC1Bf,cAAc,CAACe,KAAK,IAAIS,WAAW,CAACrB,cAAc,CAACY,KAAK,EAAE,IAAI,CAAC;MAC/DL,MAAM,CAACK,KAAK,GAAG+B,UAAU;IAC3B;EACF,CAAC,EACD,EACF,CAAC;EAED,MAAMc,IAAI,GAAG,IAAAC,uCAAgB,EAC3B,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;IACAC,aAAa,EAAE5D,0BAA0B,CAACa,KAAK,GAAG;EACpD,CAAC,CAAC,EACF,EACF,CAAC;EAED,oBACElE,MAAA,CAAAc,OAAA,CAAAoG,aAAA,CAAC9G,sBAAA,CAAAU,OAAU,CAACqG,UAAU,EAAAtF,QAAA;IACpBiB,GAAG,EAAEuB;EAAM,GACPxB,IAAI;IACRJ,QAAQ,EAAEgC;IACV;IAAA;IACA2C,kBAAkB,EAAEpD,QAAS;IAC7BqD,mBAAmB,EAAE;EAAG,IAEvB7E,QAAQ,eACTxC,MAAA,CAAAc,OAAA,CAAAoG,aAAA,CAAC9G,sBAAA,CAAAU,OAAU,CAACwG,IAAI;IAACC,KAAK,EAAER;EAAK,CAAE,CACV,CAAC;AAE5B,CACF,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAA3G,OAAA,GAEawB,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeKeyboardController","_useSmoothKeyboardHandler","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","KeyboardAwareScrollView","forwardRef","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","onScroll","onScrollProps","rest","ref","scrollViewAnimatedRef","useAnimatedRef","scrollViewTarget","useSharedValue","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","useReanimatedFocusedInput","layout","height","useWindowDimensions","useCallback","event","value","nativeEvent","contentOffset","y","onRef","assignedRef","current","onScrollViewLayout","findNodeHandle","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","interpolatedScrollTo","interpolate","targetScrollY","Math","max","scrollTo","positionOnScreen","topOfScreen","onChangeText","_layout$value4","_input$value","prevScrollPosition","prevLayout","onChangeTextHandler","useMemo","debounce","useFocusedInputHandler","useSmoothKeyboardHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","onMove","onEnd","useAnimatedReaction","previous","view","useAnimatedStyle","paddingBottom","createElement","ScrollView","scrollEventThrottle","View","style","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle, useWindowDimensions } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n} from \"react-native-keyboard-controller\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type { FocusedInputLayoutChangedEvent } from \"react-native-keyboard-controller\";\n\ntype KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when 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} & ScrollViewProps;\n\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 * +============================+ +============================+ +=====================================+\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 */\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 onScroll: onScrollProps,\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 = useSharedValue(0);\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\n const { height } = useWindowDimensions();\n\n const onScroll = useCallback<NonNullable<ScrollViewProps[\"onScroll\"]>>(\n (event) => {\n position.value = event.nativeEvent.contentOffset.y;\n\n onScrollProps?.(event);\n },\n [onScrollProps],\n );\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 interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [0, keyboardHeight.value - (height - point) + bottomOffset],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled],\n );\n\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n scrollPosition.value = position.value;\n layout.value = input.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n }, [maybeScroll]);\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n },\n [onChangeTextHandler],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\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\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\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 currentKeyboardFrameHeight.value = e.height;\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 },\n [height, maybeScroll, disableScrollOnKeyboardHide],\n );\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 const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become laggy 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 <Reanimated.ScrollView\n ref={onRef}\n {...rest}\n onLayout={onScrollViewLayout}\n onScroll={onScroll}\n scrollEventThrottle={16}\n >\n {children}\n <Reanimated.View style={view} />\n </Reanimated.ScrollView>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAS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IACA;IACA;IACA;IACAuE,aAAa,EAAE5D,0BAA0B,CAACa,KAAK,GAAG;EACpD,CAAC,GACD,CAAC,CAAC,EACR,CAACxB,OAAO,CACV,CAAC;EAED,oBACE5C,MAAA,CAAAc,OAAA,CAAAsG,aAAA,CAAChH,sBAAA,CAAAU,OAAU,CAACuG,UAAU,EAAAxF,QAAA;IACpBmB,GAAG,EAAEwB;EAAM,GACPzB,IAAI;IACRN,QAAQ,EAAEkC,kBAAmB;IAC7B9B,QAAQ,EAAEA,QAAS;IACnByE,mBAAmB,EAAE;EAAG,IAEvB9E,QAAQ,eACTxC,MAAA,CAAAc,OAAA,CAAAsG,aAAA,CAAChH,sBAAA,CAAAU,OAAU,CAACyG,IAAI;IAACC,KAAK,EAAEP;EAAK,CAAE,CACV,CAAC;AAE5B,CACF,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAA5G,OAAA,GAEawB,uBAAuB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { forwardRef, useCallback, useMemo } from "react";
|
|
3
3
|
import { findNodeHandle, useWindowDimensions } from "react-native";
|
|
4
|
-
import Reanimated, { interpolate, scrollTo, useAnimatedReaction, useAnimatedRef,
|
|
4
|
+
import Reanimated, { interpolate, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedStyle, useSharedValue } from "react-native-reanimated";
|
|
5
5
|
import { useFocusedInputHandler, useReanimatedFocusedInput } from "react-native-keyboard-controller";
|
|
6
6
|
import { useSmoothKeyboardHandler } from "./useSmoothKeyboardHandler";
|
|
7
7
|
import { debounce } from "./utils";
|
|
@@ -49,6 +49,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
|
|
|
49
49
|
bottomOffset = 0,
|
|
50
50
|
disableScrollOnKeyboardHide = false,
|
|
51
51
|
enabled = true,
|
|
52
|
+
onScroll: onScrollProps,
|
|
52
53
|
...rest
|
|
53
54
|
}, ref) => {
|
|
54
55
|
const scrollViewAnimatedRef = useAnimatedRef();
|
|
@@ -68,11 +69,10 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
|
|
|
68
69
|
const {
|
|
69
70
|
height
|
|
70
71
|
} = useWindowDimensions();
|
|
71
|
-
const onScroll =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, []);
|
|
72
|
+
const onScroll = useCallback(event => {
|
|
73
|
+
position.value = event.nativeEvent.contentOffset.y;
|
|
74
|
+
onScrollProps === null || onScrollProps === void 0 || onScrollProps(event);
|
|
75
|
+
}, [onScrollProps]);
|
|
76
76
|
const onRef = useCallback(assignedRef => {
|
|
77
77
|
if (typeof ref === "function") {
|
|
78
78
|
ref(assignedRef);
|
|
@@ -139,7 +139,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
|
|
|
139
139
|
useFocusedInputHandler({
|
|
140
140
|
onChangeText: onChangeTextHandler
|
|
141
141
|
}, [onChangeTextHandler]);
|
|
142
|
-
useSmoothKeyboardHandler(
|
|
142
|
+
useSmoothKeyboardHandler({
|
|
143
143
|
onStart: e => {
|
|
144
144
|
"worklet";
|
|
145
145
|
|
|
@@ -194,7 +194,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
|
|
|
194
194
|
keyboardHeight.value = e.height;
|
|
195
195
|
scrollPosition.value = position.value;
|
|
196
196
|
}
|
|
197
|
-
}
|
|
197
|
+
}, [height, maybeScroll, disableScrollOnKeyboardHide]);
|
|
198
198
|
useAnimatedReaction(() => input.value, (current, previous) => {
|
|
199
199
|
if ((current === null || current === void 0 ? void 0 : current.target) === (previous === null || previous === void 0 ? void 0 : previous.target) && (current === null || current === void 0 ? void 0 : current.layout.height) !== (previous === null || previous === void 0 ? void 0 : previous.layout.height)) {
|
|
200
200
|
const prevLayout = layout.value;
|
|
@@ -203,7 +203,7 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
|
|
|
203
203
|
layout.value = prevLayout;
|
|
204
204
|
}
|
|
205
205
|
}, []);
|
|
206
|
-
const view = useAnimatedStyle(() =>
|
|
206
|
+
const view = useAnimatedStyle(() => enabled ? {
|
|
207
207
|
// animations become laggy when scrolling to the end of the `ScrollView` (when the last input is focused)
|
|
208
208
|
// this happens because the layout recalculates on every frame. To avoid this we slightly increase padding
|
|
209
209
|
// by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation
|
|
@@ -211,14 +211,12 @@ const KeyboardAwareScrollView = /*#__PURE__*/forwardRef(({
|
|
|
211
211
|
// re-calculation on every animation frame and it helps to achieve smooth animation.
|
|
212
212
|
// see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342
|
|
213
213
|
paddingBottom: currentKeyboardFrameHeight.value + 1
|
|
214
|
-
}
|
|
214
|
+
} : {}, [enabled]);
|
|
215
215
|
return /*#__PURE__*/React.createElement(Reanimated.ScrollView, _extends({
|
|
216
216
|
ref: onRef
|
|
217
217
|
}, rest, {
|
|
218
|
-
onLayout: onScrollViewLayout
|
|
219
|
-
|
|
220
|
-
,
|
|
221
|
-
onScrollReanimated: onScroll,
|
|
218
|
+
onLayout: onScrollViewLayout,
|
|
219
|
+
onScroll: onScroll,
|
|
222
220
|
scrollEventThrottle: 16
|
|
223
221
|
}), children, /*#__PURE__*/React.createElement(Reanimated.View, {
|
|
224
222
|
style: view
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useCallback","useMemo","findNodeHandle","useWindowDimensions","Reanimated","interpolate","scrollTo","useAnimatedReaction","useAnimatedRef","useAnimatedScrollHandler","useAnimatedStyle","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useSmoothKeyboardHandler","debounce","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","rest","ref","scrollViewAnimatedRef","scrollViewTarget","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","layout","height","onScroll","e","value","contentOffset","y","onRef","assignedRef","current","onScrollViewLayout","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","interpolatedScrollTo","targetScrollY","Math","max","positionOnScreen","topOfScreen","onChangeText","_layout$value4","_input$value","prevScrollPosition","prevLayout","onChangeTextHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","onEnd","previous","view","paddingBottom","createElement","ScrollView","_extends","onScrollReanimated","scrollEventThrottle","View","style"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle, useWindowDimensions } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n} from \"react-native-keyboard-controller\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type { FocusedInputLayoutChangedEvent } from \"react-native-keyboard-controller\";\n\ntype KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when 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} & ScrollViewProps;\n\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 * +============================+ +============================+ +=====================================+\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 */\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 ...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 = useSharedValue(0);\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\n const { height } = useWindowDimensions();\n\n const onScroll = useAnimatedScrollHandler(\n {\n onScroll: (e) => {\n position.value = e.contentOffset.y;\n },\n },\n [],\n );\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 interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [0, keyboardHeight.value - (height - point) + bottomOffset],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled],\n );\n\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n scrollPosition.value = position.value;\n layout.value = input.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n }, [maybeScroll]);\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n },\n [onChangeTextHandler],\n );\n\n useSmoothKeyboardHandler(\n enabled\n ? {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n keyboardWillAppear.value =\n e.height > 0 && keyboardHeight.value === 0;\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\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\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 currentKeyboardFrameHeight.value = e.height;\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 }\n : {},\n [height, maybeScroll, disableScrollOnKeyboardHide, enabled],\n );\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 const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () => ({\n // animations become laggy 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 );\n\n return (\n <Reanimated.ScrollView\n ref={onRef}\n {...rest}\n onLayout={onScrollViewLayout}\n // @ts-expect-error `onScrollReanimated` is a fake prop needed for reanimated to intercept scroll events\n onScrollReanimated={onScroll}\n scrollEventThrottle={16}\n >\n {children}\n <Reanimated.View style={view} />\n </Reanimated.ScrollView>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,cAAc;AAClE,OAAOC,UAAU,IACfC,WAAW,EACXC,QAA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,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useCallback","useMemo","findNodeHandle","useWindowDimensions","Reanimated","interpolate","scrollTo","useAnimatedReaction","useAnimatedRef","useAnimatedStyle","useSharedValue","useFocusedInputHandler","useReanimatedFocusedInput","useSmoothKeyboardHandler","debounce","KeyboardAwareScrollView","children","onLayout","bottomOffset","disableScrollOnKeyboardHide","enabled","onScroll","onScrollProps","rest","ref","scrollViewAnimatedRef","scrollViewTarget","scrollPosition","position","currentKeyboardFrameHeight","keyboardHeight","keyboardWillAppear","tag","initialKeyboardSize","scrollBeforeKeyboardMovement","input","layout","height","event","value","nativeEvent","contentOffset","y","onRef","assignedRef","current","onScrollViewLayout","e","maybeScroll","animated","_layout$value","_layout$value2","_layout$value3","parentScrollViewTarget","visibleRect","absoluteY","inputHeight","point","interpolatedScrollTo","targetScrollY","Math","max","positionOnScreen","topOfScreen","onChangeText","_layout$value4","_input$value","prevScrollPosition","prevLayout","onChangeTextHandler","onStart","keyboardWillChangeSize","keyboardWillHide","focusWasChanged","target","onMove","onEnd","previous","view","paddingBottom","createElement","ScrollView","_extends","scrollEventThrottle","View","style"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { findNodeHandle, useWindowDimensions } from \"react-native\";\nimport Reanimated, {\n interpolate,\n scrollTo,\n useAnimatedReaction,\n useAnimatedRef,\n useAnimatedStyle,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport {\n useFocusedInputHandler,\n useReanimatedFocusedInput,\n} from \"react-native-keyboard-controller\";\n\nimport { useSmoothKeyboardHandler } from \"./useSmoothKeyboardHandler\";\nimport { debounce } from \"./utils\";\n\nimport type {\n LayoutChangeEvent,\n ScrollView,\n ScrollViewProps,\n} from \"react-native\";\nimport type { FocusedInputLayoutChangedEvent } from \"react-native-keyboard-controller\";\n\ntype KeyboardAwareScrollViewProps = {\n /** The distance between keyboard and focused `TextInput` when 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} & ScrollViewProps;\n\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 * +============================+ +============================+ +=====================================+\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 */\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 onScroll: onScrollProps,\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 = useSharedValue(0);\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\n const { height } = useWindowDimensions();\n\n const onScroll = useCallback<NonNullable<ScrollViewProps[\"onScroll\"]>>(\n (event) => {\n position.value = event.nativeEvent.contentOffset.y;\n\n onScrollProps?.(event);\n },\n [onScrollProps],\n );\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 interpolatedScrollTo = interpolate(\n e,\n [initialKeyboardSize.value, keyboardHeight.value],\n [0, keyboardHeight.value - (height - point) + bottomOffset],\n );\n const targetScrollY =\n Math.max(interpolatedScrollTo, 0) + scrollPosition.value;\n scrollTo(scrollViewAnimatedRef, 0, targetScrollY, animated);\n\n return interpolatedScrollTo;\n }\n\n if (absoluteY < 0) {\n const positionOnScreen = visibleRect - inputHeight - bottomOffset;\n const topOfScreen = scrollPosition.value + absoluteY;\n\n scrollTo(\n scrollViewAnimatedRef,\n 0,\n topOfScreen - positionOnScreen,\n animated,\n );\n }\n\n return 0;\n },\n [bottomOffset, enabled],\n );\n\n const onChangeText = useCallback(() => {\n \"worklet\";\n\n // if typing a text caused layout shift, then we need to ignore this handler\n // because this event will be handled in `useAnimatedReaction` below\n if (layout.value?.layout.height !== input.value?.layout.height) {\n return;\n }\n\n const prevScrollPosition = scrollPosition.value;\n const prevLayout = layout.value;\n\n scrollPosition.value = position.value;\n layout.value = input.value;\n maybeScroll(keyboardHeight.value, true);\n scrollPosition.value = prevScrollPosition;\n layout.value = prevLayout;\n }, [maybeScroll]);\n\n const onChangeTextHandler = useMemo(\n () => debounce(onChangeText, 200),\n [onChangeText],\n );\n\n useFocusedInputHandler(\n {\n onChangeText: onChangeTextHandler,\n },\n [onChangeTextHandler],\n );\n\n useSmoothKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n const keyboardWillChangeSize =\n keyboardHeight.value !== e.height && e.height > 0;\n keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;\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\n // save position of focused text input when keyboard starts to move\n layout.value = input.value;\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 currentKeyboardFrameHeight.value = e.height;\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 },\n [height, maybeScroll, disableScrollOnKeyboardHide],\n );\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 const prevLayout = layout.value;\n\n layout.value = input.value;\n scrollPosition.value += maybeScroll(keyboardHeight.value, true);\n layout.value = prevLayout;\n }\n },\n [],\n );\n\n const view = useAnimatedStyle(\n () =>\n enabled\n ? {\n // animations become laggy 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 <Reanimated.ScrollView\n ref={onRef}\n {...rest}\n onLayout={onScrollViewLayout}\n onScroll={onScroll}\n scrollEventThrottle={16}\n >\n {children}\n <Reanimated.View style={view} />\n </Reanimated.ScrollView>\n );\n },\n);\n\nexport default KeyboardAwareScrollView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC/D,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,cAAc;AAClE,OAAOC,UAAU,IACfC,WAAW,EACXC,QAAQ,EACRC,mBAAmB,EACnBC,cAAc,EACdC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAEhC,SACEC,sBAAsB,EACtBC,yBAAyB,QACpB,kCAAkC;AAEzC,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,QAAQ,QAAQ,SAAS;AAkBlC;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;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,gBAAGhB,UAAU,CAIxC,CACE;EACEiB,QAAQ;EACRC,QAAQ;EACRC,YAAY,GAAG,CAAC;EAChBC,2BAA2B,GAAG,KAAK;EACnCC,OAAO,GAAG,IAAI;EACdC,QAAQ,EAAEC,aAAa;EACvB,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,qBAAqB,GAAGjB,cAAc,CAAwB,CAAC;EACrE,MAAMkB,gBAAgB,GAAGhB,cAAc,CAAgB,IAAI,CAAC;EAC5D,MAAMiB,cAAc,GAAGjB,cAAc,CAAC,CAAC,CAAC;EACxC,MAAMkB,QAAQ,GAAGlB,cAAc,CAAC,CAAC,CAAC;EAClC,MAAMmB,0BAA0B,GAAGnB,cAAc,CAAC,CAAC,CAAC;EACpD,MAAMoB,cAAc,GAAGpB,cAAc,CAAC,CAAC,CAAC;EACxC,MAAMqB,kBAAkB,GAAGrB,cAAc,CAAC,KAAK,CAAC;EAChD,MAAMsB,GAAG,GAAGtB,cAA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AU,CAAC6E,UAAU,EAAAC,QAAA;IACpB1D,GAAG,EAAEmB;EAAM,GACPpB,IAAI;IACRN,QAAQ,EAAE6B,kBAAmB;IAC7BzB,QAAQ,EAAEA,QAAS;IACnB8D,mBAAmB,EAAE;EAAG,IAEvBnE,QAAQ,eACTlB,KAAA,CAAAkF,aAAA,CAAC5E,UAAU,CAACgF,IAAI;IAACC,KAAK,EAAEP;EAAK,CAAE,CACV,CAAC;AAE5B,CACF,CAAC;AAED,eAAe/D,uBAAuB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-keyboard-controller",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"description": "Keyboard manager which works in identical way on both iOS and Android",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"!android/gradlew",
|
|
23
23
|
"!android/gradlew.bat",
|
|
24
24
|
"!ios/build",
|
|
25
|
+
"!ios/KeyboardControllerNative",
|
|
25
26
|
"!**/__tests__",
|
|
26
27
|
"!**/__fixtures__",
|
|
27
28
|
"!**/__mocks__"
|
|
@@ -18,6 +18,7 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.source = { :git => "https://github.com/kirillzyusko/react-native-keyboard-controller.git", :tag => "#{s.version}" }
|
|
19
19
|
|
|
20
20
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
21
|
+
s.exclude_files = "ios/KeyboardControllerNative/**/*"
|
|
21
22
|
s.public_header_files = "ios/**/*.h"
|
|
22
23
|
|
|
23
24
|
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
@@ -5,7 +5,6 @@ import Reanimated, {
|
|
|
5
5
|
scrollTo,
|
|
6
6
|
useAnimatedReaction,
|
|
7
7
|
useAnimatedRef,
|
|
8
|
-
useAnimatedScrollHandler,
|
|
9
8
|
useAnimatedStyle,
|
|
10
9
|
useSharedValue,
|
|
11
10
|
} from "react-native-reanimated";
|
|
@@ -83,6 +82,7 @@ const KeyboardAwareScrollView = forwardRef<
|
|
|
83
82
|
bottomOffset = 0,
|
|
84
83
|
disableScrollOnKeyboardHide = false,
|
|
85
84
|
enabled = true,
|
|
85
|
+
onScroll: onScrollProps,
|
|
86
86
|
...rest
|
|
87
87
|
},
|
|
88
88
|
ref,
|
|
@@ -102,13 +102,13 @@ const KeyboardAwareScrollView = forwardRef<
|
|
|
102
102
|
|
|
103
103
|
const { height } = useWindowDimensions();
|
|
104
104
|
|
|
105
|
-
const onScroll =
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
const onScroll = useCallback<NonNullable<ScrollViewProps["onScroll"]>>(
|
|
106
|
+
(event) => {
|
|
107
|
+
position.value = event.nativeEvent.contentOffset.y;
|
|
108
|
+
|
|
109
|
+
onScrollProps?.(event);
|
|
110
110
|
},
|
|
111
|
-
[],
|
|
111
|
+
[onScrollProps],
|
|
112
112
|
);
|
|
113
113
|
|
|
114
114
|
const onRef = useCallback((assignedRef: Reanimated.ScrollView) => {
|
|
@@ -212,77 +212,74 @@ const KeyboardAwareScrollView = forwardRef<
|
|
|
212
212
|
);
|
|
213
213
|
|
|
214
214
|
useSmoothKeyboardHandler(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
// this value to achieve smooth hide effect
|
|
258
|
-
scrollBeforeKeyboardMovement.value = position.value;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (focusWasChanged && !keyboardWillAppear.value) {
|
|
262
|
-
// update position on scroll value, so `onEnd` handler
|
|
263
|
-
// will pick up correct values
|
|
264
|
-
position.value += maybeScroll(e.height, true);
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
onMove: (e) => {
|
|
268
|
-
"worklet";
|
|
269
|
-
|
|
270
|
-
currentKeyboardFrameHeight.value = e.height;
|
|
271
|
-
|
|
272
|
-
// if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens
|
|
273
|
-
if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {
|
|
274
|
-
maybeScroll(e.height);
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
onEnd: (e) => {
|
|
278
|
-
"worklet";
|
|
279
|
-
|
|
280
|
-
keyboardHeight.value = e.height;
|
|
281
|
-
scrollPosition.value = position.value;
|
|
282
|
-
},
|
|
215
|
+
{
|
|
216
|
+
onStart: (e) => {
|
|
217
|
+
"worklet";
|
|
218
|
+
|
|
219
|
+
const keyboardWillChangeSize =
|
|
220
|
+
keyboardHeight.value !== e.height && e.height > 0;
|
|
221
|
+
keyboardWillAppear.value = e.height > 0 && keyboardHeight.value === 0;
|
|
222
|
+
const keyboardWillHide = e.height === 0;
|
|
223
|
+
const focusWasChanged =
|
|
224
|
+
(tag.value !== e.target && e.target !== -1) ||
|
|
225
|
+
keyboardWillChangeSize;
|
|
226
|
+
|
|
227
|
+
if (keyboardWillChangeSize) {
|
|
228
|
+
initialKeyboardSize.value = keyboardHeight.value;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (keyboardWillHide) {
|
|
232
|
+
// on back transition need to interpolate as [0, keyboardHeight]
|
|
233
|
+
initialKeyboardSize.value = 0;
|
|
234
|
+
scrollPosition.value = scrollBeforeKeyboardMovement.value;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (
|
|
238
|
+
keyboardWillAppear.value ||
|
|
239
|
+
keyboardWillChangeSize ||
|
|
240
|
+
focusWasChanged
|
|
241
|
+
) {
|
|
242
|
+
// persist scroll value
|
|
243
|
+
scrollPosition.value = position.value;
|
|
244
|
+
// just persist height - later will be used in interpolation
|
|
245
|
+
keyboardHeight.value = e.height;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// focus was changed
|
|
249
|
+
if (focusWasChanged) {
|
|
250
|
+
tag.value = e.target;
|
|
251
|
+
|
|
252
|
+
// save position of focused text input when keyboard starts to move
|
|
253
|
+
layout.value = input.value;
|
|
254
|
+
// save current scroll position - when keyboard will hide we'll reuse
|
|
255
|
+
// this value to achieve smooth hide effect
|
|
256
|
+
scrollBeforeKeyboardMovement.value = position.value;
|
|
283
257
|
}
|
|
284
|
-
|
|
285
|
-
|
|
258
|
+
|
|
259
|
+
if (focusWasChanged && !keyboardWillAppear.value) {
|
|
260
|
+
// update position on scroll value, so `onEnd` handler
|
|
261
|
+
// will pick up correct values
|
|
262
|
+
position.value += maybeScroll(e.height, true);
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
onMove: (e) => {
|
|
266
|
+
"worklet";
|
|
267
|
+
|
|
268
|
+
currentKeyboardFrameHeight.value = e.height;
|
|
269
|
+
|
|
270
|
+
// if the user has set disableScrollOnKeyboardHide, only auto-scroll when the keyboard opens
|
|
271
|
+
if (!disableScrollOnKeyboardHide || keyboardWillAppear.value) {
|
|
272
|
+
maybeScroll(e.height);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
onEnd: (e) => {
|
|
276
|
+
"worklet";
|
|
277
|
+
|
|
278
|
+
keyboardHeight.value = e.height;
|
|
279
|
+
scrollPosition.value = position.value;
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
[height, maybeScroll, disableScrollOnKeyboardHide],
|
|
286
283
|
);
|
|
287
284
|
|
|
288
285
|
useAnimatedReaction(
|
|
@@ -303,16 +300,19 @@ const KeyboardAwareScrollView = forwardRef<
|
|
|
303
300
|
);
|
|
304
301
|
|
|
305
302
|
const view = useAnimatedStyle(
|
|
306
|
-
() =>
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
303
|
+
() =>
|
|
304
|
+
enabled
|
|
305
|
+
? {
|
|
306
|
+
// animations become laggy when scrolling to the end of the `ScrollView` (when the last input is focused)
|
|
307
|
+
// this happens because the layout recalculates on every frame. To avoid this we slightly increase padding
|
|
308
|
+
// by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation
|
|
309
|
+
// from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout
|
|
310
|
+
// re-calculation on every animation frame and it helps to achieve smooth animation.
|
|
311
|
+
// see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342
|
|
312
|
+
paddingBottom: currentKeyboardFrameHeight.value + 1,
|
|
313
|
+
}
|
|
314
|
+
: {},
|
|
315
|
+
[enabled],
|
|
316
316
|
);
|
|
317
317
|
|
|
318
318
|
return (
|
|
@@ -320,8 +320,7 @@ const KeyboardAwareScrollView = forwardRef<
|
|
|
320
320
|
ref={onRef}
|
|
321
321
|
{...rest}
|
|
322
322
|
onLayout={onScrollViewLayout}
|
|
323
|
-
|
|
324
|
-
onScrollReanimated={onScroll}
|
|
323
|
+
onScroll={onScroll}
|
|
325
324
|
scrollEventThrottle={16}
|
|
326
325
|
>
|
|
327
326
|
{children}
|
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
// !$*UTF8*$!
|
|
2
|
-
{
|
|
3
|
-
archiveVersion = 1;
|
|
4
|
-
classes = {
|
|
5
|
-
};
|
|
6
|
-
objectVersion = 46;
|
|
7
|
-
objects = {
|
|
8
|
-
|
|
9
|
-
/* Begin PBXBuildFile section */
|
|
10
|
-
0800511C2B65548600928E51 /* FocusedInputHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0800511B2B65548600928E51 /* FocusedInputHolder.swift */; };
|
|
11
|
-
0800511E2B65558800928E51 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0800511D2B65558800928E51 /* TextInput.swift */; };
|
|
12
|
-
0807071E2A34807B00C05A19 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0807071D2A34807B00C05A19 /* Extensions.swift */; };
|
|
13
|
-
083FB9852B15171600C0EFF0 /* TextChangeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 083FB9842B15171600C0EFF0 /* TextChangeObserver.swift */; };
|
|
14
|
-
083FB9872B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 083FB9862B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m */; };
|
|
15
|
-
084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */; };
|
|
16
|
-
084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */; };
|
|
17
|
-
089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */; };
|
|
18
|
-
08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */; };
|
|
19
|
-
08DF17B32BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */; };
|
|
20
|
-
F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */; };
|
|
21
|
-
F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */; };
|
|
22
|
-
F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */; };
|
|
23
|
-
F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */; };
|
|
24
|
-
F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */; };
|
|
25
|
-
/* End PBXBuildFile section */
|
|
26
|
-
|
|
27
|
-
/* Begin PBXCopyFilesBuildPhase section */
|
|
28
|
-
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
29
|
-
isa = PBXCopyFilesBuildPhase;
|
|
30
|
-
buildActionMask = 2147483647;
|
|
31
|
-
dstPath = "include/$(PRODUCT_NAME)";
|
|
32
|
-
dstSubfolderSpec = 16;
|
|
33
|
-
files = (
|
|
34
|
-
);
|
|
35
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
36
|
-
};
|
|
37
|
-
/* End PBXCopyFilesBuildPhase section */
|
|
38
|
-
|
|
39
|
-
/* Begin PBXFileReference section */
|
|
40
|
-
0800511B2B65548600928E51 /* FocusedInputHolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputHolder.swift; sourceTree = "<group>"; };
|
|
41
|
-
0800511D2B65558800928E51 /* TextInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextInput.swift; sourceTree = "<group>"; };
|
|
42
|
-
0807071D2A34807B00C05A19 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
|
|
43
|
-
083FB9842B15171600C0EFF0 /* TextChangeObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextChangeObserver.swift; sourceTree = "<group>"; };
|
|
44
|
-
083FB9862B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputTextChangedEvent.m; sourceTree = "<group>"; };
|
|
45
|
-
083FB9892B15177C00C0EFF0 /* FocusedInputTextChangedEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FocusedInputTextChangedEvent.h; sourceTree = "<group>"; };
|
|
46
|
-
084AEEC22ACF479A001A3069 /* FocusedInputLayoutChangedEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FocusedInputLayoutChangedEvent.h; sourceTree = "<group>"; };
|
|
47
|
-
084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputLayoutChangedEvent.m; sourceTree = "<group>"; };
|
|
48
|
-
084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputObserver.swift; sourceTree = "<group>"; };
|
|
49
|
-
089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewHierarchyNavigator.swift; sourceTree = "<group>"; };
|
|
50
|
-
08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardView.swift; sourceTree = "<group>"; };
|
|
51
|
-
08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RCTUIManager+LayoutAnimationManager.m"; sourceTree = "<group>"; };
|
|
52
|
-
08DF17B52BB1845500279890 /* RCTUIManager+LayoutAnimationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTUIManager+LayoutAnimationManager.h"; sourceTree = "<group>"; };
|
|
53
|
-
134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
54
|
-
B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerViewManager.mm; sourceTree = "<group>"; };
|
|
55
|
-
F333F8D128996B1C0015B05F /* KeyboardControllerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardControllerView.h; sourceTree = "<group>"; };
|
|
56
|
-
F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerView.mm; sourceTree = "<group>"; };
|
|
57
|
-
F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerModule.mm; sourceTree = "<group>"; };
|
|
58
|
-
F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardControllerModule-Header.h"; sourceTree = "<group>"; };
|
|
59
|
-
F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardMovementObserver.swift; sourceTree = "<group>"; };
|
|
60
|
-
F3F50667289E653B003091D6 /* KeyboardMoveEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardMoveEvent.h; sourceTree = "<group>"; };
|
|
61
|
-
F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardMoveEvent.m; sourceTree = "<group>"; };
|
|
62
|
-
F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardController-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
63
|
-
F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardControllerViewManager.swift; sourceTree = "<group>"; };
|
|
64
|
-
/* End PBXFileReference section */
|
|
65
|
-
|
|
66
|
-
/* Begin PBXFrameworksBuildPhase section */
|
|
67
|
-
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
68
|
-
isa = PBXFrameworksBuildPhase;
|
|
69
|
-
buildActionMask = 2147483647;
|
|
70
|
-
files = (
|
|
71
|
-
);
|
|
72
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
73
|
-
};
|
|
74
|
-
/* End PBXFrameworksBuildPhase section */
|
|
75
|
-
|
|
76
|
-
/* Begin PBXGroup section */
|
|
77
|
-
084AEEBF2ACDFBF1001A3069 /* events */ = {
|
|
78
|
-
isa = PBXGroup;
|
|
79
|
-
children = (
|
|
80
|
-
F3F50667289E653B003091D6 /* KeyboardMoveEvent.h */,
|
|
81
|
-
F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */,
|
|
82
|
-
084AEEC22ACF479A001A3069 /* FocusedInputLayoutChangedEvent.h */,
|
|
83
|
-
084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */,
|
|
84
|
-
083FB9892B15177C00C0EFF0 /* FocusedInputTextChangedEvent.h */,
|
|
85
|
-
083FB9862B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m */,
|
|
86
|
-
);
|
|
87
|
-
path = events;
|
|
88
|
-
sourceTree = "<group>";
|
|
89
|
-
};
|
|
90
|
-
084AEEC02ACDFC2A001A3069 /* observers */ = {
|
|
91
|
-
isa = PBXGroup;
|
|
92
|
-
children = (
|
|
93
|
-
F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */,
|
|
94
|
-
084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */,
|
|
95
|
-
083FB9842B15171600C0EFF0 /* TextChangeObserver.swift */,
|
|
96
|
-
);
|
|
97
|
-
path = observers;
|
|
98
|
-
sourceTree = "<group>";
|
|
99
|
-
};
|
|
100
|
-
084AEEC12ACF405C001A3069 /* views */ = {
|
|
101
|
-
isa = PBXGroup;
|
|
102
|
-
children = (
|
|
103
|
-
F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */,
|
|
104
|
-
F333F8D128996B1C0015B05F /* KeyboardControllerView.h */,
|
|
105
|
-
F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */,
|
|
106
|
-
B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */,
|
|
107
|
-
);
|
|
108
|
-
path = views;
|
|
109
|
-
sourceTree = "<group>";
|
|
110
|
-
};
|
|
111
|
-
089BA5DD2B3EC978000A9A90 /* traversal */ = {
|
|
112
|
-
isa = PBXGroup;
|
|
113
|
-
children = (
|
|
114
|
-
089BA5DB2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift */,
|
|
115
|
-
0800511B2B65548600928E51 /* FocusedInputHolder.swift */,
|
|
116
|
-
0800511D2B65558800928E51 /* TextInput.swift */,
|
|
117
|
-
08C47AFB2BA9AF7100DB93BB /* KeyboardView.swift */,
|
|
118
|
-
);
|
|
119
|
-
path = traversal;
|
|
120
|
-
sourceTree = "<group>";
|
|
121
|
-
};
|
|
122
|
-
08DF17B12BB1834400279890 /* objc */ = {
|
|
123
|
-
isa = PBXGroup;
|
|
124
|
-
children = (
|
|
125
|
-
08DF17B22BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m */,
|
|
126
|
-
08DF17B52BB1845500279890 /* RCTUIManager+LayoutAnimationManager.h */,
|
|
127
|
-
);
|
|
128
|
-
path = objc;
|
|
129
|
-
sourceTree = "<group>";
|
|
130
|
-
};
|
|
131
|
-
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
132
|
-
isa = PBXGroup;
|
|
133
|
-
children = (
|
|
134
|
-
134814201AA4EA6300B7C361 /* libKeyboardController.a */,
|
|
135
|
-
);
|
|
136
|
-
name = Products;
|
|
137
|
-
sourceTree = "<group>";
|
|
138
|
-
};
|
|
139
|
-
58B511D21A9E6C8500147676 = {
|
|
140
|
-
isa = PBXGroup;
|
|
141
|
-
children = (
|
|
142
|
-
08DF17B12BB1834400279890 /* objc */,
|
|
143
|
-
089BA5DD2B3EC978000A9A90 /* traversal */,
|
|
144
|
-
084AEEC12ACF405C001A3069 /* views */,
|
|
145
|
-
084AEEC02ACDFC2A001A3069 /* observers */,
|
|
146
|
-
084AEEBF2ACDFBF1001A3069 /* events */,
|
|
147
|
-
0807071D2A34807B00C05A19 /* Extensions.swift */,
|
|
148
|
-
F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */,
|
|
149
|
-
F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */,
|
|
150
|
-
F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */,
|
|
151
|
-
134814211AA4EA7D00B7C361 /* Products */,
|
|
152
|
-
);
|
|
153
|
-
sourceTree = "<group>";
|
|
154
|
-
};
|
|
155
|
-
/* End PBXGroup section */
|
|
156
|
-
|
|
157
|
-
/* Begin PBXNativeTarget section */
|
|
158
|
-
58B511DA1A9E6C8500147676 /* KeyboardController */ = {
|
|
159
|
-
isa = PBXNativeTarget;
|
|
160
|
-
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "KeyboardController" */;
|
|
161
|
-
buildPhases = (
|
|
162
|
-
58B511D71A9E6C8500147676 /* Sources */,
|
|
163
|
-
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
164
|
-
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
165
|
-
);
|
|
166
|
-
buildRules = (
|
|
167
|
-
);
|
|
168
|
-
dependencies = (
|
|
169
|
-
);
|
|
170
|
-
name = KeyboardController;
|
|
171
|
-
productName = RCTDataManager;
|
|
172
|
-
productReference = 134814201AA4EA6300B7C361 /* libKeyboardController.a */;
|
|
173
|
-
productType = "com.apple.product-type.library.static";
|
|
174
|
-
};
|
|
175
|
-
/* End PBXNativeTarget section */
|
|
176
|
-
|
|
177
|
-
/* Begin PBXProject section */
|
|
178
|
-
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
179
|
-
isa = PBXProject;
|
|
180
|
-
attributes = {
|
|
181
|
-
LastUpgradeCheck = 0920;
|
|
182
|
-
ORGANIZATIONNAME = Facebook;
|
|
183
|
-
TargetAttributes = {
|
|
184
|
-
58B511DA1A9E6C8500147676 = {
|
|
185
|
-
CreatedOnToolsVersion = 6.1.1;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "KeyboardController" */;
|
|
190
|
-
compatibilityVersion = "Xcode 3.2";
|
|
191
|
-
developmentRegion = English;
|
|
192
|
-
hasScannedForEncodings = 0;
|
|
193
|
-
knownRegions = (
|
|
194
|
-
English,
|
|
195
|
-
en,
|
|
196
|
-
);
|
|
197
|
-
mainGroup = 58B511D21A9E6C8500147676;
|
|
198
|
-
productRefGroup = 58B511D21A9E6C8500147676;
|
|
199
|
-
projectDirPath = "";
|
|
200
|
-
projectRoot = "";
|
|
201
|
-
targets = (
|
|
202
|
-
58B511DA1A9E6C8500147676 /* KeyboardController */,
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
/* End PBXProject section */
|
|
206
|
-
|
|
207
|
-
/* Begin PBXSourcesBuildPhase section */
|
|
208
|
-
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
209
|
-
isa = PBXSourcesBuildPhase;
|
|
210
|
-
buildActionMask = 2147483647;
|
|
211
|
-
files = (
|
|
212
|
-
084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */,
|
|
213
|
-
F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */,
|
|
214
|
-
0800511C2B65548600928E51 /* FocusedInputHolder.swift in Sources */,
|
|
215
|
-
0807071E2A34807B00C05A19 /* Extensions.swift in Sources */,
|
|
216
|
-
F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */,
|
|
217
|
-
084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */,
|
|
218
|
-
F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
|
|
219
|
-
F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */,
|
|
220
|
-
0800511E2B65558800928E51 /* TextInput.swift in Sources */,
|
|
221
|
-
08DF17B32BB1838D00279890 /* RCTUIManager+LayoutAnimationManager.m in Sources */,
|
|
222
|
-
08C47AFC2BA9AF7100DB93BB /* KeyboardView.swift in Sources */,
|
|
223
|
-
F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */,
|
|
224
|
-
083FB9852B15171600C0EFF0 /* TextChangeObserver.swift in Sources */,
|
|
225
|
-
089BA5DC2B3E0C9D000A9A90 /* ViewHierarchyNavigator.swift in Sources */,
|
|
226
|
-
083FB9872B15174C00C0EFF0 /* FocusedInputTextChangedEvent.m in Sources */,
|
|
227
|
-
);
|
|
228
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
229
|
-
};
|
|
230
|
-
/* End PBXSourcesBuildPhase section */
|
|
231
|
-
|
|
232
|
-
/* Begin XCBuildConfiguration section */
|
|
233
|
-
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
234
|
-
isa = XCBuildConfiguration;
|
|
235
|
-
buildSettings = {
|
|
236
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
237
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
238
|
-
CLANG_CXX_LIBRARY = "libc++";
|
|
239
|
-
CLANG_ENABLE_MODULES = YES;
|
|
240
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
|
241
|
-
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
242
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
243
|
-
CLANG_WARN_COMMA = YES;
|
|
244
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
245
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
246
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
|
247
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
248
|
-
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
249
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
|
250
|
-
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
251
|
-
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
252
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
253
|
-
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
254
|
-
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
255
|
-
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
256
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
257
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
258
|
-
COPY_PHASE_STRIP = NO;
|
|
259
|
-
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
260
|
-
ENABLE_TESTABILITY = YES;
|
|
261
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
262
|
-
GCC_DYNAMIC_NO_PIC = NO;
|
|
263
|
-
GCC_NO_COMMON_BLOCKS = YES;
|
|
264
|
-
GCC_OPTIMIZATION_LEVEL = 0;
|
|
265
|
-
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
266
|
-
"DEBUG=1",
|
|
267
|
-
"$(inherited)",
|
|
268
|
-
);
|
|
269
|
-
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
270
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
271
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
272
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
273
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
274
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
275
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
276
|
-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
|
277
|
-
MTL_ENABLE_DEBUG_INFO = YES;
|
|
278
|
-
ONLY_ACTIVE_ARCH = YES;
|
|
279
|
-
SDKROOT = iphoneos;
|
|
280
|
-
};
|
|
281
|
-
name = Debug;
|
|
282
|
-
};
|
|
283
|
-
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
284
|
-
isa = XCBuildConfiguration;
|
|
285
|
-
buildSettings = {
|
|
286
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
287
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
288
|
-
CLANG_CXX_LIBRARY = "libc++";
|
|
289
|
-
CLANG_ENABLE_MODULES = YES;
|
|
290
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
|
291
|
-
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
292
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
293
|
-
CLANG_WARN_COMMA = YES;
|
|
294
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
295
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
296
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
|
297
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
298
|
-
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
299
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
|
300
|
-
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
301
|
-
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
302
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
303
|
-
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
304
|
-
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
305
|
-
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
306
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
307
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
308
|
-
COPY_PHASE_STRIP = YES;
|
|
309
|
-
ENABLE_NS_ASSERTIONS = NO;
|
|
310
|
-
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
311
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
312
|
-
GCC_NO_COMMON_BLOCKS = YES;
|
|
313
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
314
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
315
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
316
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
317
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
318
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
319
|
-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
|
320
|
-
MTL_ENABLE_DEBUG_INFO = NO;
|
|
321
|
-
SDKROOT = iphoneos;
|
|
322
|
-
VALIDATE_PRODUCT = YES;
|
|
323
|
-
};
|
|
324
|
-
name = Release;
|
|
325
|
-
};
|
|
326
|
-
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
327
|
-
isa = XCBuildConfiguration;
|
|
328
|
-
buildSettings = {
|
|
329
|
-
HEADER_SEARCH_PATHS = (
|
|
330
|
-
"$(inherited)",
|
|
331
|
-
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
332
|
-
"$(SRCROOT)/../../../React/**",
|
|
333
|
-
"$(SRCROOT)/../../react-native/React/**",
|
|
334
|
-
);
|
|
335
|
-
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
336
|
-
OTHER_LDFLAGS = "-ObjC";
|
|
337
|
-
PRODUCT_NAME = KeyboardController;
|
|
338
|
-
SKIP_INSTALL = YES;
|
|
339
|
-
SWIFT_OBJC_BRIDGING_HEADER = "KeyboardController-Bridging-Header.h";
|
|
340
|
-
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
341
|
-
SWIFT_VERSION = 5.0;
|
|
342
|
-
};
|
|
343
|
-
name = Debug;
|
|
344
|
-
};
|
|
345
|
-
58B511F11A9E6C8500147676 /* Release */ = {
|
|
346
|
-
isa = XCBuildConfiguration;
|
|
347
|
-
buildSettings = {
|
|
348
|
-
HEADER_SEARCH_PATHS = (
|
|
349
|
-
"$(inherited)",
|
|
350
|
-
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
351
|
-
"$(SRCROOT)/../../../React/**",
|
|
352
|
-
"$(SRCROOT)/../../react-native/React/**",
|
|
353
|
-
);
|
|
354
|
-
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
355
|
-
OTHER_LDFLAGS = "-ObjC";
|
|
356
|
-
PRODUCT_NAME = KeyboardController;
|
|
357
|
-
SKIP_INSTALL = YES;
|
|
358
|
-
SWIFT_OBJC_BRIDGING_HEADER = "KeyboardController-Bridging-Header.h";
|
|
359
|
-
SWIFT_VERSION = 5.0;
|
|
360
|
-
};
|
|
361
|
-
name = Release;
|
|
362
|
-
};
|
|
363
|
-
/* End XCBuildConfiguration section */
|
|
364
|
-
|
|
365
|
-
/* Begin XCConfigurationList section */
|
|
366
|
-
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "KeyboardController" */ = {
|
|
367
|
-
isa = XCConfigurationList;
|
|
368
|
-
buildConfigurations = (
|
|
369
|
-
58B511ED1A9E6C8500147676 /* Debug */,
|
|
370
|
-
58B511EE1A9E6C8500147676 /* Release */,
|
|
371
|
-
);
|
|
372
|
-
defaultConfigurationIsVisible = 0;
|
|
373
|
-
defaultConfigurationName = Release;
|
|
374
|
-
};
|
|
375
|
-
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "KeyboardController" */ = {
|
|
376
|
-
isa = XCConfigurationList;
|
|
377
|
-
buildConfigurations = (
|
|
378
|
-
58B511F01A9E6C8500147676 /* Debug */,
|
|
379
|
-
58B511F11A9E6C8500147676 /* Release */,
|
|
380
|
-
);
|
|
381
|
-
defaultConfigurationIsVisible = 0;
|
|
382
|
-
defaultConfigurationName = Release;
|
|
383
|
-
};
|
|
384
|
-
/* End XCConfigurationList section */
|
|
385
|
-
};
|
|
386
|
-
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
387
|
-
}
|