@draftbit/core 50.0.0 → 50.0.1-478d2a.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/SimpleStyleScrollables/SimpleStyleFlashList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleFlatList.js +1 -1
- package/lib/commonjs/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.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/SimpleStyleScrollables/useSplitContentContainerStyles.js +1 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.d.ts +1 -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 +1 -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/SimpleStyleMasonryFlashList.d.ts +1 -1
- 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/SimpleStyleSectionList.d.ts +1 -1
- 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 +1 -1
- 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/SimpleStyleScrollables/useSplitContentContainerStyles.d.ts +2 -1
- package/lib/typescript/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js +31 -7
- package/lib/typescript/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.tsx +4 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.tsx +4 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.tsx +4 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.tsx +4 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +3 -3
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.tsx +4 -1
- package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js +31 -7
- package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js.map +1 -1
- package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.ts +36 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "50.0.
|
|
3
|
+
"version": "50.0.1-478d2a.2+478d2a6",
|
|
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": "50.0.
|
|
44
|
+
"@draftbit/types": "^50.0.1-478d2a.2+478d2a6",
|
|
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",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
],
|
|
115
115
|
"testEnvironment": "node"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "478d2a6ebb54e7daa93c1d2e0c4118d6d3995cbb"
|
|
118
118
|
}
|
|
@@ -5,14 +5,14 @@ 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, ...rest }) => {
|
|
8
|
+
const SimpleStyleFlashList = ({ style: styleProp, data, ...rest }) => {
|
|
9
9
|
const [measuredWidth, setMeasuredWidth] = React.useState();
|
|
10
10
|
const [measuredHeight, setMeasuredHeight] = React.useState();
|
|
11
|
-
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
|
|
11
|
+
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
|
|
12
12
|
return (React.createElement(FlashList, { onLayout: (event) => {
|
|
13
13
|
setMeasuredWidth(event.nativeEvent.layout.width);
|
|
14
14
|
setMeasuredHeight(event.nativeEvent.layout.height);
|
|
15
|
-
}, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
15
|
+
}, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
16
16
|
};
|
|
17
17
|
export default SimpleStyleFlashList;
|
|
18
18
|
//# 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,CAAgB,EAC3C,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EAC0C,EAAE,EAAE;IACrD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,
|
|
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,CAAgB,EAC3C,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAC0C,EAAE,EAAE;IACrD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,EACd,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,CACL,oBAAC,SAAS,IACR,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjD,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqC,EAC5D,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -9,6 +9,7 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
9
9
|
*/
|
|
10
10
|
const SimpleStyleFlashList = <T extends any>({
|
|
11
11
|
style: styleProp,
|
|
12
|
+
data,
|
|
12
13
|
...rest
|
|
13
14
|
}: Omit<FlashListProps<T>, "contentContainerStyle">) => {
|
|
14
15
|
const [measuredWidth, setMeasuredWidth] = React.useState<number>();
|
|
@@ -17,7 +18,8 @@ const SimpleStyleFlashList = <T extends any>({
|
|
|
17
18
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(
|
|
18
19
|
styleProp,
|
|
19
20
|
measuredWidth,
|
|
20
|
-
measuredHeight
|
|
21
|
+
measuredHeight,
|
|
22
|
+
[data]
|
|
21
23
|
);
|
|
22
24
|
|
|
23
25
|
return (
|
|
@@ -28,6 +30,7 @@ const SimpleStyleFlashList = <T extends any>({
|
|
|
28
30
|
}}
|
|
29
31
|
style={style}
|
|
30
32
|
contentContainerStyle={contentContainerStyle as ContentStyle}
|
|
33
|
+
data={data}
|
|
31
34
|
{...rest}
|
|
32
35
|
/>
|
|
33
36
|
);
|
|
@@ -5,14 +5,14 @@ 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, ...rest }) => {
|
|
8
|
+
const SimpleStyleFlatList = ({ style: styleProp, data, ...rest }) => {
|
|
9
9
|
const [measuredWidth, setMeasuredWidth] = React.useState();
|
|
10
10
|
const [measuredHeight, setMeasuredHeight] = React.useState();
|
|
11
|
-
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
|
|
11
|
+
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
|
|
12
12
|
return (React.createElement(FlatList, { onLayout: (event) => {
|
|
13
13
|
setMeasuredWidth(event.nativeEvent.layout.width);
|
|
14
14
|
setMeasuredHeight(event.nativeEvent.layout.height);
|
|
15
|
-
}, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
15
|
+
}, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
16
16
|
};
|
|
17
17
|
export default SimpleStyleFlatList;
|
|
18
18
|
//# 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,CAAgB,EAC1C,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EACyC,EAAE,EAAE;IACpD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,
|
|
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,CAAgB,EAC1C,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EACyC,EAAE,EAAE;IACpD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,EACd,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,CACL,oBAAC,QAAQ,IACP,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjD,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -9,6 +9,7 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
9
9
|
*/
|
|
10
10
|
const SimpleStyleFlatList = <T extends any>({
|
|
11
11
|
style: styleProp,
|
|
12
|
+
data,
|
|
12
13
|
...rest
|
|
13
14
|
}: Omit<FlatListProps<T>, "contentContainerStyle">) => {
|
|
14
15
|
const [measuredWidth, setMeasuredWidth] = React.useState<number>();
|
|
@@ -17,7 +18,8 @@ const SimpleStyleFlatList = <T extends any>({
|
|
|
17
18
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(
|
|
18
19
|
styleProp,
|
|
19
20
|
measuredWidth,
|
|
20
|
-
measuredHeight
|
|
21
|
+
measuredHeight,
|
|
22
|
+
[data]
|
|
21
23
|
);
|
|
22
24
|
|
|
23
25
|
return (
|
|
@@ -28,6 +30,7 @@ const SimpleStyleFlatList = <T extends any>({
|
|
|
28
30
|
}}
|
|
29
31
|
style={style}
|
|
30
32
|
contentContainerStyle={contentContainerStyle}
|
|
33
|
+
data={data}
|
|
31
34
|
{...rest}
|
|
32
35
|
/>
|
|
33
36
|
);
|
|
@@ -5,14 +5,14 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
5
5
|
* A MasonryFlashList wrapper that takes a single `style` prop and internally extracts
|
|
6
6
|
* the appropriate style keys into the `contentContainerStyle`
|
|
7
7
|
*/
|
|
8
|
-
const SimpleStyleMasonryFlashList = ({ style: styleProp, ...rest }) => {
|
|
8
|
+
const SimpleStyleMasonryFlashList = ({ style: styleProp, data, ...rest }) => {
|
|
9
9
|
const [measuredWidth, setMeasuredWidth] = React.useState();
|
|
10
10
|
const [measuredHeight, setMeasuredHeight] = React.useState();
|
|
11
|
-
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
|
|
11
|
+
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
|
|
12
12
|
return (React.createElement(MasonryFlashList, { onLayout: (event) => {
|
|
13
13
|
setMeasuredWidth(event.nativeEvent.layout.width);
|
|
14
14
|
setMeasuredHeight(event.nativeEvent.layout.height);
|
|
15
|
-
}, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
15
|
+
}, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
16
16
|
};
|
|
17
17
|
export default SimpleStyleMasonryFlashList;
|
|
18
18
|
//# sourceMappingURL=SimpleStyleMasonryFlashList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleStyleMasonryFlashList.js","sourceRoot":"","sources":["SimpleStyleMasonryFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,2BAA2B,GAAG,CAAgB,EAClD,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EACiD,EAAE,EAAE;IAC5D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,
|
|
1
|
+
{"version":3,"file":"SimpleStyleMasonryFlashList.js","sourceRoot":"","sources":["SimpleStyleMasonryFlashList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E;;;GAGG;AACH,MAAM,2BAA2B,GAAG,CAAgB,EAClD,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EACiD,EAAE,EAAE;IAC5D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,EACd,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB,IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjD,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqC,EAC5D,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -9,6 +9,7 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
9
9
|
*/
|
|
10
10
|
const SimpleStyleMasonryFlashList = <T extends any>({
|
|
11
11
|
style: styleProp,
|
|
12
|
+
data,
|
|
12
13
|
...rest
|
|
13
14
|
}: Omit<MasonryFlashListProps<T>, "contentContainerStyle">) => {
|
|
14
15
|
const [measuredWidth, setMeasuredWidth] = React.useState<number>();
|
|
@@ -17,7 +18,8 @@ const SimpleStyleMasonryFlashList = <T extends any>({
|
|
|
17
18
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(
|
|
18
19
|
styleProp,
|
|
19
20
|
measuredWidth,
|
|
20
|
-
measuredHeight
|
|
21
|
+
measuredHeight,
|
|
22
|
+
[data]
|
|
21
23
|
);
|
|
22
24
|
|
|
23
25
|
return (
|
|
@@ -28,6 +30,7 @@ const SimpleStyleMasonryFlashList = <T extends any>({
|
|
|
28
30
|
}}
|
|
29
31
|
style={style}
|
|
30
32
|
contentContainerStyle={contentContainerStyle as ContentStyle}
|
|
33
|
+
data={data}
|
|
31
34
|
{...rest}
|
|
32
35
|
/>
|
|
33
36
|
);
|
|
@@ -5,16 +5,16 @@ 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, ...rest }) => {
|
|
8
|
+
const SimpleStyleSectionList = ({ style: styleProp, data, ...rest }) => {
|
|
9
9
|
const [measuredWidth, setMeasuredWidth] = React.useState();
|
|
10
10
|
const [measuredHeight, setMeasuredHeight] = React.useState();
|
|
11
|
-
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
|
|
11
|
+
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
|
|
12
12
|
return (
|
|
13
13
|
//@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
|
|
14
14
|
React.createElement(SectionList, { onLayout: (event) => {
|
|
15
15
|
setMeasuredWidth(event.nativeEvent.layout.width);
|
|
16
16
|
setMeasuredHeight(event.nativeEvent.layout.height);
|
|
17
|
-
}, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
17
|
+
}, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
18
18
|
};
|
|
19
19
|
export default SimpleStyleSectionList;
|
|
20
20
|
//# 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,GAAG,IAAI,EAIR,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,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;AAE9E;;;GAGG;AACH,MAAM,sBAAsB,GAAG,CAAmC,EAChE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAIR,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,EACd,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO;IACL,gHAAgH;IAChH,oBAAC,WAAW,IACV,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjD,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -12,6 +12,7 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
12
12
|
*/
|
|
13
13
|
const SimpleStyleSectionList = <T extends { [key: string]: any }>({
|
|
14
14
|
style: styleProp,
|
|
15
|
+
data,
|
|
15
16
|
...rest
|
|
16
17
|
}: Omit<
|
|
17
18
|
FlatListSectionListProps<T> | FlashListSectionListProps<T>,
|
|
@@ -23,7 +24,8 @@ const SimpleStyleSectionList = <T extends { [key: string]: any }>({
|
|
|
23
24
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(
|
|
24
25
|
styleProp,
|
|
25
26
|
measuredWidth,
|
|
26
|
-
measuredHeight
|
|
27
|
+
measuredHeight,
|
|
28
|
+
[data]
|
|
27
29
|
);
|
|
28
30
|
|
|
29
31
|
return (
|
|
@@ -35,6 +37,7 @@ const SimpleStyleSectionList = <T extends { [key: string]: any }>({
|
|
|
35
37
|
}}
|
|
36
38
|
style={style}
|
|
37
39
|
contentContainerStyle={contentContainerStyle}
|
|
40
|
+
data={data}
|
|
38
41
|
{...rest}
|
|
39
42
|
/>
|
|
40
43
|
);
|
|
@@ -5,16 +5,16 @@ 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, ...rest }) => {
|
|
8
|
+
const SimpleStyleSwipeableList = ({ style: styleProp, data, ...rest }) => {
|
|
9
9
|
const [measuredWidth, setMeasuredWidth] = React.useState();
|
|
10
10
|
const [measuredHeight, setMeasuredHeight] = React.useState();
|
|
11
|
-
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
|
|
11
|
+
const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
|
|
12
12
|
return (
|
|
13
13
|
//@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
|
|
14
14
|
React.createElement(SwipeableList, { onLayout: (event) => {
|
|
15
15
|
setMeasuredWidth(event.nativeEvent.layout.width);
|
|
16
16
|
setMeasuredHeight(event.nativeEvent.layout.height);
|
|
17
|
-
}, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
|
|
17
|
+
}, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
|
|
18
18
|
};
|
|
19
19
|
export default SimpleStyleSwipeableList;
|
|
20
20
|
//# 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,GAAG,IAAI,EAIR,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,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;AAE9E;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAmC,EAClE,KAAK,EAAE,SAAS,EAChB,IAAI,EACJ,GAAG,IAAI,EAIR,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,8BAA8B,CACrE,SAAS,EACT,aAAa,EACb,cAAc,EACd,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO;IACL,gHAAgH;IAChH,oBAAC,aAAa,IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjD,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC,EACD,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,EAC5C,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -12,6 +12,7 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
|
|
|
12
12
|
*/
|
|
13
13
|
const SimpleStyleSwipeableList = <T extends { [key: string]: any }>({
|
|
14
14
|
style: styleProp,
|
|
15
|
+
data,
|
|
15
16
|
...rest
|
|
16
17
|
}: Omit<
|
|
17
18
|
FlashListSwipeableListProps<T> | FlatListSwipeableListProps<T>,
|
|
@@ -23,7 +24,8 @@ const SimpleStyleSwipeableList = <T extends { [key: string]: any }>({
|
|
|
23
24
|
const { style, contentContainerStyle } = useSplitContentContainerStyles(
|
|
24
25
|
styleProp,
|
|
25
26
|
measuredWidth,
|
|
26
|
-
measuredHeight
|
|
27
|
+
measuredHeight,
|
|
28
|
+
[data]
|
|
27
29
|
);
|
|
28
30
|
|
|
29
31
|
return (
|
|
@@ -35,6 +37,7 @@ const SimpleStyleSwipeableList = <T extends { [key: string]: any }>({
|
|
|
35
37
|
}}
|
|
36
38
|
style={style}
|
|
37
39
|
contentContainerStyle={contentContainerStyle}
|
|
40
|
+
data={data}
|
|
38
41
|
{...rest}
|
|
39
42
|
/>
|
|
40
43
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { StyleSheet } from "react-native";
|
|
2
3
|
import { pick, omit } from "lodash";
|
|
3
4
|
import { useDeepCompareMemo } from "../../utilities";
|
|
@@ -16,16 +17,33 @@ export const contentContainerStyleNames = [
|
|
|
16
17
|
"alignContent",
|
|
17
18
|
"flexDirection",
|
|
18
19
|
"flexWrap",
|
|
20
|
+
"gap",
|
|
21
|
+
"columnGap",
|
|
22
|
+
"rowGap",
|
|
19
23
|
];
|
|
20
|
-
export default function useSplitContentContainerStyles(originalStyle, measuredWidth, measuredHeight) {
|
|
24
|
+
export default function useSplitContentContainerStyles(originalStyle, measuredWidth, measuredHeight, recalculateSizeDeps = []) {
|
|
25
|
+
// This temporarily removes contentContainerStyle min sizes whenever some
|
|
26
|
+
// given dependencies change to allow the list to properly recalculate it's measured size
|
|
27
|
+
const [tempContentContainerStyle, setTempContentContainerStyle] = React.useState(null);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (tempContentContainerStyle) {
|
|
30
|
+
setTempContentContainerStyle(null);
|
|
31
|
+
}
|
|
32
|
+
// We only want this to run when measured size changes
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}, [measuredHeight, measuredWidth]);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
setTempContentContainerStyle({ minHeight: 0, minWidth: 0 });
|
|
37
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
+
}, recalculateSizeDeps);
|
|
21
39
|
return useDeepCompareMemo(() => {
|
|
22
40
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23
41
|
const flattenedStyle = StyleSheet.flatten(originalStyle);
|
|
24
42
|
let contentContainerStyle = pick(flattenedStyle, contentContainerStyleNames);
|
|
25
|
-
const leftBorderWidth = (_b = (_a = flattenedStyle.borderLeftWidth) !== null && _a !== void 0 ? _a : flattenedStyle.borderWidth) !== null && _b !== void 0 ? _b : 0;
|
|
26
|
-
const rightBorderWidth = (_d = (_c = flattenedStyle.borderRightWidth) !== null && _c !== void 0 ? _c : flattenedStyle.borderWidth) !== null && _d !== void 0 ? _d : 0;
|
|
27
|
-
const topBorderWidth = (_f = (_e = flattenedStyle.borderTopWidth) !== null && _e !== void 0 ? _e : flattenedStyle.borderWidth) !== null && _f !== void 0 ? _f : 0;
|
|
28
|
-
const bottomBorderWidth = (_h = (_g = flattenedStyle.borderBottomWidth) !== null && _g !== void 0 ? _g : flattenedStyle.borderWidth) !== null && _h !== void 0 ? _h : 0;
|
|
43
|
+
const leftBorderWidth = (_b = (_a = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderLeftWidth) !== null && _a !== void 0 ? _a : flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderWidth) !== null && _b !== void 0 ? _b : 0;
|
|
44
|
+
const rightBorderWidth = (_d = (_c = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderRightWidth) !== null && _c !== void 0 ? _c : flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderWidth) !== null && _d !== void 0 ? _d : 0;
|
|
45
|
+
const topBorderWidth = (_f = (_e = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderTopWidth) !== null && _e !== void 0 ? _e : flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderWidth) !== null && _f !== void 0 ? _f : 0;
|
|
46
|
+
const bottomBorderWidth = (_h = (_g = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderBottomWidth) !== null && _g !== void 0 ? _g : flattenedStyle === null || flattenedStyle === void 0 ? void 0 : flattenedStyle.borderWidth) !== null && _h !== void 0 ? _h : 0;
|
|
29
47
|
// contentContainerStyle should always at least fill the parent to ensure sizing changes reflects properly on component and children.
|
|
30
48
|
// The measured sizes include borders, so we need to subtract those before applying
|
|
31
49
|
if (measuredWidth) {
|
|
@@ -45,7 +63,13 @@ export default function useSplitContentContainerStyles(originalStyle, measuredWi
|
|
|
45
63
|
else if (style.flexGrow === undefined) {
|
|
46
64
|
style = { flexGrow: style.flex, ...style };
|
|
47
65
|
}
|
|
48
|
-
return {
|
|
49
|
-
|
|
66
|
+
return {
|
|
67
|
+
style,
|
|
68
|
+
contentContainerStyle: StyleSheet.flatten([
|
|
69
|
+
contentContainerStyle,
|
|
70
|
+
tempContentContainerStyle,
|
|
71
|
+
]),
|
|
72
|
+
};
|
|
73
|
+
}, [originalStyle, measuredWidth, measuredHeight, tempContentContainerStyle]);
|
|
50
74
|
}
|
|
51
75
|
//# sourceMappingURL=useSplitContentContainerStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSplitContentContainerStyles.js","sourceRoot":"","sources":["useSplitContentContainerStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOrD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS;IACT,eAAe;IACf,YAAY;IACZ,mBAAmB;IACnB,aAAa;IACb,cAAc;IACd,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,eAAe;IACf,UAAU;
|
|
1
|
+
{"version":3,"file":"useSplitContentContainerStyles.js","sourceRoot":"","sources":["useSplitContentContainerStyles.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
2
3
|
import { pick, omit } from "lodash";
|
|
3
4
|
import { useDeepCompareMemo } from "../../utilities";
|
|
@@ -22,13 +23,35 @@ export const contentContainerStyleNames = [
|
|
|
22
23
|
"alignContent",
|
|
23
24
|
"flexDirection",
|
|
24
25
|
"flexWrap",
|
|
26
|
+
"gap",
|
|
27
|
+
"columnGap",
|
|
28
|
+
"rowGap",
|
|
25
29
|
];
|
|
26
30
|
|
|
27
31
|
export default function useSplitContentContainerStyles(
|
|
28
32
|
originalStyle: StyleProp<ViewStyle>,
|
|
29
33
|
measuredWidth?: number,
|
|
30
|
-
measuredHeight?: number
|
|
34
|
+
measuredHeight?: number,
|
|
35
|
+
recalculateSizeDeps: React.DependencyList = []
|
|
31
36
|
) {
|
|
37
|
+
// This temporarily removes contentContainerStyle min sizes whenever some
|
|
38
|
+
// given dependencies change to allow the list to properly recalculate it's measured size
|
|
39
|
+
const [tempContentContainerStyle, setTempContentContainerStyle] =
|
|
40
|
+
React.useState<ViewStyle | null>(null);
|
|
41
|
+
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (tempContentContainerStyle) {
|
|
44
|
+
setTempContentContainerStyle(null);
|
|
45
|
+
}
|
|
46
|
+
// We only want this to run when measured size changes
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, [measuredHeight, measuredWidth]);
|
|
49
|
+
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
setTempContentContainerStyle({ minHeight: 0, minWidth: 0 });
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
}, recalculateSizeDeps);
|
|
54
|
+
|
|
32
55
|
return useDeepCompareMemo<Styles>(() => {
|
|
33
56
|
const flattenedStyle = StyleSheet.flatten(originalStyle);
|
|
34
57
|
|
|
@@ -38,13 +61,13 @@ export default function useSplitContentContainerStyles(
|
|
|
38
61
|
);
|
|
39
62
|
|
|
40
63
|
const leftBorderWidth =
|
|
41
|
-
flattenedStyle
|
|
64
|
+
flattenedStyle?.borderLeftWidth ?? flattenedStyle?.borderWidth ?? 0;
|
|
42
65
|
const rightBorderWidth =
|
|
43
|
-
flattenedStyle
|
|
66
|
+
flattenedStyle?.borderRightWidth ?? flattenedStyle?.borderWidth ?? 0;
|
|
44
67
|
const topBorderWidth =
|
|
45
|
-
flattenedStyle
|
|
68
|
+
flattenedStyle?.borderTopWidth ?? flattenedStyle?.borderWidth ?? 0;
|
|
46
69
|
const bottomBorderWidth =
|
|
47
|
-
flattenedStyle
|
|
70
|
+
flattenedStyle?.borderBottomWidth ?? flattenedStyle?.borderWidth ?? 0;
|
|
48
71
|
|
|
49
72
|
// contentContainerStyle should always at least fill the parent to ensure sizing changes reflects properly on component and children.
|
|
50
73
|
// The measured sizes include borders, so we need to subtract those before applying
|
|
@@ -67,6 +90,12 @@ export default function useSplitContentContainerStyles(
|
|
|
67
90
|
style = { flexGrow: style.flex, ...style };
|
|
68
91
|
}
|
|
69
92
|
|
|
70
|
-
return {
|
|
71
|
-
|
|
93
|
+
return {
|
|
94
|
+
style,
|
|
95
|
+
contentContainerStyle: StyleSheet.flatten([
|
|
96
|
+
contentContainerStyle,
|
|
97
|
+
tempContentContainerStyle,
|
|
98
|
+
]),
|
|
99
|
+
};
|
|
100
|
+
}, [originalStyle, measuredWidth, measuredHeight, tempContentContainerStyle]);
|
|
72
101
|
}
|