@legendapp/list 1.0.0-beta.8 → 1.0.0
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 +5 -0
- package/README.md +96 -43
- package/animated.d.mts +54 -4
- package/animated.d.ts +54 -4
- package/index.d.mts +341 -63
- package/index.d.ts +341 -63
- package/index.js +1139 -434
- package/index.mjs +1117 -412
- package/keyboard-controller.d.mts +401 -0
- package/keyboard-controller.d.ts +401 -0
- package/keyboard-controller.js +69 -0
- package/keyboard-controller.mjs +48 -0
- package/package.json +3 -6
- package/reanimated.d.mts +12 -11
- package/reanimated.d.ts +12 -11
- package/reanimated.js +27 -16
- package/reanimated.mjs +28 -17
package/reanimated.js
CHANGED
|
@@ -9,6 +9,30 @@ 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
|
+
|
|
14
|
+
// src/helpers.ts
|
|
15
|
+
function isFunction(obj) {
|
|
16
|
+
return typeof obj === "function";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/useCombinedRef.ts
|
|
20
|
+
var useCombinedRef = (...refs) => {
|
|
21
|
+
const callback = React.useCallback((element) => {
|
|
22
|
+
for (const ref of refs) {
|
|
23
|
+
if (!ref) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (isFunction(ref)) {
|
|
27
|
+
ref(element);
|
|
28
|
+
} else {
|
|
29
|
+
ref.current = element;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, refs);
|
|
33
|
+
return callback;
|
|
34
|
+
};
|
|
35
|
+
|
|
12
36
|
// src/reanimated.tsx
|
|
13
37
|
var LegendListForwardedRef = React__default.default.forwardRef(function LegendListForwardedRef2(props, ref) {
|
|
14
38
|
const { refLegendList, ...rest } = props;
|
|
@@ -26,22 +50,9 @@ var LegendListForwardedRef = React__default.default.forwardRef(function LegendLi
|
|
|
26
50
|
var AnimatedLegendListComponent = Animated__default.default.createAnimatedComponent(LegendListForwardedRef);
|
|
27
51
|
var AnimatedLegendList = React__default.default.forwardRef(function AnimatedLegendList2(props, ref) {
|
|
28
52
|
const { refScrollView, ...rest } = props;
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
);
|
|
53
|
+
const refLegendList = React__default.default.useRef(null);
|
|
54
|
+
const combinedRef = useCombinedRef(refLegendList, ref);
|
|
55
|
+
return /* @__PURE__ */ React__default.default.createElement(AnimatedLegendListComponent, { refLegendList: combinedRef, ref: refScrollView, ...rest });
|
|
45
56
|
});
|
|
46
57
|
|
|
47
58
|
exports.AnimatedLegendList = AnimatedLegendList;
|
package/reanimated.mjs
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
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
|
+
|
|
7
|
+
// src/helpers.ts
|
|
8
|
+
function isFunction(obj) {
|
|
9
|
+
return typeof obj === "function";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/useCombinedRef.ts
|
|
13
|
+
var useCombinedRef = (...refs) => {
|
|
14
|
+
const callback = useCallback((element) => {
|
|
15
|
+
for (const ref of refs) {
|
|
16
|
+
if (!ref) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (isFunction(ref)) {
|
|
20
|
+
ref(element);
|
|
21
|
+
} else {
|
|
22
|
+
ref.current = element;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, refs);
|
|
26
|
+
return callback;
|
|
27
|
+
};
|
|
28
|
+
|
|
5
29
|
// src/reanimated.tsx
|
|
6
30
|
var LegendListForwardedRef = React.forwardRef(function LegendListForwardedRef2(props, ref) {
|
|
7
31
|
const { refLegendList, ...rest } = props;
|
|
@@ -19,22 +43,9 @@ var LegendListForwardedRef = React.forwardRef(function LegendListForwardedRef2(p
|
|
|
19
43
|
var AnimatedLegendListComponent = Animated.createAnimatedComponent(LegendListForwardedRef);
|
|
20
44
|
var AnimatedLegendList = React.forwardRef(function AnimatedLegendList2(props, ref) {
|
|
21
45
|
const { refScrollView, ...rest } = props;
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
);
|
|
46
|
+
const refLegendList = React.useRef(null);
|
|
47
|
+
const combinedRef = useCombinedRef(refLegendList, ref);
|
|
48
|
+
return /* @__PURE__ */ React.createElement(AnimatedLegendListComponent, { refLegendList: combinedRef, ref: refScrollView, ...rest });
|
|
38
49
|
});
|
|
39
50
|
|
|
40
51
|
export { AnimatedLegendList };
|