@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.
Files changed (65) hide show
  1. package/lib/commonjs/components/SectionList/SectionList.js +1 -1
  2. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleFlashList.js +1 -1
  3. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleFlatList.js +1 -1
  4. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +1 -1
  5. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +1 -1
  6. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleScrollView.js +1 -1
  7. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleSectionList.js +1 -1
  8. package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +1 -1
  9. package/lib/commonjs/components/SwipeableItem/SwipeableList.js +1 -1
  10. package/lib/typescript/src/components/SectionList/SectionList.d.ts +6 -4
  11. package/lib/typescript/src/components/SectionList/SectionList.js +4 -4
  12. package/lib/typescript/src/components/SectionList/SectionList.js.map +1 -1
  13. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.d.ts +2 -1
  14. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +3 -3
  15. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
  16. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.d.ts +2 -1
  17. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +3 -3
  18. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
  19. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.d.ts +2 -1
  20. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +3 -3
  21. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +1 -1
  22. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.d.ts +2 -2
  23. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +3 -3
  24. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
  25. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.d.ts +2 -1
  26. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +3 -3
  27. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +1 -1
  28. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.d.ts +6 -2
  29. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +3 -3
  30. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
  31. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.d.ts +6 -2
  32. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +3 -3
  33. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
  34. package/lib/typescript/src/components/SwipeableItem/SwipeableList.d.ts +3 -3
  35. package/lib/typescript/src/components/SwipeableItem/SwipeableList.js +4 -4
  36. package/lib/typescript/src/components/SwipeableItem/SwipeableList.js.map +1 -1
  37. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +3 -3
  39. package/src/components/SectionList/SectionList.js +4 -4
  40. package/src/components/SectionList/SectionList.js.map +1 -1
  41. package/src/components/SectionList/SectionList.tsx +152 -145
  42. package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +3 -3
  43. package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
  44. package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.tsx +22 -16
  45. package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +3 -3
  46. package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
  47. package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.tsx +22 -16
  48. package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +3 -3
  49. package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +1 -1
  50. package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.tsx +20 -13
  51. package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +3 -3
  52. package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
  53. package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.tsx +27 -17
  54. package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +3 -3
  55. package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +1 -1
  56. package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.tsx +20 -13
  57. package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +3 -3
  58. package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
  59. package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.tsx +28 -20
  60. package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +3 -3
  61. package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
  62. package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.tsx +28 -20
  63. package/src/components/SwipeableItem/SwipeableList.js +4 -4
  64. package/src/components/SwipeableItem/SwipeableList.js.map +1 -1
  65. 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 { MasonryFlashListProps, ContentStyle } from "@shopify/flash-list";
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 = <T extends any>({
11
- style: styleProp,
12
- data,
13
- ...rest
14
- }: Omit<MasonryFlashListProps<T>, "contentContainerStyle">) => {
15
- const { style, contentContainerStyle } =
16
- useSplitContentContainerStyles(styleProp);
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
- return (
19
- <MasonryFlashList
20
- style={style}
21
- contentContainerStyle={contentContainerStyle as ContentStyle}
22
- data={data}
23
- {...rest}
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,GAEvB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACpC,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,KACxC,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
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: React.FC<
11
- Omit<ScrollViewProps, "contentContainerStyle">
12
- > = ({ style: styleProp, ...rest }) => {
13
- const { style, contentContainerStyle } =
14
- useSplitContentContainerStyles(styleProp);
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
- return (
17
- <ScrollView
18
- style={style}
19
- contentContainerStyle={contentContainerStyle}
20
- {...rest}
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;AAE9E;;;GAGG;AACH,MAAM,sBAAsB,GAAG,CAAmC,EAChE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAIR,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO;IACL,gHAAgH;IAChH,oBAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,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 = <T extends { [key: string]: any }>({
14
- style: styleProp,
15
- data,
16
- ...rest
17
- }: Omit<
18
- FlatListSectionListProps<T> | FlashListSectionListProps<T>,
19
- "contentContainerStyle"
20
- >) => {
21
- const { style, contentContainerStyle } =
22
- useSplitContentContainerStyles(styleProp);
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
- return (
25
- //@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
26
- <SectionList
27
- style={style}
28
- contentContainerStyle={contentContainerStyle}
29
- data={data}
30
- {...rest}
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;AAE9E;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAmC,EAClE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAIR,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO;IACL,gHAAgH;IAChH,oBAAC,aAAa,IACZ,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,wBAAwB,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 = <T extends { [key: string]: any }>({
14
- style: styleProp,
15
- data,
16
- ...rest
17
- }: Omit<
18
- FlashListSwipeableListProps<T> | FlatListSwipeableListProps<T>,
19
- "contentContainerStyle"
20
- >) => {
21
- const { style, contentContainerStyle } =
22
- useSplitContentContainerStyles(styleProp);
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
- return (
25
- //@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
26
- <SwipeableList
27
- style={style}
28
- contentContainerStyle={contentContainerStyle}
29
- data={data}
30
- {...rest}
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
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,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 = <T extends object>({
30
- disableScrollWhenSwiping = true,
31
- listComponent = "FlatList",
32
- ...rest
33
- }: FlashListSwipeableListProps<T> | FlatListSwipeableListProps<T>) => {
34
- const [isSwiping, setIsSwiping] = React.useState(false);
35
-
36
- const onStartSwiping = () => {
37
- setIsSwiping(true);
38
- };
39
-
40
- const onStopSwiping = () => {
41
- setIsSwiping(false);
42
- };
43
-
44
- rest.scrollEnabled = disableScrollWhenSwiping ? !isSwiping : true;
45
-
46
- const renderListComponent = () => {
47
- switch (listComponent) {
48
- case "FlatList":
49
- return <FlatList {...(rest as FlatListProps<T>)} />;
50
- case "FlashList":
51
- return <FlashList {...(rest as FlashListProps<T>)} />;
52
- }
53
- };
54
-
55
- return (
56
- <SwipeableListContext.Provider value={{ onStartSwiping, onStopSwiping }}>
57
- <>{renderListComponent()}</>
58
- </SwipeableListContext.Provider>
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;