@legendapp/list 3.0.0-beta.24 → 3.0.0-beta.25

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/index.js CHANGED
@@ -35,24 +35,14 @@ var Text = View;
35
35
 
36
36
  // src/state/getContentInsetEnd.ts
37
37
  function getContentInsetEnd(state) {
38
- var _a3, _b;
38
+ var _a3;
39
39
  const { props } = state;
40
40
  const horizontal = props.horizontal;
41
- let contentInset = props.contentInset;
42
- if (!contentInset) {
43
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
44
- if (animatedInset) {
45
- if ("get" in animatedInset) {
46
- contentInset = animatedInset.get();
47
- } else {
48
- contentInset = animatedInset;
49
- }
50
- }
51
- }
41
+ const contentInset = props.contentInset;
52
42
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
53
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
43
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
54
44
  if (overrideInset) {
55
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
45
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
56
46
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
57
47
  }
58
48
  if (baseInset) {
package/index.mjs CHANGED
@@ -14,24 +14,14 @@ var Text = View;
14
14
 
15
15
  // src/state/getContentInsetEnd.ts
16
16
  function getContentInsetEnd(state) {
17
- var _a3, _b;
17
+ var _a3;
18
18
  const { props } = state;
19
19
  const horizontal = props.horizontal;
20
- let contentInset = props.contentInset;
21
- if (!contentInset) {
22
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
23
- if (animatedInset) {
24
- if ("get" in animatedInset) {
25
- contentInset = animatedInset.get();
26
- } else {
27
- contentInset = animatedInset;
28
- }
29
- }
30
- }
20
+ const contentInset = props.contentInset;
31
21
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
32
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
22
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
33
23
  if (overrideInset) {
34
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
24
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
35
25
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
36
26
  }
37
27
  if (baseInset) {
package/index.native.js CHANGED
@@ -31,24 +31,14 @@ var Text = reactNative.Text;
31
31
 
32
32
  // src/state/getContentInsetEnd.ts
33
33
  function getContentInsetEnd(state) {
34
- var _a3, _b;
34
+ var _a3;
35
35
  const { props } = state;
36
36
  const horizontal = props.horizontal;
37
- let contentInset = props.contentInset;
38
- if (!contentInset) {
39
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
40
- if (animatedInset) {
41
- if ("get" in animatedInset) {
42
- contentInset = animatedInset.get();
43
- } else {
44
- contentInset = animatedInset;
45
- }
46
- }
47
- }
37
+ const contentInset = props.contentInset;
48
38
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
49
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
39
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
50
40
  if (overrideInset) {
51
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
41
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
52
42
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
53
43
  }
54
44
  if (baseInset) {
package/index.native.mjs CHANGED
@@ -10,24 +10,14 @@ var Text = Text$1;
10
10
 
11
11
  // src/state/getContentInsetEnd.ts
12
12
  function getContentInsetEnd(state) {
13
- var _a3, _b;
13
+ var _a3;
14
14
  const { props } = state;
15
15
  const horizontal = props.horizontal;
16
- let contentInset = props.contentInset;
17
- if (!contentInset) {
18
- const animatedInset = (_a3 = props.animatedProps) == null ? void 0 : _a3.contentInset;
19
- if (animatedInset) {
20
- if ("get" in animatedInset) {
21
- contentInset = animatedInset.get();
22
- } else {
23
- contentInset = animatedInset;
24
- }
25
- }
26
- }
16
+ const contentInset = props.contentInset;
27
17
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
28
- const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
18
+ const overrideInset = (_a3 = state.contentInsetOverride) != null ? _a3 : void 0;
29
19
  if (overrideInset) {
30
- const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
20
+ const mergedInset = { bottom: 0, left: 0, right: 0, top: 0, ...baseInset, ...overrideInset };
31
21
  return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
32
22
  }
33
23
  if (baseInset) {
package/keyboard.js CHANGED
@@ -121,6 +121,13 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
121
121
  },
122
122
  [refLegendList]
123
123
  );
124
+ const reportContentInset = React.useCallback(
125
+ (bottom) => {
126
+ var _a;
127
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
128
+ },
129
+ [refLegendList]
130
+ );
124
131
  const updateScrollMetrics = React.useCallback(() => {
125
132
  var _a;
126
133
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -230,6 +237,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
230
237
  if (!horizontal) {
231
238
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
232
239
  keyboardInset.set(newInset);
240
+ reactNativeReanimated.runOnJS(reportContentInset)(newInset);
233
241
  if (newInset <= 0) {
234
242
  animatedOffsetY.set(scrollOffsetY.get());
235
243
  }
@@ -249,15 +257,20 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
249
257
  y: vAnimatedOffsetY
250
258
  }
251
259
  };
252
- const keyboardInsetBottom = keyboardInset.get();
253
- return isIos ? Object.assign(baseProps, {
254
- contentInset: {
260
+ if (isIos) {
261
+ const keyboardInsetBottom = keyboardInset.get();
262
+ const contentInset = {
255
263
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
256
264
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
257
265
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
258
266
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
259
- }
260
- }) : baseProps;
267
+ };
268
+ return Object.assign(baseProps, {
269
+ contentInset
270
+ });
271
+ } else {
272
+ return baseProps;
273
+ }
261
274
  });
262
275
  const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
263
276
  () => ({
package/keyboard.mjs CHANGED
@@ -100,6 +100,13 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
100
100
  },
101
101
  [refLegendList]
102
102
  );
103
+ const reportContentInset = useCallback(
104
+ (bottom) => {
105
+ var _a;
106
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
107
+ },
108
+ [refLegendList]
109
+ );
103
110
  const updateScrollMetrics = useCallback(() => {
104
111
  var _a;
105
112
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -209,6 +216,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
209
216
  if (!horizontal) {
210
217
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
211
218
  keyboardInset.set(newInset);
219
+ runOnJS(reportContentInset)(newInset);
212
220
  if (newInset <= 0) {
213
221
  animatedOffsetY.set(scrollOffsetY.get());
214
222
  }
@@ -228,15 +236,20 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
228
236
  y: vAnimatedOffsetY
229
237
  }
230
238
  };
231
- const keyboardInsetBottom = keyboardInset.get();
232
- return isIos ? Object.assign(baseProps, {
233
- contentInset: {
239
+ if (isIos) {
240
+ const keyboardInsetBottom = keyboardInset.get();
241
+ const contentInset = {
234
242
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
235
243
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
236
244
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
237
245
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
238
- }
239
- }) : baseProps;
246
+ };
247
+ return Object.assign(baseProps, {
248
+ contentInset
249
+ });
250
+ } else {
251
+ return baseProps;
252
+ }
240
253
  });
241
254
  const style = isAndroid ? useAnimatedStyle(
242
255
  () => ({
@@ -121,6 +121,13 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
121
121
  },
122
122
  [refLegendList]
123
123
  );
124
+ const reportContentInset = React.useCallback(
125
+ (bottom) => {
126
+ var _a;
127
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
128
+ },
129
+ [refLegendList]
130
+ );
124
131
  const updateScrollMetrics = React.useCallback(() => {
125
132
  var _a;
126
133
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -230,6 +237,7 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
230
237
  if (!horizontal) {
231
238
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
232
239
  keyboardInset.set(newInset);
240
+ reactNativeReanimated.runOnJS(reportContentInset)(newInset);
233
241
  if (newInset <= 0) {
234
242
  animatedOffsetY.set(scrollOffsetY.get());
235
243
  }
@@ -249,15 +257,20 @@ var KeyboardAvoidingLegendList = React.forwardRef(function KeyboardAvoidingLegen
249
257
  y: vAnimatedOffsetY
250
258
  }
251
259
  };
252
- const keyboardInsetBottom = keyboardInset.get();
253
- return isIos ? Object.assign(baseProps, {
254
- contentInset: {
260
+ if (isIos) {
261
+ const keyboardInsetBottom = keyboardInset.get();
262
+ const contentInset = {
255
263
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
256
264
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
257
265
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
258
266
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
259
- }
260
- }) : baseProps;
267
+ };
268
+ return Object.assign(baseProps, {
269
+ contentInset
270
+ });
271
+ } else {
272
+ return baseProps;
273
+ }
261
274
  });
262
275
  const style = isAndroid ? reactNativeReanimated.useAnimatedStyle(
263
276
  () => ({
@@ -100,6 +100,13 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
100
100
  },
101
101
  [refLegendList]
102
102
  );
103
+ const reportContentInset = useCallback(
104
+ (bottom) => {
105
+ var _a;
106
+ return (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset({ bottom });
107
+ },
108
+ [refLegendList]
109
+ );
103
110
  const updateScrollMetrics = useCallback(() => {
104
111
  var _a;
105
112
  const state = (_a = refLegendList.current) == null ? void 0 : _a.getState();
@@ -209,6 +216,7 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
209
216
  if (!horizontal) {
210
217
  const newInset = calculateKeyboardInset(event.height, safeAreaInsetBottom);
211
218
  keyboardInset.set(newInset);
219
+ runOnJS(reportContentInset)(newInset);
212
220
  if (newInset <= 0) {
213
221
  animatedOffsetY.set(scrollOffsetY.get());
214
222
  }
@@ -228,15 +236,20 @@ var KeyboardAvoidingLegendList = forwardRef(function KeyboardAvoidingLegendList2
228
236
  y: vAnimatedOffsetY
229
237
  }
230
238
  };
231
- const keyboardInsetBottom = keyboardInset.get();
232
- return isIos ? Object.assign(baseProps, {
233
- contentInset: {
239
+ if (isIos) {
240
+ const keyboardInsetBottom = keyboardInset.get();
241
+ const contentInset = {
234
242
  bottom: ((_a = contentInsetProp == null ? void 0 : contentInsetProp.bottom) != null ? _a : 0) + (horizontal ? 0 : keyboardInsetBottom),
235
243
  left: (_b = contentInsetProp == null ? void 0 : contentInsetProp.left) != null ? _b : 0,
236
244
  right: (_c = contentInsetProp == null ? void 0 : contentInsetProp.right) != null ? _c : 0,
237
245
  top: (_d = contentInsetProp == null ? void 0 : contentInsetProp.top) != null ? _d : 0
238
- }
239
- }) : baseProps;
246
+ };
247
+ return Object.assign(baseProps, {
248
+ contentInset
249
+ });
250
+ } else {
251
+ return baseProps;
252
+ }
240
253
  });
241
254
  const style = isAndroid ? useAnimatedStyle(
242
255
  () => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.0.0-beta.24",
3
+ "version": "3.0.0-beta.25",
4
4
  "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,