@legendapp/list 3.0.0-beta.2 → 3.0.0-beta.21
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/CHANGELOG.md +19 -0
- package/README.md +1 -0
- package/animated.native.d.mts +9 -0
- package/animated.native.d.ts +9 -0
- package/animated.native.js +9 -0
- package/animated.native.mjs +7 -0
- package/index.d.mts +781 -10
- package/index.d.ts +781 -10
- package/index.js +973 -530
- package/index.mjs +973 -532
- package/index.native.d.mts +781 -10
- package/index.native.d.ts +781 -10
- package/index.native.js +981 -494
- package/index.native.mjs +980 -495
- package/keyboard-controller.native.d.mts +12 -0
- package/keyboard-controller.native.d.ts +12 -0
- package/keyboard-controller.native.js +69 -0
- package/keyboard-controller.native.mjs +48 -0
- package/keyboard.d.mts +5 -2
- package/keyboard.d.ts +5 -2
- package/keyboard.js +232 -28
- package/keyboard.mjs +235 -31
- package/keyboard.native.d.mts +16 -0
- package/keyboard.native.d.ts +16 -0
- package/keyboard.native.js +318 -0
- package/keyboard.native.mjs +296 -0
- package/package.json +1 -1
- package/reanimated.d.mts +3 -3
- package/reanimated.d.ts +3 -3
- package/reanimated.js +15 -4
- package/reanimated.mjs +14 -3
- package/reanimated.native.d.mts +18 -0
- package/reanimated.native.d.ts +18 -0
- package/reanimated.native.js +89 -0
- package/reanimated.native.mjs +65 -0
- package/section-list.d.mts +1 -2
- package/section-list.d.ts +1 -2
- package/section-list.js +36 -3670
- package/section-list.mjs +34 -3669
- package/section-list.native.d.mts +1 -2
- package/section-list.native.d.ts +1 -2
- package/section-list.native.js +36 -3449
- package/section-list.native.mjs +33 -3447
- package/types-JPHClxiw.d.mts +0 -670
- package/types-JPHClxiw.d.ts +0 -670
- package/types-YNdphn_A.d.mts +0 -670
- package/types-YNdphn_A.d.ts +0 -670
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LegendList as LegendList$1, LegendListProps, LegendListRef } from '@legendapp/list';
|
|
3
|
+
import { AnimatedLegendList } from '@legendapp/list/animated';
|
|
4
|
+
import { AnimatedLegendList as AnimatedLegendList$1 } from '@legendapp/list/reanimated';
|
|
5
|
+
|
|
6
|
+
declare const LegendList: <ItemT, ListT extends typeof LegendList$1 | typeof AnimatedLegendList | typeof AnimatedLegendList$1 = (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}>(props: (LegendListProps<ItemT> & {
|
|
9
|
+
LegendList?: ListT;
|
|
10
|
+
}) & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
11
|
+
|
|
12
|
+
export { LegendList };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LegendList as LegendList$1, LegendListProps, LegendListRef } from '@legendapp/list';
|
|
3
|
+
import { AnimatedLegendList } from '@legendapp/list/animated';
|
|
4
|
+
import { AnimatedLegendList as AnimatedLegendList$1 } from '@legendapp/list/reanimated';
|
|
5
|
+
|
|
6
|
+
declare const LegendList: <ItemT, ListT extends typeof LegendList$1 | typeof AnimatedLegendList | typeof AnimatedLegendList$1 = (<T>(props: LegendListProps<T> & React.RefAttributes<LegendListRef>) => React.ReactNode) & {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}>(props: (LegendListProps<ItemT> & {
|
|
9
|
+
LegendList?: ListT;
|
|
10
|
+
}) & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
11
|
+
|
|
12
|
+
export { LegendList };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
|
+
var reactNativeKeyboardController = require('react-native-keyboard-controller');
|
|
6
|
+
var reactNativeReanimated = require('react-native-reanimated');
|
|
7
|
+
var list = require('@legendapp/list');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
|
+
|
|
29
|
+
// src/integrations/keyboard-controller.tsx
|
|
30
|
+
var typedForwardRef = React.forwardRef;
|
|
31
|
+
var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
|
|
32
|
+
const {
|
|
33
|
+
LegendList: LegendListProp,
|
|
34
|
+
contentContainerStyle: contentContainerStyleProp,
|
|
35
|
+
scrollIndicatorInsets: scrollIndicatorInsetsProp,
|
|
36
|
+
...rest
|
|
37
|
+
} = props;
|
|
38
|
+
const [padding, setPadding] = React.useState(0);
|
|
39
|
+
const updatePadding = (height) => {
|
|
40
|
+
setPadding(height);
|
|
41
|
+
};
|
|
42
|
+
reactNativeKeyboardController.useKeyboardHandler({
|
|
43
|
+
onEnd: (e) => {
|
|
44
|
+
"worklet";
|
|
45
|
+
reactNativeReanimated.runOnJS(updatePadding)(e.height);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const LegendListComponent = LegendListProp != null ? LegendListProp : list.LegendList;
|
|
49
|
+
const contentContainerStyleFlattened = reactNative.StyleSheet.flatten(contentContainerStyleProp) || {};
|
|
50
|
+
const contentContainerStyle = { ...contentContainerStyleFlattened, paddingTop: padding };
|
|
51
|
+
const scrollIndicatorInsets = scrollIndicatorInsetsProp ? { ...scrollIndicatorInsetsProp } : {};
|
|
52
|
+
if (!props.horizontal) {
|
|
53
|
+
scrollIndicatorInsets.top = ((scrollIndicatorInsets == null ? void 0 : scrollIndicatorInsets.top) || 0) + padding;
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
// @ts-expect-error TODO: Fix this type
|
|
57
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
58
|
+
LegendListComponent,
|
|
59
|
+
{
|
|
60
|
+
...rest,
|
|
61
|
+
contentContainerStyle,
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
scrollIndicatorInsets
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
exports.LegendList = LegendList;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState, forwardRef } from 'react';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { useKeyboardHandler } from 'react-native-keyboard-controller';
|
|
5
|
+
import { runOnJS } from 'react-native-reanimated';
|
|
6
|
+
import { LegendList as LegendList$1 } from '@legendapp/list';
|
|
7
|
+
|
|
8
|
+
// src/integrations/keyboard-controller.tsx
|
|
9
|
+
var typedForwardRef = forwardRef;
|
|
10
|
+
var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
|
|
11
|
+
const {
|
|
12
|
+
LegendList: LegendListProp,
|
|
13
|
+
contentContainerStyle: contentContainerStyleProp,
|
|
14
|
+
scrollIndicatorInsets: scrollIndicatorInsetsProp,
|
|
15
|
+
...rest
|
|
16
|
+
} = props;
|
|
17
|
+
const [padding, setPadding] = useState(0);
|
|
18
|
+
const updatePadding = (height) => {
|
|
19
|
+
setPadding(height);
|
|
20
|
+
};
|
|
21
|
+
useKeyboardHandler({
|
|
22
|
+
onEnd: (e) => {
|
|
23
|
+
"worklet";
|
|
24
|
+
runOnJS(updatePadding)(e.height);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const LegendListComponent = LegendListProp != null ? LegendListProp : LegendList$1;
|
|
28
|
+
const contentContainerStyleFlattened = StyleSheet.flatten(contentContainerStyleProp) || {};
|
|
29
|
+
const contentContainerStyle = { ...contentContainerStyleFlattened, paddingTop: padding };
|
|
30
|
+
const scrollIndicatorInsets = scrollIndicatorInsetsProp ? { ...scrollIndicatorInsetsProp } : {};
|
|
31
|
+
if (!props.horizontal) {
|
|
32
|
+
scrollIndicatorInsets.top = ((scrollIndicatorInsets == null ? void 0 : scrollIndicatorInsets.top) || 0) + padding;
|
|
33
|
+
}
|
|
34
|
+
return (
|
|
35
|
+
// @ts-expect-error TODO: Fix this type
|
|
36
|
+
/* @__PURE__ */ React.createElement(
|
|
37
|
+
LegendListComponent,
|
|
38
|
+
{
|
|
39
|
+
...rest,
|
|
40
|
+
contentContainerStyle,
|
|
41
|
+
ref: forwardedRef,
|
|
42
|
+
scrollIndicatorInsets
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { LegendList };
|
package/keyboard.d.mts
CHANGED
|
@@ -6,8 +6,11 @@ import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
|
|
|
6
6
|
|
|
7
7
|
declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
|
|
8
8
|
onScroll?: (event: ReanimatedScrollEvent) => void;
|
|
9
|
-
contentInset?: Insets;
|
|
10
|
-
|
|
9
|
+
contentInset?: Insets | undefined;
|
|
10
|
+
safeAreaInsets?: {
|
|
11
|
+
top: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
};
|
|
11
14
|
} & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
12
15
|
|
|
13
16
|
export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
|
package/keyboard.d.ts
CHANGED
|
@@ -6,8 +6,11 @@ import { AnimatedLegendListProps } from '@legendapp/list/reanimated';
|
|
|
6
6
|
|
|
7
7
|
declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "onScroll" | "contentInset"> & {
|
|
8
8
|
onScroll?: (event: ReanimatedScrollEvent) => void;
|
|
9
|
-
contentInset?: Insets;
|
|
10
|
-
|
|
9
|
+
contentInset?: Insets | undefined;
|
|
10
|
+
safeAreaInsets?: {
|
|
11
|
+
top: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
};
|
|
11
14
|
} & React.RefAttributes<LegendListRef>) => React.ReactNode;
|
|
12
15
|
|
|
13
16
|
export { KeyboardAvoidingLegendList, KeyboardAvoidingLegendList as LegendList };
|
package/keyboard.js
CHANGED
|
@@ -27,82 +27,286 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
28
|
|
|
29
29
|
// src/integrations/keyboard.tsx
|
|
30
|
+
|
|
31
|
+
// src/constants-platform.ts
|
|
32
|
+
var IsNewArchitecture = true;
|
|
33
|
+
|
|
34
|
+
// src/utils/helpers.ts
|
|
35
|
+
function isFunction(obj) {
|
|
36
|
+
return typeof obj === "function";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/hooks/useCombinedRef.ts
|
|
40
|
+
var useCombinedRef = (...refs) => {
|
|
41
|
+
const callback = React.useCallback((element) => {
|
|
42
|
+
for (const ref of refs) {
|
|
43
|
+
if (!ref) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (isFunction(ref)) {
|
|
47
|
+
ref(element);
|
|
48
|
+
} else {
|
|
49
|
+
ref.current = element;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, refs);
|
|
53
|
+
return callback;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/integrations/keyboard.tsx
|
|
57
|
+
var clampProgress = (progress) => {
|
|
58
|
+
"worklet";
|
|
59
|
+
return Math.min(1, Math.max(0, progress));
|
|
60
|
+
};
|
|
61
|
+
var calculateKeyboardInset = (height, safeAreaInsetBottom, isNewArchitecture) => {
|
|
62
|
+
"worklet";
|
|
63
|
+
return Math.max(0, height - safeAreaInsetBottom) ;
|
|
64
|
+
};
|
|
65
|
+
var calculateEndPaddingInset = (keyboardHeight, alignItemsAtEndPadding) => {
|
|
66
|
+
"worklet";
|
|
67
|
+
return Math.min(keyboardHeight, alignItemsAtEndPadding);
|
|
68
|
+
};
|
|
69
|
+
var calculateTopInset = (safeAreaInsetTop, isNewArchitecture, extraTopInset) => {
|
|
70
|
+
"worklet";
|
|
71
|
+
return (isNewArchitecture ? 0 : safeAreaInsetTop * 2) + extraTopInset;
|
|
72
|
+
};
|
|
73
|
+
var calculateKeyboardTargetOffset = (startOffset, keyboardHeight, isOpening, progress) => {
|
|
74
|
+
"worklet";
|
|
75
|
+
const normalizedProgress = isOpening ? progress : 1 - progress;
|
|
76
|
+
const delta = (isOpening ? keyboardHeight : -keyboardHeight) * normalizedProgress;
|
|
77
|
+
return Math.max(0, startOffset + delta);
|
|
78
|
+
};
|
|
30
79
|
var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
|
|
31
80
|
const {
|
|
32
81
|
contentInset: contentInsetProp,
|
|
33
82
|
horizontal,
|
|
83
|
+
onMetricsChange: onMetricsChangeProp,
|
|
34
84
|
onScroll: onScrollProp,
|
|
35
|
-
|
|
36
|
-
|
|
85
|
+
safeAreaInsets = { bottom: 0, top: 0 },
|
|
86
|
+
style: styleProp,
|
|
37
87
|
...rest
|
|
38
88
|
} = props;
|
|
39
|
-
const
|
|
89
|
+
const styleFlattened = reactNative.StyleSheet.flatten(styleProp);
|
|
90
|
+
const refLegendList = React.useRef(null);
|
|
91
|
+
const combinedRef = useCombinedRef(forwardedRef, refLegendList);
|
|
92
|
+
const isIos = reactNative.Platform.OS === "ios";
|
|
93
|
+
const isAndroid = reactNative.Platform.OS === "android";
|
|
40
94
|
const scrollViewRef = reactNativeReanimated.useAnimatedRef();
|
|
41
95
|
const scrollOffsetY = reactNativeReanimated.useSharedValue(0);
|
|
96
|
+
const animatedOffsetY = reactNativeReanimated.useSharedValue(null);
|
|
42
97
|
const scrollOffsetAtKeyboardStart = reactNativeReanimated.useSharedValue(0);
|
|
43
|
-
const
|
|
98
|
+
const mode = reactNativeReanimated.useSharedValue("idle");
|
|
99
|
+
const keyboardInset = reactNativeReanimated.useSharedValue({ bottom: 0, top: 0 });
|
|
100
|
+
const keyboardHeight = reactNativeReanimated.useSharedValue(0);
|
|
101
|
+
const alignItemsAtEndPadding = reactNativeReanimated.useSharedValue(0);
|
|
102
|
+
const isOpening = reactNativeReanimated.useSharedValue(false);
|
|
103
|
+
const didInteractive = reactNativeReanimated.useSharedValue(false);
|
|
104
|
+
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = safeAreaInsets;
|
|
105
|
+
const isKeyboardOpen = reactNativeReanimated.useSharedValue(false);
|
|
44
106
|
const scrollHandler = reactNativeReanimated.useAnimatedScrollHandler(
|
|
45
107
|
(event) => {
|
|
46
|
-
scrollOffsetY.
|
|
108
|
+
scrollOffsetY.set(event.contentOffset[horizontal ? "x" : "y"]);
|
|
47
109
|
if (onScrollProp) {
|
|
48
110
|
reactNativeReanimated.runOnJS(onScrollProp)(event);
|
|
49
111
|
}
|
|
50
112
|
},
|
|
51
113
|
[onScrollProp, horizontal]
|
|
52
114
|
);
|
|
115
|
+
const setScrollProcessingEnabled = React.useCallback(
|
|
116
|
+
(enabled) => {
|
|
117
|
+
var _a;
|
|
118
|
+
return (_a = refLegendList.current) == null ? void 0 : _a.setScrollProcessingEnabled(enabled);
|
|
119
|
+
},
|
|
120
|
+
[refLegendList]
|
|
121
|
+
);
|
|
122
|
+
const handleMetricsChange = React.useCallback(
|
|
123
|
+
(metrics) => {
|
|
124
|
+
const nextPadding = metrics.alignItemsAtEndPadding || 0;
|
|
125
|
+
alignItemsAtEndPadding.set(nextPadding);
|
|
126
|
+
if (!horizontal) {
|
|
127
|
+
reactNativeReanimated.runOnUI((padding, safeInsetTop, isNewArchitecture) => {
|
|
128
|
+
"worklet";
|
|
129
|
+
if (!isKeyboardOpen.get()) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
133
|
+
const vTopInset = calculateEndPaddingInset(vKeyboardHeight, padding);
|
|
134
|
+
const topInset = calculateTopInset(safeInsetTop, isNewArchitecture, vTopInset);
|
|
135
|
+
keyboardInset.set({
|
|
136
|
+
bottom: keyboardInset.get().bottom,
|
|
137
|
+
top: topInset
|
|
138
|
+
});
|
|
139
|
+
})(nextPadding, safeAreaInsetTop, IsNewArchitecture);
|
|
140
|
+
}
|
|
141
|
+
onMetricsChangeProp == null ? void 0 : onMetricsChangeProp(metrics);
|
|
142
|
+
},
|
|
143
|
+
[
|
|
144
|
+
alignItemsAtEndPadding,
|
|
145
|
+
horizontal,
|
|
146
|
+
isKeyboardOpen,
|
|
147
|
+
keyboardHeight,
|
|
148
|
+
keyboardInset,
|
|
149
|
+
onMetricsChangeProp,
|
|
150
|
+
safeAreaInsetTop
|
|
151
|
+
]
|
|
152
|
+
);
|
|
53
153
|
reactNativeKeyboardController.useKeyboardHandler(
|
|
54
154
|
// biome-ignore assist/source/useSortedKeys: prefer start/move/end
|
|
55
155
|
{
|
|
56
|
-
onStart: () => {
|
|
156
|
+
onStart: (event) => {
|
|
157
|
+
"worklet";
|
|
158
|
+
mode.set("running");
|
|
159
|
+
const progress = clampProgress(event.progress);
|
|
160
|
+
if (isKeyboardOpen.get() && progress >= 1 && event.height > 0) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (!didInteractive.get()) {
|
|
164
|
+
if (event.height > 0) {
|
|
165
|
+
keyboardHeight.set(event.height - safeAreaInsetBottom);
|
|
166
|
+
}
|
|
167
|
+
isOpening.set(progress > 0);
|
|
168
|
+
scrollOffsetAtKeyboardStart.set(scrollOffsetY.get());
|
|
169
|
+
animatedOffsetY.set(scrollOffsetY.get());
|
|
170
|
+
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
onInteractive: (event) => {
|
|
57
174
|
"worklet";
|
|
58
|
-
|
|
175
|
+
if (mode.get() !== "running") {
|
|
176
|
+
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(false);
|
|
177
|
+
}
|
|
178
|
+
mode.set("running");
|
|
179
|
+
if (!didInteractive.get()) {
|
|
180
|
+
if (!isAndroid && !IsNewArchitecture) {
|
|
181
|
+
keyboardInset.set({
|
|
182
|
+
bottom: keyboardInset.get().bottom,
|
|
183
|
+
// Legacy iOS uses a doubled top inset to keep content below the status bar.
|
|
184
|
+
top: calculateTopInset(safeAreaInsetTop, IsNewArchitecture, 0)
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
didInteractive.set(true);
|
|
188
|
+
}
|
|
189
|
+
if (isAndroid && !horizontal) {
|
|
190
|
+
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
191
|
+
keyboardInset.set({ bottom: newInset, top: safeAreaInsetTop * 2 });
|
|
192
|
+
}
|
|
59
193
|
},
|
|
60
194
|
onMove: (event) => {
|
|
61
195
|
"worklet";
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
196
|
+
if (!didInteractive.get()) {
|
|
197
|
+
const progress = clampProgress(event.progress);
|
|
198
|
+
const vIsOpening = isOpening.get();
|
|
199
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
200
|
+
const vAlignItemsPadding = alignItemsAtEndPadding.get();
|
|
201
|
+
const vTopInset = calculateEndPaddingInset(vKeyboardHeight, vAlignItemsPadding);
|
|
202
|
+
const targetOffset = calculateKeyboardTargetOffset(
|
|
203
|
+
scrollOffsetAtKeyboardStart.get(),
|
|
204
|
+
vKeyboardHeight,
|
|
205
|
+
vIsOpening,
|
|
206
|
+
progress
|
|
207
|
+
);
|
|
208
|
+
scrollOffsetY.set(targetOffset);
|
|
209
|
+
animatedOffsetY.set(targetOffset);
|
|
210
|
+
if (!horizontal) {
|
|
211
|
+
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
212
|
+
const topInset = calculateTopInset(
|
|
213
|
+
safeAreaInsetTop,
|
|
214
|
+
IsNewArchitecture,
|
|
215
|
+
vIsOpening ? vTopInset : 0
|
|
216
|
+
);
|
|
217
|
+
keyboardInset.set({
|
|
218
|
+
bottom: newInset,
|
|
219
|
+
// Add top padding only while opening to keep end-aligned items visible.
|
|
220
|
+
top: topInset
|
|
221
|
+
});
|
|
222
|
+
}
|
|
67
223
|
}
|
|
68
224
|
},
|
|
69
225
|
onEnd: (event) => {
|
|
70
226
|
"worklet";
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
227
|
+
const wasInteractive = didInteractive.get();
|
|
228
|
+
const vMode = mode.get();
|
|
229
|
+
mode.set("idle");
|
|
230
|
+
if (vMode === "running") {
|
|
231
|
+
const progress = clampProgress(event.progress);
|
|
232
|
+
const vKeyboardHeight = keyboardHeight.get();
|
|
233
|
+
const vAlignItemsPadding = alignItemsAtEndPadding.get();
|
|
234
|
+
const vTopInset = calculateEndPaddingInset(vKeyboardHeight, vAlignItemsPadding);
|
|
235
|
+
const vIsOpening = isOpening.get();
|
|
236
|
+
if (!wasInteractive) {
|
|
237
|
+
const targetOffset = calculateKeyboardTargetOffset(
|
|
238
|
+
scrollOffsetAtKeyboardStart.get(),
|
|
239
|
+
vKeyboardHeight,
|
|
240
|
+
vIsOpening,
|
|
241
|
+
progress
|
|
242
|
+
);
|
|
243
|
+
scrollOffsetY.set(targetOffset);
|
|
244
|
+
animatedOffsetY.set(targetOffset);
|
|
245
|
+
}
|
|
246
|
+
reactNativeReanimated.runOnJS(setScrollProcessingEnabled)(true);
|
|
247
|
+
didInteractive.set(false);
|
|
248
|
+
isKeyboardOpen.set(event.height > 0);
|
|
249
|
+
if (!horizontal) {
|
|
250
|
+
const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
|
|
251
|
+
const topInset = calculateTopInset(
|
|
252
|
+
safeAreaInsetTop,
|
|
253
|
+
IsNewArchitecture,
|
|
254
|
+
event.height > 0 ? vTopInset : 0
|
|
255
|
+
);
|
|
256
|
+
keyboardInset.set({
|
|
257
|
+
bottom: newInset,
|
|
258
|
+
// Preserve end-aligned padding only while the keyboard is visible.
|
|
259
|
+
top: topInset
|
|
260
|
+
});
|
|
261
|
+
if (newInset <= 0) {
|
|
262
|
+
animatedOffsetY.set(scrollOffsetY.get());
|
|
263
|
+
}
|
|
264
|
+
}
|
|
76
265
|
}
|
|
77
266
|
}
|
|
78
267
|
},
|
|
79
268
|
[scrollViewRef, safeAreaInsetBottom]
|
|
80
269
|
);
|
|
81
|
-
const animatedProps =
|
|
270
|
+
const animatedProps = reactNativeReanimated.useAnimatedProps(() => {
|
|
82
271
|
"worklet";
|
|
83
272
|
var _a, _b, _c, _d;
|
|
84
|
-
|
|
273
|
+
const vAnimatedOffsetY = animatedOffsetY.get();
|
|
274
|
+
const baseProps = {
|
|
275
|
+
contentOffset: vAnimatedOffsetY === null ? void 0 : {
|
|
276
|
+
x: 0,
|
|
277
|
+
y: vAnimatedOffsetY
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const { top: keyboardInsetTop, bottom: keyboardInsetBottom } = keyboardInset.get();
|
|
281
|
+
return isIos ? Object.assign(baseProps, {
|
|
85
282
|
contentInset: {
|
|
86
|
-
bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 :
|
|
283
|
+
bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
|
|
87
284
|
left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
|
|
88
285
|
right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
|
|
89
|
-
top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
|
|
286
|
+
top: ((_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0) - keyboardInsetTop
|
|
90
287
|
}
|
|
91
|
-
};
|
|
92
|
-
})
|
|
93
|
-
const style =
|
|
94
|
-
|
|
95
|
-
|
|
288
|
+
}) : baseProps;
|
|
289
|
+
});
|
|
290
|
+
const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
|
|
291
|
+
() => {
|
|
292
|
+
var _a;
|
|
293
|
+
return {
|
|
294
|
+
...styleFlattened || {},
|
|
295
|
+
marginBottom: (_a = keyboardInset.get().bottom) != null ? _a : 0
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
[styleProp, keyboardInset]
|
|
299
|
+
) : void 0;
|
|
96
300
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
97
301
|
reanimated.AnimatedLegendList,
|
|
98
302
|
{
|
|
99
303
|
...rest,
|
|
100
304
|
animatedProps,
|
|
101
305
|
keyboardDismissMode: "interactive",
|
|
306
|
+
onMetricsChange: handleMetricsChange,
|
|
102
307
|
onScroll: scrollHandler,
|
|
103
|
-
ref:
|
|
308
|
+
ref: combinedRef,
|
|
104
309
|
refScrollView: scrollViewRef,
|
|
105
|
-
scrollEventThrottle: resolvedScrollEventThrottle,
|
|
106
310
|
scrollIndicatorInsets: { bottom: 0, top: 0 },
|
|
107
311
|
style
|
|
108
312
|
}
|