@draftbit/core 50.1.2-8b3aec.2 → 50.1.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/Checkbox/CheckboxRow.js +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView.js +1 -1
- 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/commonjs/components/TabView/TabView.js +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.js +3 -3
- package/lib/typescript/src/components/Checkbox/CheckboxRow.js.map +1 -1
- package/lib/typescript/src/components/KeyboardAvoidingView.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardAvoidingView.js +1 -1
- package/lib/typescript/src/components/KeyboardAvoidingView.js.map +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/src/components/TabView/TabView.d.ts +2 -0
- package/lib/typescript/src/components/TabView/TabView.js +17 -2
- package/lib/typescript/src/components/TabView/TabView.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/Checkbox/CheckboxRow.js +3 -3
- package/src/components/Checkbox/CheckboxRow.js.map +1 -1
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/KeyboardAvoidingView.js +1 -1
- package/src/components/KeyboardAvoidingView.js.map +1 -1
- package/src/components/KeyboardAvoidingView.tsx +2 -2
- 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
- package/src/components/TabView/TabView.js +17 -2
- package/src/components/TabView/TabView.js.map +1 -1
- package/src/components/TabView/TabView.tsx +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "50.1.2
|
|
3
|
+
"version": "50.1.2",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "
|
|
44
|
+
"@draftbit/types": "50.1.0",
|
|
45
45
|
"@expo/vector-icons": "^14.0.0",
|
|
46
46
|
"@gorhom/bottom-sheet": "5.0.0-alpha.7",
|
|
47
47
|
"@material-ui/core": "^4.11.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
],
|
|
118
118
|
"testEnvironment": "node"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "a54f32d20ab73e3d99472451fda160f150a4399a"
|
|
121
121
|
}
|
|
@@ -45,7 +45,7 @@ const CheckboxRow = ({ label = "Label", labelStyle, labelContainerStyle, checkbo
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
const { textStyles, viewStyles } = extractStyles(style);
|
|
48
|
-
return (React.createElement(Pressable, { onPress: handlePress, style: [
|
|
48
|
+
return (React.createElement(Pressable, { onPress: handlePress, style: [styles.mainParent, viewStyles, , { flexDirection: direction }], disabled: disabled, ...rest },
|
|
49
49
|
React.createElement(View, { style: [
|
|
50
50
|
styles.label,
|
|
51
51
|
{
|
|
@@ -59,9 +59,9 @@ const styles = StyleSheet.create({
|
|
|
59
59
|
mainParent: {
|
|
60
60
|
alignItems: "center",
|
|
61
61
|
justifyContent: "space-around",
|
|
62
|
-
|
|
62
|
+
paddingLeft: 20,
|
|
63
|
+
paddingRight: 20,
|
|
63
64
|
minHeight: 50,
|
|
64
|
-
paddingEnd: 20,
|
|
65
65
|
display: "flex",
|
|
66
66
|
...Platform.select({
|
|
67
67
|
web: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxRow.js","sourceRoot":"","sources":["CheckboxRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,UAAU,EAEV,IAAI,EACJ,QAAQ,EACR,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,QAA2B,MAAM,YAAY,CAAC;AAErD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,uCAA0B,CAAA;AAC5B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAUD,MAAM,WAAW,GAAG,CAClB,KAA+B,EAC/B,UAAgC,EAChC,SAA+B,EAC/B,EAAE;IACF,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,oBAAC,IAAI,IAAC,KAAK,EAAE,CAA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@@ -102,7 +102,7 @@ const CheckboxRow: React.FC<CheckboxRowProps & IconSlot> = ({
|
|
|
102
102
|
return (
|
|
103
103
|
<Pressable
|
|
104
104
|
onPress={handlePress}
|
|
105
|
-
style={[
|
|
105
|
+
style={[styles.mainParent, viewStyles, , { flexDirection: direction }]}
|
|
106
106
|
disabled={disabled}
|
|
107
107
|
{...rest}
|
|
108
108
|
>
|
|
@@ -138,9 +138,9 @@ const styles = StyleSheet.create({
|
|
|
138
138
|
mainParent: {
|
|
139
139
|
alignItems: "center",
|
|
140
140
|
justifyContent: "space-around",
|
|
141
|
-
|
|
141
|
+
paddingLeft: 20,
|
|
142
|
+
paddingRight: 20,
|
|
142
143
|
minHeight: 50,
|
|
143
|
-
paddingEnd: 20,
|
|
144
144
|
display: "flex",
|
|
145
145
|
...Platform.select({
|
|
146
146
|
web: {
|
|
@@ -23,7 +23,7 @@ const KeyboardAvoidingView = ({ behavior = "padding", keyboardVerticalOffset = 0
|
|
|
23
23
|
else {
|
|
24
24
|
keyboardVerticalOffsetResult = keyboardVerticalOffset;
|
|
25
25
|
}
|
|
26
|
-
return (React.createElement(KeyboardAvoidingViewComponent, { behavior: behaviorResult
|
|
26
|
+
return (React.createElement(KeyboardAvoidingViewComponent, { behavior: behaviorResult, keyboardVerticalOffset: keyboardVerticalOffsetResult, ...rest }));
|
|
27
27
|
};
|
|
28
28
|
export default KeyboardAvoidingView;
|
|
29
29
|
//# sourceMappingURL=KeyboardAvoidingView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardAvoidingView.js","sourceRoot":"","sources":["KeyboardAvoidingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,oBAAoB,IAAI,6BAA6B,EACrD,QAAQ,GAET,MAAM,cAAc,CAAC;AAEtB,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AACpC,MAAM,SAAS,GAAG,QAAQ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B,GAAG,IAAI,EACR,EAAE,EAAE;IACH,IAAI,cAA4C,CAAC;IAEjD,IAAI,KAAK,IAAI,WAAW,KAAK,SAAS,EAAE;QACtC,cAAc,GAAG,WAAW,CAAC;KAC9B;SAAM,IAAI,SAAS,IAAI,eAAe,KAAK,SAAS,EAAE;QACrD,cAAc,GAAG,eAAe,CAAC;KAClC;SAAM;QACL,cAAc,GAAG,QAAQ,CAAC;KAC3B;IAED,IAAI,4BAAoC,CAAC;IAEzC,IAAI,KAAK,IAAI,yBAAyB,KAAK,SAAS,EAAE;QACpD,4BAA4B,GAAG,yBAAyB,CAAC;KAC1D;SAAM,IAAI,SAAS,IAAI,6BAA6B,KAAK,SAAS,EAAE;QACnE,4BAA4B,GAAG,6BAA6B,CAAC;KAC9D;SAAM;QACL,4BAA4B,GAAG,sBAAsB,CAAC;KACvD;IAED,OAAO,CACL,oBAAC,6BAA6B,IAC5B,QAAQ,EAAE,cAAc,EACxB,sBAAsB,EAAE,4BAA4B,KAChD,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
const isIos = Platform.OS === "ios";
|
|
9
9
|
const isAndroid = Platform.OS === "android";
|
|
10
10
|
|
|
11
|
-
type KeyboardAvoidingViewBehavior = "height" | "position" | "padding"
|
|
11
|
+
type KeyboardAvoidingViewBehavior = "height" | "position" | "padding";
|
|
12
12
|
|
|
13
13
|
interface KeyboardAvoidingViewProps extends ViewProps {
|
|
14
14
|
enabled?: boolean;
|
|
@@ -51,7 +51,7 @@ const KeyboardAvoidingView: React.FC<KeyboardAvoidingViewProps> = ({
|
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
53
|
<KeyboardAvoidingViewComponent
|
|
54
|
-
behavior={behaviorResult
|
|
54
|
+
behavior={behaviorResult}
|
|
55
55
|
keyboardVerticalOffset={keyboardVerticalOffsetResult}
|
|
56
56
|
{...rest}
|
|
57
57
|
/>
|
|
@@ -4,7 +4,7 @@ import { FlatList } from "react-native";
|
|
|
4
4
|
import SectionHeader, { DefaultSectionHeader } from "./SectionHeader";
|
|
5
5
|
import { flattenReactFragments } from "../../utilities";
|
|
6
6
|
export const DEFAULT_SECTION = "Uncategorized";
|
|
7
|
-
const SectionList = ({ sectionKey, stickyHeader = false, listComponent = "FlatList", data: dataProp, renderItem: renderItemProp, keyExtractor: keyExtractorProp, ...rest }) => {
|
|
7
|
+
const SectionList = React.forwardRef(({ sectionKey, stickyHeader = false, listComponent = "FlatList", data: dataProp, renderItem: renderItemProp, keyExtractor: keyExtractorProp, ...rest }, ref) => {
|
|
8
8
|
const data = React.useMemo(() => (Array.isArray(dataProp) ? dataProp : []), [dataProp]);
|
|
9
9
|
const dataWithSections = React.useMemo(() => {
|
|
10
10
|
var _a;
|
|
@@ -102,10 +102,10 @@ const SectionList = ({ sectionKey, stickyHeader = false, listComponent = "FlatLi
|
|
|
102
102
|
};
|
|
103
103
|
switch (listComponent) {
|
|
104
104
|
case "FlatList":
|
|
105
|
-
return (React.createElement(FlatList, { stickyHeaderIndices: sectionHeaderIndicies, ...rest, data: dataWithSections, renderItem: renderItem, keyExtractor: keyExtractor }));
|
|
105
|
+
return (React.createElement(FlatList, { ref: ref, stickyHeaderIndices: sectionHeaderIndicies, ...rest, data: dataWithSections, renderItem: renderItem, keyExtractor: keyExtractor }));
|
|
106
106
|
case "FlashList":
|
|
107
|
-
return (React.createElement(FlashList, { stickyHeaderIndices: sectionHeaderIndicies, ...rest, data: dataWithSections, renderItem: renderItem, keyExtractor: keyExtractor }));
|
|
107
|
+
return (React.createElement(FlashList, { ref: ref, stickyHeaderIndices: sectionHeaderIndicies, ...rest, data: dataWithSections, renderItem: renderItem, keyExtractor: keyExtractor }));
|
|
108
108
|
}
|
|
109
|
-
};
|
|
109
|
+
});
|
|
110
110
|
export default SectionList;
|
|
111
111
|
//# sourceMappingURL=SectionList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionList.js","sourceRoot":"","sources":["SectionList.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;AACvD,OAAO,aAAa,EAAE,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAqCxD,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"SectionList.js","sourceRoot":"","sources":["SectionList.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;AACvD,OAAO,aAAa,EAAE,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAqCxD,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CACE,EACE,UAAU,EACV,YAAY,GAAG,KAAK,EACpB,aAAa,GAAG,UAAU,EAC1B,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,cAAc,EAC1B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,IAAI,EACoD,EAC7D,GAAyC,EACzC,EAAE;IACF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CACxB,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAQ,EACtD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,MAAM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IAA0C,EAC/C,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,KAAK,WAAW;YACd,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAA+C,EACpD,mBAAmB,EAAE,qBAAqB,KACrC,IAA2C,EAChD,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;KACL;AACH,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -41,168 +41,175 @@ type SectionListItem<T> = SectionListDataItem<T> | SectionListSectionItem;
|
|
|
41
41
|
|
|
42
42
|
export const DEFAULT_SECTION = "Uncategorized";
|
|
43
43
|
|
|
44
|
-
const SectionList =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (const item of data) {
|
|
63
|
-
const section = item[sectionKey]?.toString() || DEFAULT_SECTION;
|
|
64
|
-
if (sectionDataItems[section]) {
|
|
65
|
-
sectionDataItems[section].push(item);
|
|
66
|
-
} else {
|
|
67
|
-
sectionDataItems[section] = [item];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
44
|
+
const SectionList = React.forwardRef(
|
|
45
|
+
<T extends { [key: string]: any }>(
|
|
46
|
+
{
|
|
47
|
+
sectionKey,
|
|
48
|
+
stickyHeader = false,
|
|
49
|
+
listComponent = "FlatList",
|
|
50
|
+
data: dataProp,
|
|
51
|
+
renderItem: renderItemProp,
|
|
52
|
+
keyExtractor: keyExtractorProp,
|
|
53
|
+
...rest
|
|
54
|
+
}: FlatListSectionListProps<T> | FlashListSectionListProps<T>,
|
|
55
|
+
ref: React.Ref<FlatList | FlashList<any>>
|
|
56
|
+
) => {
|
|
57
|
+
const data = React.useMemo(
|
|
58
|
+
() => (Array.isArray(dataProp) ? dataProp : []) as T[],
|
|
59
|
+
[dataProp]
|
|
60
|
+
);
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
result
|
|
73
|
-
const
|
|
74
|
-
section
|
|
75
|
-
].map((item) => ({ type: "DATA_ITEM", data: item }));
|
|
76
|
-
result.push(...sectionItems);
|
|
77
|
-
}
|
|
62
|
+
const dataWithSections = React.useMemo(() => {
|
|
63
|
+
const result: SectionListItem<T>[] = [];
|
|
64
|
+
const sectionDataItems: { [key: string]: T[] } = {};
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!element) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
66
|
+
for (const item of data) {
|
|
67
|
+
const section = item[sectionKey]?.toString() || DEFAULT_SECTION;
|
|
68
|
+
if (sectionDataItems[section]) {
|
|
69
|
+
sectionDataItems[section].push(item);
|
|
70
|
+
} else {
|
|
71
|
+
sectionDataItems[section] = [item];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
for (const section in sectionDataItems) {
|
|
76
|
+
result.push({ type: "SECTION_ITEM", title: section });
|
|
77
|
+
const sectionItems: SectionListDataItem<T>[] = sectionDataItems[
|
|
78
|
+
section
|
|
79
|
+
].map((item) => ({ type: "DATA_ITEM", data: item }));
|
|
80
|
+
result.push(...sectionItems);
|
|
81
|
+
}
|
|
98
82
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
83
|
+
return result;
|
|
84
|
+
}, [data, sectionKey]);
|
|
85
|
+
|
|
86
|
+
const sectionHeaderIndicies = React.useMemo(
|
|
87
|
+
() =>
|
|
88
|
+
stickyHeader
|
|
89
|
+
? dataWithSections
|
|
90
|
+
.filter((item) => item.type === "SECTION_ITEM")
|
|
91
|
+
.map((item) => dataWithSections.indexOf(item))
|
|
92
|
+
: undefined,
|
|
93
|
+
[dataWithSections, stickyHeader]
|
|
102
94
|
);
|
|
103
95
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return child;
|
|
110
|
-
}
|
|
96
|
+
const extractSectionHeader = (
|
|
97
|
+
element: JSX.Element | null
|
|
98
|
+
): JSX.Element | null => {
|
|
99
|
+
if (!element) {
|
|
100
|
+
return null;
|
|
111
101
|
}
|
|
112
|
-
}
|
|
113
|
-
return null;
|
|
114
|
-
};
|
|
115
102
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
103
|
+
const props = element.props || {};
|
|
104
|
+
const children = flattenReactFragments(
|
|
105
|
+
React.Children.toArray(props.children) as React.ReactElement[]
|
|
106
|
+
);
|
|
122
107
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const newChildren = [];
|
|
131
|
-
for (const child of children) {
|
|
132
|
-
if (child.type !== SectionHeader) {
|
|
133
|
-
newChildren.push(child);
|
|
108
|
+
if (element.type === SectionHeader) {
|
|
109
|
+
return element;
|
|
110
|
+
} else {
|
|
111
|
+
for (const child of children) {
|
|
112
|
+
if (child.type === SectionHeader) {
|
|
113
|
+
return child;
|
|
114
|
+
}
|
|
134
115
|
}
|
|
135
116
|
}
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
children: newChildren,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
};
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
142
119
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
index: number;
|
|
149
|
-
}) => {
|
|
150
|
-
switch (item.type) {
|
|
151
|
-
case "SECTION_ITEM": {
|
|
152
|
-
const renderedItem = renderItemProp({
|
|
153
|
-
index,
|
|
154
|
-
section: item.title,
|
|
155
|
-
});
|
|
156
|
-
return (
|
|
157
|
-
extractSectionHeader(renderedItem) || (
|
|
158
|
-
<DefaultSectionHeader title={item.title} />
|
|
159
|
-
)
|
|
160
|
-
);
|
|
120
|
+
const extractRemainingNonSectionHeader = (
|
|
121
|
+
element: JSX.Element | null
|
|
122
|
+
): JSX.Element | null => {
|
|
123
|
+
if (!element) {
|
|
124
|
+
return null;
|
|
161
125
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
126
|
+
|
|
127
|
+
const props = element.props || {};
|
|
128
|
+
const children = flattenReactFragments(
|
|
129
|
+
React.Children.toArray(props.children) as React.ReactElement[]
|
|
130
|
+
);
|
|
131
|
+
if (element.type === SectionHeader) {
|
|
132
|
+
return null;
|
|
133
|
+
} else {
|
|
134
|
+
const newChildren = [];
|
|
135
|
+
for (const child of children) {
|
|
136
|
+
if (child.type !== SectionHeader) {
|
|
137
|
+
newChildren.push(child);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return React.cloneElement(element, {
|
|
141
|
+
...props,
|
|
142
|
+
children: newChildren,
|
|
167
143
|
});
|
|
168
|
-
return extractRemainingNonSectionHeader(renderedItem);
|
|
169
144
|
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const renderItem = ({
|
|
148
|
+
item,
|
|
149
|
+
index,
|
|
150
|
+
}: {
|
|
151
|
+
item: SectionListItem<T>;
|
|
152
|
+
index: number;
|
|
153
|
+
}) => {
|
|
154
|
+
switch (item.type) {
|
|
155
|
+
case "SECTION_ITEM": {
|
|
156
|
+
const renderedItem = renderItemProp({
|
|
157
|
+
index,
|
|
158
|
+
section: item.title,
|
|
159
|
+
});
|
|
160
|
+
return (
|
|
161
|
+
extractSectionHeader(renderedItem) || (
|
|
162
|
+
<DefaultSectionHeader title={item.title} />
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
case "DATA_ITEM": {
|
|
167
|
+
const renderedItem = renderItemProp({
|
|
168
|
+
item: item.data,
|
|
169
|
+
index,
|
|
170
|
+
section: item.data[sectionKey] || DEFAULT_SECTION,
|
|
171
|
+
});
|
|
172
|
+
return extractRemainingNonSectionHeader(renderedItem);
|
|
173
|
+
}
|
|
177
174
|
}
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const keyExtractor = (item: SectionListItem<T>, index: number) => {
|
|
178
|
+
switch (item.type) {
|
|
179
|
+
case "SECTION_ITEM": {
|
|
180
|
+
return `section_${index.toString()}`;
|
|
181
|
+
}
|
|
182
|
+
case "DATA_ITEM": {
|
|
183
|
+
return keyExtractorProp?.(item.data, index) || index.toString();
|
|
184
|
+
}
|
|
180
185
|
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
switch (listComponent) {
|
|
189
|
+
case "FlatList":
|
|
190
|
+
return (
|
|
191
|
+
<FlatList
|
|
192
|
+
ref={ref as React.Ref<FlatList>}
|
|
193
|
+
stickyHeaderIndices={sectionHeaderIndicies}
|
|
194
|
+
{...(rest as FlatListProps<SectionListItem<T>>)}
|
|
195
|
+
data={dataWithSections}
|
|
196
|
+
renderItem={renderItem}
|
|
197
|
+
keyExtractor={keyExtractor}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
case "FlashList":
|
|
201
|
+
return (
|
|
202
|
+
<FlashList
|
|
203
|
+
ref={ref as React.Ref<FlashList<SectionListItem<T>>>}
|
|
204
|
+
stickyHeaderIndices={sectionHeaderIndicies}
|
|
205
|
+
{...(rest as FlashListProps<SectionListItem<T>>)}
|
|
206
|
+
data={dataWithSections}
|
|
207
|
+
renderItem={renderItem}
|
|
208
|
+
keyExtractor={keyExtractor}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
181
211
|
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
switch (listComponent) {
|
|
185
|
-
case "FlatList":
|
|
186
|
-
return (
|
|
187
|
-
<FlatList
|
|
188
|
-
stickyHeaderIndices={sectionHeaderIndicies}
|
|
189
|
-
{...(rest as FlatListProps<SectionListItem<T>>)}
|
|
190
|
-
data={dataWithSections}
|
|
191
|
-
renderItem={renderItem}
|
|
192
|
-
keyExtractor={keyExtractor}
|
|
193
|
-
/>
|
|
194
|
-
);
|
|
195
|
-
case "FlashList":
|
|
196
|
-
return (
|
|
197
|
-
<FlashList
|
|
198
|
-
stickyHeaderIndices={sectionHeaderIndicies}
|
|
199
|
-
{...(rest as FlashListProps<SectionListItem<T>>)}
|
|
200
|
-
data={dataWithSections}
|
|
201
|
-
renderItem={renderItem}
|
|
202
|
-
keyExtractor={keyExtractor}
|
|
203
|
-
/>
|
|
204
|
-
);
|
|
205
212
|
}
|
|
206
|
-
|
|
213
|
+
);
|
|
207
214
|
|
|
208
215
|
export default SectionList;
|
|
@@ -5,9 +5,9 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A FlashList wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleFlashList = ({ style: styleProp, data, ...rest }) => {
|
|
8
|
+
const SimpleStyleFlashList = React.forwardRef(({ style: styleProp, data, ...rest }, ref) => {
|
|
9
9
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
|
|
10
|
-
return (React.createElement(FlashList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
11
|
-
};
|
|
10
|
+
return (React.createElement(FlashList, { ref: ref, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
11
|
+
});
|
|
12
12
|
export default SimpleStyleFlashList;
|
|
13
13
|
//# sourceMappingURL=SimpleStyleFlashList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleFlashList.js","sourceRoot":"","sources":["SimpleStyleFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"file":"SimpleStyleFlashList.js","sourceRoot":"","sources":["SimpleStyleFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAC3C,CACE,EACE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAC0C,EACnD,GAA8B,EAC9B,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqC,EAC5D,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -7,22 +7,28 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
7
7
|
* A FlashList wrapper that takes a single `style` prop and internally extracts
|
|
8
8
|
* the appropriate style keys into the `contentContainerStyle`
|
|
9
9
|
*/
|
|
10
|
-
const SimpleStyleFlashList =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const SimpleStyleFlashList = React.forwardRef(
|
|
11
|
+
<T extends any>(
|
|
12
|
+
{
|
|
13
|
+
style: styleProp,
|
|
14
|
+
data,
|
|
15
|
+
...rest
|
|
16
|
+
}: Omit<FlashListProps<T>, "contentContainerStyle">,
|
|
17
|
+
ref: React.Ref<FlashList<any>>
|
|
18
|
+
) => {
|
|
19
|
+
const { style, contentContainerStyle } =
|
|
20
|
+
useSplitContentContainerStyles(styleProp);
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
return (
|
|
23
|
+
<FlashList
|
|
24
|
+
ref={ref}
|
|
25
|
+
style={style}
|
|
26
|
+
contentContainerStyle={contentContainerStyle as ContentStyle}
|
|
27
|
+
data={data}
|
|
28
|
+
{...rest}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
27
33
|
|
|
28
34
|
export default SimpleStyleFlashList;
|
|
@@ -5,9 +5,9 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A FlatList wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleFlatList = ({ style: styleProp, data, ...rest }) => {
|
|
8
|
+
const SimpleStyleFlatList = React.forwardRef(({ style: styleProp, data, ...rest }, ref) => {
|
|
9
9
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
|
|
10
|
-
return (React.createElement(FlatList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
11
|
-
};
|
|
10
|
+
return (React.createElement(FlatList, { ref: ref, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
11
|
+
});
|
|
12
12
|
export default SimpleStyleFlatList;
|
|
13
13
|
//# sourceMappingURL=SimpleStyleFlatList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleFlatList.js","sourceRoot":"","sources":["SimpleStyleFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"SimpleStyleFlatList.js","sourceRoot":"","sources":["SimpleStyleFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAC1C,CACE,EACE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EACyC,EAClD,GAAwB,EACxB,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,QAAQ,IACP,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,mBAAmB,CAAC"}
|
|
@@ -7,22 +7,28 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
7
7
|
* A FlatList wrapper that takes a single `style` prop and internally extracts
|
|
8
8
|
* the appropriate style keys into the `contentContainerStyle`
|
|
9
9
|
*/
|
|
10
|
-
const SimpleStyleFlatList =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const SimpleStyleFlatList = React.forwardRef(
|
|
11
|
+
<T extends any>(
|
|
12
|
+
{
|
|
13
|
+
style: styleProp,
|
|
14
|
+
data,
|
|
15
|
+
...rest
|
|
16
|
+
}: Omit<FlatListProps<T>, "contentContainerStyle">,
|
|
17
|
+
ref: React.Ref<FlatList>
|
|
18
|
+
) => {
|
|
19
|
+
const { style, contentContainerStyle } =
|
|
20
|
+
useSplitContentContainerStyles(styleProp);
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
return (
|
|
23
|
+
<FlatList
|
|
24
|
+
ref={ref}
|
|
25
|
+
style={style}
|
|
26
|
+
contentContainerStyle={contentContainerStyle}
|
|
27
|
+
data={data}
|
|
28
|
+
{...rest}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
27
33
|
|
|
28
34
|
export default SimpleStyleFlatList;
|
|
@@ -5,9 +5,9 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A KeyboardAwareScrollView wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleKeyboardAwareScrollView = ({ style: styleProp, ...rest }) => {
|
|
8
|
+
const SimpleStyleKeyboardAwareScrollView = React.forwardRef(({ style: styleProp, ...rest }, ref) => {
|
|
9
9
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
|
|
10
|
-
return (React.createElement(KeyboardAwareScrollView, { style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
11
|
-
};
|
|
10
|
+
return (React.createElement(KeyboardAwareScrollView, { ref: ref, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
11
|
+
});
|
|
12
12
|
export default SimpleStyleKeyboardAwareScrollView;
|
|
13
13
|
//# sourceMappingURL=SimpleStyleKeyboardAwareScrollView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleKeyboardAwareScrollView.js","sourceRoot":"","sources":["SimpleStyleKeyboardAwareScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,kCAAkC,
|
|
1
|
+
{"version":3,"file":"SimpleStyleKeyboardAwareScrollView.js","sourceRoot":"","sources":["SimpleStyleKeyboardAwareScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,kCAAkC,GAAG,KAAK,CAAC,UAAU,CACzD,CACE,EACE,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EACqD,EAC9D,GAAuC,EACvC,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,uBAAuB,IACtB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,KACxC,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kCAAkC,CAAC"}
|