@legendapp/list 1.0.0-beta.3 → 1.0.0-beta.30

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "1.0.0-beta.3",
4
- "description": "legend-list",
3
+ "version": "1.0.0-beta.30",
4
+ "description": "Legend List aims to be a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,
7
7
  "main": "./index.js",
@@ -20,10 +20,7 @@
20
20
  "react-native",
21
21
  "list"
22
22
  ],
23
- "repository": {
24
- "type": "git",
25
- "url": "git+https://github.com/LegendApp/legend-list.git"
26
- },
23
+ "repository": "github:LegendApp/legend-list",
27
24
  "license": "MIT",
28
25
  "bugs": {
29
26
  "url": "https://github.com/LegendApp/legend-list/issues"
package/reanimated.d.mts CHANGED
@@ -1,13 +1,16 @@
1
1
  import { LegendListRef, LegendListPropsBase } from '@legendapp/list';
2
- import react__default, { ComponentProps } from 'react';
2
+ import React__default, { ComponentProps } from 'react';
3
3
  import Animated from 'react-native-reanimated';
4
4
 
5
- type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged";
5
+ type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "ItemSeparatorComponent";
6
6
  type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
7
7
  interface AnimatedLegendListProps<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
8
- refScrollView?: react__default.Ref<Animated.ScrollView>;
8
+ refScrollView?: React__default.Ref<Animated.ScrollView>;
9
9
  }
10
10
  type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
11
- declare const AnimatedLegendList: react__default.ForwardRefExoticComponent<Omit<Omit<AnimatedLegendListProps<unknown>, "refLegendList"> & OtherAnimatedLegendListProps<unknown>, "ref"> & react__default.RefAttributes<LegendListRef>>;
11
+ type AnimatedLegendListDefinition = <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "refLegendList"> & OtherAnimatedLegendListProps<ItemT> & {
12
+ ref?: React__default.Ref<LegendListRef>;
13
+ }) => React__default.ReactElement | null;
14
+ declare const AnimatedLegendList: AnimatedLegendListDefinition;
12
15
 
13
16
  export { AnimatedLegendList };
package/reanimated.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  import { LegendListRef, LegendListPropsBase } from '@legendapp/list';
2
- import react__default, { ComponentProps } from 'react';
2
+ import React__default, { ComponentProps } from 'react';
3
3
  import Animated from 'react-native-reanimated';
4
4
 
5
- type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged";
5
+ type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "ItemSeparatorComponent";
6
6
  type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
7
7
  interface AnimatedLegendListProps<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
8
- refScrollView?: react__default.Ref<Animated.ScrollView>;
8
+ refScrollView?: React__default.Ref<Animated.ScrollView>;
9
9
  }
10
10
  type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
11
- declare const AnimatedLegendList: react__default.ForwardRefExoticComponent<Omit<Omit<AnimatedLegendListProps<unknown>, "refLegendList"> & OtherAnimatedLegendListProps<unknown>, "ref"> & react__default.RefAttributes<LegendListRef>>;
11
+ type AnimatedLegendListDefinition = <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "refLegendList"> & OtherAnimatedLegendListProps<ItemT> & {
12
+ ref?: React__default.Ref<LegendListRef>;
13
+ }) => React__default.ReactElement | null;
14
+ declare const AnimatedLegendList: AnimatedLegendListDefinition;
12
15
 
13
16
  export { AnimatedLegendList };
package/reanimated.js CHANGED
@@ -9,6 +9,23 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
  var React__default = /*#__PURE__*/_interopDefault(React);
10
10
  var Animated__default = /*#__PURE__*/_interopDefault(Animated);
11
11
 
12
+ // src/reanimated.tsx
13
+ var useCombinedRef = (...refs) => {
14
+ const callback = React.useCallback((element) => {
15
+ for (const ref of refs) {
16
+ if (!ref) {
17
+ continue;
18
+ }
19
+ if (typeof ref === "function") {
20
+ ref(element);
21
+ } else {
22
+ ref.current = element;
23
+ }
24
+ }
25
+ }, refs);
26
+ return callback;
27
+ };
28
+
12
29
  // src/reanimated.tsx
13
30
  var LegendListForwardedRef = React__default.default.forwardRef(function LegendListForwardedRef2(props, ref) {
14
31
  const { refLegendList, ...rest } = props;
@@ -26,22 +43,9 @@ var LegendListForwardedRef = React__default.default.forwardRef(function LegendLi
26
43
  var AnimatedLegendListComponent = Animated__default.default.createAnimatedComponent(LegendListForwardedRef);
27
44
  var AnimatedLegendList = React__default.default.forwardRef(function AnimatedLegendList2(props, ref) {
28
45
  const { refScrollView, ...rest } = props;
29
- return /* @__PURE__ */ React__default.default.createElement(
30
- AnimatedLegendListComponent,
31
- {
32
- refLegendList: (r) => {
33
- if (ref) {
34
- if (typeof ref === "function") {
35
- ref(r);
36
- } else {
37
- ref.current = r;
38
- }
39
- }
40
- },
41
- ref: refScrollView,
42
- ...rest
43
- }
44
- );
46
+ const refLegendList = React__default.default.useRef(null);
47
+ const combinedRef = useCombinedRef(refLegendList, ref);
48
+ return /* @__PURE__ */ React__default.default.createElement(AnimatedLegendListComponent, { refLegendList: combinedRef, ref: refScrollView, ...rest });
45
49
  });
46
50
 
47
51
  exports.AnimatedLegendList = AnimatedLegendList;
package/reanimated.mjs CHANGED
@@ -1,7 +1,24 @@
1
1
  import { LegendList } from '@legendapp/list';
2
- import React from 'react';
2
+ import React, { useCallback } from 'react';
3
3
  import Animated from 'react-native-reanimated';
4
4
 
5
+ // src/reanimated.tsx
6
+ var useCombinedRef = (...refs) => {
7
+ const callback = useCallback((element) => {
8
+ for (const ref of refs) {
9
+ if (!ref) {
10
+ continue;
11
+ }
12
+ if (typeof ref === "function") {
13
+ ref(element);
14
+ } else {
15
+ ref.current = element;
16
+ }
17
+ }
18
+ }, refs);
19
+ return callback;
20
+ };
21
+
5
22
  // src/reanimated.tsx
6
23
  var LegendListForwardedRef = React.forwardRef(function LegendListForwardedRef2(props, ref) {
7
24
  const { refLegendList, ...rest } = props;
@@ -19,22 +36,9 @@ var LegendListForwardedRef = React.forwardRef(function LegendListForwardedRef2(p
19
36
  var AnimatedLegendListComponent = Animated.createAnimatedComponent(LegendListForwardedRef);
20
37
  var AnimatedLegendList = React.forwardRef(function AnimatedLegendList2(props, ref) {
21
38
  const { refScrollView, ...rest } = props;
22
- return /* @__PURE__ */ React.createElement(
23
- AnimatedLegendListComponent,
24
- {
25
- refLegendList: (r) => {
26
- if (ref) {
27
- if (typeof ref === "function") {
28
- ref(r);
29
- } else {
30
- ref.current = r;
31
- }
32
- }
33
- },
34
- ref: refScrollView,
35
- ...rest
36
- }
37
- );
39
+ const refLegendList = React.useRef(null);
40
+ const combinedRef = useCombinedRef(refLegendList, ref);
41
+ return /* @__PURE__ */ React.createElement(AnimatedLegendListComponent, { refLegendList: combinedRef, ref: refScrollView, ...rest });
38
42
  });
39
43
 
40
44
  export { AnimatedLegendList };