@draftbit/core 49.5.2-5ac7d2.2 → 49.5.2-e8f32c.2
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/lib/commonjs/components/SectionList/SectionList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleFlashList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleFlatList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleScrollView.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleSectionList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableList.js +1 -1
- package/lib/typescript/src/components/SectionList/SectionList.d.ts +6 -4
- package/lib/typescript/src/components/SectionList/SectionList.js +4 -4
- package/lib/typescript/src/components/SectionList/SectionList.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.d.ts +2 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.d.ts +2 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.d.ts +2 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.d.ts +2 -2
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.d.ts +2 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.d.ts +6 -2
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.d.ts +6 -2
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +3 -3
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
- package/lib/typescript/src/components/SwipeableItem/SwipeableList.d.ts +3 -3
- package/lib/typescript/src/components/SwipeableItem/SwipeableList.js +4 -4
- package/lib/typescript/src/components/SwipeableItem/SwipeableList.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/SectionList/SectionList.js +4 -4
- package/src/components/SectionList/SectionList.js.map +1 -1
- package/src/components/SectionList/SectionList.tsx +152 -145
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.tsx +22 -16
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.tsx +22 -16
- package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.tsx +20 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.tsx +27 -17
- package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.tsx +20 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.tsx +28 -20
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.tsx +28 -20
- package/src/components/SwipeableItem/SwipeableList.js +4 -4
- package/src/components/SwipeableItem/SwipeableList.js.map +1 -1
- package/src/components/SwipeableItem/SwipeableList.tsx +47 -32
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MasonryFlashList } from "@shopify/flash-list";
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
MasonryFlashListProps,
|
|
5
|
+
ContentStyle,
|
|
6
|
+
MasonryFlashListRef,
|
|
7
|
+
} from "@shopify/flash-list";
|
|
4
8
|
import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* A MasonryFlashList wrapper that takes a single `style` prop and internally extracts
|
|
8
12
|
* the appropriate style keys into the `contentContainerStyle`
|
|
9
13
|
*/
|
|
10
|
-
const SimpleStyleMasonryFlashList =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const SimpleStyleMasonryFlashList = React.forwardRef(
|
|
15
|
+
<T extends any>(
|
|
16
|
+
{
|
|
17
|
+
style: styleProp,
|
|
18
|
+
data,
|
|
19
|
+
...rest
|
|
20
|
+
}: Omit<MasonryFlashListProps<T>, "contentContainerStyle">,
|
|
21
|
+
ref: React.Ref<MasonryFlashListRef<any>>
|
|
22
|
+
) => {
|
|
23
|
+
const { style, contentContainerStyle } =
|
|
24
|
+
useSplitContentContainerStyles(styleProp);
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
return (
|
|
27
|
+
<MasonryFlashList
|
|
28
|
+
ref={ref as any}
|
|
29
|
+
style={style}
|
|
30
|
+
contentContainerStyle={contentContainerStyle as ContentStyle}
|
|
31
|
+
data={data}
|
|
32
|
+
{...rest}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
27
37
|
|
|
28
38
|
export default SimpleStyleMasonryFlashList;
|
|
@@ -5,9 +5,9 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A ScrollView wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleScrollView = ({ style: styleProp, ...rest }) => {
|
|
8
|
+
const SimpleStyleScrollView = React.forwardRef(({ style: styleProp, ...rest }, ref) => {
|
|
9
9
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
|
|
10
|
-
return (React.createElement(ScrollView, { style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
11
|
-
};
|
|
10
|
+
return (React.createElement(ScrollView, { ref: ref, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
11
|
+
});
|
|
12
12
|
export default SimpleStyleScrollView;
|
|
13
13
|
//# sourceMappingURL=SimpleStyleScrollView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleScrollView.js","sourceRoot":"","sources":["SimpleStyleScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"SimpleStyleScrollView.js","sourceRoot":"","sources":["SimpleStyleScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAC5C,CACE,EACE,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EACwC,EACjD,GAA0B,EAC1B,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,KACxC,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -7,19 +7,26 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
7
7
|
* A ScrollView wrapper that takes a single `style` prop and internally extracts
|
|
8
8
|
* the appropriate style keys into the `contentContainerStyle`
|
|
9
9
|
*/
|
|
10
|
-
const SimpleStyleScrollView
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const SimpleStyleScrollView = React.forwardRef(
|
|
11
|
+
(
|
|
12
|
+
{
|
|
13
|
+
style: styleProp,
|
|
14
|
+
...rest
|
|
15
|
+
}: Omit<ScrollViewProps, "contentContainerStyle">,
|
|
16
|
+
ref: React.Ref<ScrollView>
|
|
17
|
+
) => {
|
|
18
|
+
const { style, contentContainerStyle } =
|
|
19
|
+
useSplitContentContainerStyles(styleProp);
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
return (
|
|
22
|
+
<ScrollView
|
|
23
|
+
ref={ref}
|
|
24
|
+
style={style}
|
|
25
|
+
contentContainerStyle={contentContainerStyle}
|
|
26
|
+
{...rest}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
24
31
|
|
|
25
32
|
export default SimpleStyleScrollView;
|
|
@@ -5,11 +5,11 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A SectionList wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleSectionList = ({ style: styleProp, data, ...rest }) => {
|
|
8
|
+
const SimpleStyleSectionList = React.forwardRef(({ style: styleProp, data, ...rest }, ref) => {
|
|
9
9
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
|
|
10
10
|
return (
|
|
11
11
|
//@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
|
|
12
|
-
React.createElement(SectionList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
13
|
-
};
|
|
12
|
+
React.createElement(SectionList, { ref: ref, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
13
|
+
});
|
|
14
14
|
export default SimpleStyleSectionList;
|
|
15
15
|
//# sourceMappingURL=SimpleStyleSectionList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleSectionList.js","sourceRoot":"","sources":["SimpleStyleSectionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"SimpleStyleSectionList.js","sourceRoot":"","sources":["SimpleStyleSectionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAI9E;;;GAGG;AACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,UAAU,CAC7C,CACE,EACE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAIR,EACD,GAAyC,EACzC,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO;IACL,gHAAgH;IAChH,oBAAC,WAAW,IACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -5,31 +5,39 @@ import type {
|
|
|
5
5
|
FlashListSectionListProps,
|
|
6
6
|
} from "../SectionList";
|
|
7
7
|
import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
8
|
+
import { FlatList } from "react-native-gesture-handler";
|
|
9
|
+
import { FlashList } from "@shopify/flash-list";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* A SectionList wrapper that takes a single `style` prop and internally extracts
|
|
11
13
|
* the appropriate style keys into the `contentContainerStyle`
|
|
12
14
|
*/
|
|
13
|
-
const SimpleStyleSectionList =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const SimpleStyleSectionList = React.forwardRef(
|
|
16
|
+
<T extends { [key: string]: any }>(
|
|
17
|
+
{
|
|
18
|
+
style: styleProp,
|
|
19
|
+
data,
|
|
20
|
+
...rest
|
|
21
|
+
}: Omit<
|
|
22
|
+
FlatListSectionListProps<T> | FlashListSectionListProps<T>,
|
|
23
|
+
"contentContainerStyle"
|
|
24
|
+
>,
|
|
25
|
+
ref: React.Ref<FlatList | FlashList<any>>
|
|
26
|
+
) => {
|
|
27
|
+
const { style, contentContainerStyle } =
|
|
28
|
+
useSplitContentContainerStyles(styleProp);
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
return (
|
|
31
|
+
//@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
|
|
32
|
+
<SectionList
|
|
33
|
+
ref={ref}
|
|
34
|
+
style={style}
|
|
35
|
+
contentContainerStyle={contentContainerStyle}
|
|
36
|
+
data={data}
|
|
37
|
+
{...rest}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
34
42
|
|
|
35
43
|
export default SimpleStyleSectionList;
|
|
@@ -5,11 +5,11 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A SwipeableList wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleSwipeableList = ({ style: styleProp, data, ...rest }) => {
|
|
8
|
+
const SimpleStyleSwipeableList = React.forwardRef(({ style: styleProp, data, ...rest }, ref) => {
|
|
9
9
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
|
|
10
10
|
return (
|
|
11
11
|
//@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
|
|
12
|
-
React.createElement(SwipeableList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
13
|
-
};
|
|
12
|
+
React.createElement(SwipeableList, { ref: ref, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
13
|
+
});
|
|
14
14
|
export default SimpleStyleSwipeableList;
|
|
15
15
|
//# sourceMappingURL=SimpleStyleSwipeableList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleSwipeableList.js","sourceRoot":"","sources":["SimpleStyleSwipeableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"SimpleStyleSwipeableList.js","sourceRoot":"","sources":["SimpleStyleSwipeableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAI9E;;;GAGG;AACH,MAAM,wBAAwB,GAAG,KAAK,CAAC,UAAU,CAC/C,CACE,EACE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAIR,EACD,GAAyC,EACzC,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO;IACL,gHAAgH;IAChH,oBAAC,aAAa,IACZ,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -5,31 +5,39 @@ import type {
|
|
|
5
5
|
FlatListSwipeableListProps,
|
|
6
6
|
} from "../SwipeableItem";
|
|
7
7
|
import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
8
|
+
import { FlatList } from "react-native-gesture-handler";
|
|
9
|
+
import { FlashList } from "@shopify/flash-list";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* A SwipeableList wrapper that takes a single `style` prop and internally extracts
|
|
11
13
|
* the appropriate style keys into the `contentContainerStyle`
|
|
12
14
|
*/
|
|
13
|
-
const SimpleStyleSwipeableList =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const SimpleStyleSwipeableList = React.forwardRef(
|
|
16
|
+
<T extends { [key: string]: any }>(
|
|
17
|
+
{
|
|
18
|
+
style: styleProp,
|
|
19
|
+
data,
|
|
20
|
+
...rest
|
|
21
|
+
}: Omit<
|
|
22
|
+
FlashListSwipeableListProps<T> | FlatListSwipeableListProps<T>,
|
|
23
|
+
"contentContainerStyle"
|
|
24
|
+
>,
|
|
25
|
+
ref: React.Ref<FlatList | FlashList<any>>
|
|
26
|
+
) => {
|
|
27
|
+
const { style, contentContainerStyle } =
|
|
28
|
+
useSplitContentContainerStyles(styleProp);
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
return (
|
|
31
|
+
//@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
|
|
32
|
+
<SwipeableList
|
|
33
|
+
ref={ref}
|
|
34
|
+
style={style}
|
|
35
|
+
contentContainerStyle={contentContainerStyle}
|
|
36
|
+
data={data}
|
|
37
|
+
{...rest}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
34
42
|
|
|
35
43
|
export default SimpleStyleSwipeableList;
|
|
@@ -5,7 +5,7 @@ export const SwipeableListContext = React.createContext({
|
|
|
5
5
|
onStartSwiping: () => { },
|
|
6
6
|
onStopSwiping: () => { },
|
|
7
7
|
});
|
|
8
|
-
const SwipeableList = ({ disableScrollWhenSwiping = true, listComponent = "FlatList", ...rest }) => {
|
|
8
|
+
const SwipeableList = React.forwardRef(({ disableScrollWhenSwiping = true, listComponent = "FlatList", ...rest }, ref) => {
|
|
9
9
|
const [isSwiping, setIsSwiping] = React.useState(false);
|
|
10
10
|
const onStartSwiping = () => {
|
|
11
11
|
setIsSwiping(true);
|
|
@@ -17,13 +17,13 @@ const SwipeableList = ({ disableScrollWhenSwiping = true, listComponent = "FlatL
|
|
|
17
17
|
const renderListComponent = () => {
|
|
18
18
|
switch (listComponent) {
|
|
19
19
|
case "FlatList":
|
|
20
|
-
return React.createElement(FlatList, { ...rest });
|
|
20
|
+
return (React.createElement(FlatList, { ref: ref, ...rest }));
|
|
21
21
|
case "FlashList":
|
|
22
|
-
return React.createElement(FlashList, { ...rest });
|
|
22
|
+
return (React.createElement(FlashList, { ref: ref, ...rest }));
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
return (React.createElement(SwipeableListContext.Provider, { value: { onStartSwiping, onStopSwiping } },
|
|
26
26
|
React.createElement(React.Fragment, null, renderListComponent())));
|
|
27
|
-
};
|
|
27
|
+
});
|
|
28
28
|
export default SwipeableList;
|
|
29
29
|
//# sourceMappingURL=SwipeableList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwipeableList.js","sourceRoot":"","sources":["SwipeableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAoBvD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,KAAK,CAAC,aAAa,CAA2B;IAC5C,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;CACxB,CAAC,CAAC;AAEL,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"SwipeableList.js","sourceRoot":"","sources":["SwipeableList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAoBvD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,KAAK,CAAC,aAAa,CAA2B;IAC5C,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;CACxB,CAAC,CAAC;AAEL,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EACE,wBAAwB,GAAG,IAAI,EAC/B,aAAa,GAAG,UAAU,EAC1B,GAAG,IAAI,EACwD,EACjE,GAAyC,EACzC,EAAE;IACF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,IAAI,CAAC,aAAa,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAElE,MAAM,mBAAmB,GAAG,GAAG,EAAE;QAC/B,QAAQ,aAAa,EAAE;YACrB,KAAK,UAAU;gBACb,OAAO,CACL,oBAAC,QAAQ,IACP,GAAG,EAAE,GAA0B,KAC1B,IAAyB,GAC9B,CACH,CAAC;YACJ,KAAK,WAAW;gBACd,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAA8B,KAC9B,IAA0B,GAC/B,CACH,CAAC;SACL;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE;QACrE,0CAAG,mBAAmB,EAAE,CAAI,CACE,CACjC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -26,37 +26,52 @@ export const SwipeableListContext =
|
|
|
26
26
|
onStopSwiping: () => {},
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
const SwipeableList =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
29
|
+
const SwipeableList = React.forwardRef(
|
|
30
|
+
<T extends object>(
|
|
31
|
+
{
|
|
32
|
+
disableScrollWhenSwiping = true,
|
|
33
|
+
listComponent = "FlatList",
|
|
34
|
+
...rest
|
|
35
|
+
}: FlashListSwipeableListProps<T> | FlatListSwipeableListProps<T>,
|
|
36
|
+
ref: React.Ref<FlatList | FlashList<any>>
|
|
37
|
+
) => {
|
|
38
|
+
const [isSwiping, setIsSwiping] = React.useState(false);
|
|
39
|
+
|
|
40
|
+
const onStartSwiping = () => {
|
|
41
|
+
setIsSwiping(true);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onStopSwiping = () => {
|
|
45
|
+
setIsSwiping(false);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
rest.scrollEnabled = disableScrollWhenSwiping ? !isSwiping : true;
|
|
49
|
+
|
|
50
|
+
const renderListComponent = () => {
|
|
51
|
+
switch (listComponent) {
|
|
52
|
+
case "FlatList":
|
|
53
|
+
return (
|
|
54
|
+
<FlatList
|
|
55
|
+
ref={ref as React.Ref<FlatList>}
|
|
56
|
+
{...(rest as FlatListProps<T>)}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
case "FlashList":
|
|
60
|
+
return (
|
|
61
|
+
<FlashList
|
|
62
|
+
ref={ref as React.Ref<FlashList<T>>}
|
|
63
|
+
{...(rest as FlashListProps<T>)}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<SwipeableListContext.Provider value={{ onStartSwiping, onStopSwiping }}>
|
|
71
|
+
<>{renderListComponent()}</>
|
|
72
|
+
</SwipeableListContext.Provider>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
);
|
|
61
76
|
|
|
62
77
|
export default SwipeableList;
|