@draftbit/core 49.4.11-179279.2 → 49.4.11-cca7a9.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 (58) hide show
  1. package/lib/commonjs/components/ScreenContainer.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/SimpleStyleScrollables/useSplitContentContainerStyles.js +1 -1
  10. package/lib/typescript/src/components/ScreenContainer.d.ts +3 -1
  11. package/lib/typescript/src/components/ScreenContainer.js +8 -2
  12. package/lib/typescript/src/components/ScreenContainer.js.map +1 -1
  13. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +7 -2
  14. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
  15. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +7 -2
  16. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
  17. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +7 -2
  18. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +1 -1
  19. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +7 -2
  20. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
  21. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +7 -2
  22. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +1 -1
  23. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +7 -2
  24. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
  25. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +7 -2
  26. package/lib/typescript/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
  27. package/lib/typescript/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.d.ts +2 -1
  28. package/lib/typescript/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js +36 -5
  29. package/lib/typescript/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js.map +1 -1
  30. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +3 -3
  32. package/src/components/ScreenContainer.js +8 -2
  33. package/src/components/ScreenContainer.js.map +1 -1
  34. package/src/components/ScreenContainer.tsx +13 -1
  35. package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +7 -2
  36. package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +1 -1
  37. package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.tsx +13 -2
  38. package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +7 -2
  39. package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +1 -1
  40. package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.tsx +13 -2
  41. package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +7 -2
  42. package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +1 -1
  43. package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.tsx +12 -2
  44. package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +7 -2
  45. package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +1 -1
  46. package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.tsx +13 -2
  47. package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +7 -2
  48. package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +1 -1
  49. package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.tsx +12 -2
  50. package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +7 -2
  51. package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +1 -1
  52. package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.tsx +13 -2
  53. package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +7 -2
  54. package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +1 -1
  55. package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.tsx +13 -2
  56. package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js +36 -5
  57. package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js.map +1 -1
  58. package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.ts +47 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "49.4.11-179279.2+1792799",
3
+ "version": "49.4.11-cca7a9.2+cca7a92",
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": "^49.4.11-179279.2+1792799",
44
+ "@draftbit/types": "^49.4.11-cca7a9.2+cca7a92",
45
45
  "@expo/vector-icons": "^13.0.0",
46
46
  "@gorhom/bottom-sheet": "5.0.0-alpha.7",
47
47
  "@material-ui/core": "^4.11.0",
@@ -113,5 +113,5 @@
113
113
  ],
114
114
  "testEnvironment": "node"
115
115
  },
116
- "gitHead": "17927999e128534c6aa4bb0a56ed5e9eb93edb8b"
116
+ "gitHead": "cca7a928eecca9df204d0c18d1bb7806f8b341bf"
117
117
  }
@@ -2,16 +2,22 @@ import * as React from "react";
2
2
  import { StyleSheet, ScrollView, View, } from "react-native";
3
3
  import { SafeAreaView } from "react-native-safe-area-context";
4
4
  import { withTheme } from "../theming";
5
- function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, theme, style, children, ...rest }) {
5
+ function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, hasLeftSafeArea = true, hasRightSafeArea = true, theme, style, children, ...rest }) {
6
6
  var _a;
7
7
  const backgroundColor = ((_a = StyleSheet.flatten(style)) === null || _a === void 0 ? void 0 : _a.backgroundColor) || theme.colors.background;
8
- const edges = ["left", "right"];
8
+ const edges = [];
9
9
  if (hasSafeArea || hasTopSafeArea) {
10
10
  edges.push("top");
11
11
  }
12
12
  if (hasSafeArea || hasBottomSafeArea) {
13
13
  edges.push("bottom");
14
14
  }
15
+ if (hasSafeArea || hasLeftSafeArea) {
16
+ edges.push("left");
17
+ }
18
+ if (hasSafeArea || hasRightSafeArea) {
19
+ edges.push("right");
20
+ }
15
21
  return (React.createElement(SafeAreaView, { edges: edges, style: [
16
22
  styles.container,
17
23
  {
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenContainer.js","sourceRoot":"","sources":["ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,UAAU,EACV,UAAU,EAGV,IAAI,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAavC,SAAS,eAAe,CAAC,EACvB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,i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nB,KAAK;SACN,IAEA,QAAQ,CACE,CACd,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,EAAE,KAAK,CAAC,IACxD,QAAQ,CACJ,CACR,CACY,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,mBAAmB,EAAE;QACnB,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,SAAS;KAChB;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,eAAe,CAAC,CAAC"}
@@ -16,6 +16,8 @@ type ScreenContainerProps = {
16
16
  hasSafeArea?: boolean;
17
17
  hasTopSafeArea?: boolean;
18
18
  hasBottomSafeArea?: boolean;
19
+ hasLeftSafeArea?: boolean;
20
+ hasRightSafeArea?: boolean;
19
21
  theme: Theme;
20
22
  style?: StyleProp<ViewStyle>;
21
23
  children?: React.ReactNode;
@@ -26,6 +28,8 @@ function ScreenContainer({
26
28
  hasSafeArea = false,
27
29
  hasBottomSafeArea = false,
28
30
  hasTopSafeArea = false,
31
+ hasLeftSafeArea = true,
32
+ hasRightSafeArea = true,
29
33
  theme,
30
34
  style,
31
35
  children,
@@ -34,7 +38,7 @@ function ScreenContainer({
34
38
  const backgroundColor =
35
39
  StyleSheet.flatten(style)?.backgroundColor || theme.colors.background;
36
40
 
37
- const edges: Edge[] = ["left", "right"];
41
+ const edges: Edge[] = [];
38
42
  if (hasSafeArea || hasTopSafeArea) {
39
43
  edges.push("top");
40
44
  }
@@ -43,6 +47,14 @@ function ScreenContainer({
43
47
  edges.push("bottom");
44
48
  }
45
49
 
50
+ if (hasSafeArea || hasLeftSafeArea) {
51
+ edges.push("left");
52
+ }
53
+
54
+ if (hasSafeArea || hasRightSafeArea) {
55
+ edges.push("right");
56
+ }
57
+
46
58
  return (
47
59
  <SafeAreaView
48
60
  edges={edges}
@@ -6,8 +6,13 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleFlashList = ({ style: styleProp, data, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
10
- return (React.createElement(FlashList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
12
+ return (React.createElement(FlashList, { onLayout: (event) => {
13
+ setMeasuredWidth(event.nativeEvent.layout.width);
14
+ setMeasuredHeight(event.nativeEvent.layout.height);
15
+ }, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
11
16
  };
12
17
  export default SimpleStyleFlashList;
13
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,IAAI,EACJ,GAAG,IAAI,EAC0C,EAAE,EAAE;IACrD,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqC,EAC5D,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,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"}
@@ -12,11 +12,22 @@ const SimpleStyleFlashList = <T extends any>({
12
12
  data,
13
13
  ...rest
14
14
  }: Omit<FlashListProps<T>, "contentContainerStyle">) => {
15
- const { style, contentContainerStyle } =
16
- useSplitContentContainerStyles(styleProp);
15
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
16
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
17
+
18
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
19
+ styleProp,
20
+ measuredWidth,
21
+ measuredHeight,
22
+ [data]
23
+ );
17
24
 
18
25
  return (
19
26
  <FlashList
27
+ onLayout={(event) => {
28
+ setMeasuredWidth(event.nativeEvent.layout.width);
29
+ setMeasuredHeight(event.nativeEvent.layout.height);
30
+ }}
20
31
  style={style}
21
32
  contentContainerStyle={contentContainerStyle as ContentStyle}
22
33
  data={data}
@@ -6,8 +6,13 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleFlatList = ({ style: styleProp, data, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
10
- return (React.createElement(FlatList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
12
+ return (React.createElement(FlatList, { onLayout: (event) => {
13
+ setMeasuredWidth(event.nativeEvent.layout.width);
14
+ setMeasuredHeight(event.nativeEvent.layout.height);
15
+ }, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
11
16
  };
12
17
  export default SimpleStyleFlatList;
13
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,IAAI,EAC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,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -12,11 +12,22 @@ const SimpleStyleFlatList = <T extends any>({
12
12
  data,
13
13
  ...rest
14
14
  }: Omit<FlatListProps<T>, "contentContainerStyle">) => {
15
- const { style, contentContainerStyle } =
16
- useSplitContentContainerStyles(styleProp);
15
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
16
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
17
+
18
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
19
+ styleProp,
20
+ measuredWidth,
21
+ measuredHeight,
22
+ [data]
23
+ );
17
24
 
18
25
  return (
19
26
  <FlatList
27
+ onLayout={(event) => {
28
+ setMeasuredWidth(event.nativeEvent.layout.width);
29
+ setMeasuredHeight(event.nativeEvent.layout.height);
30
+ }}
20
31
  style={style}
21
32
  contentContainerStyle={contentContainerStyle}
22
33
  data={data}
@@ -6,8 +6,13 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleKeyboardAwareScrollView = ({ style: styleProp, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
10
- return (React.createElement(KeyboardAwareScrollView, { style: style, contentContainerStyle: contentContainerStyle, ...rest }));
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
12
+ return (React.createElement(KeyboardAwareScrollView, { onLayout: (event) => {
13
+ setMeasuredWidth(event.nativeEvent.layout.width);
14
+ setMeasuredHeight(event.nativeEvent.layout.height);
15
+ }, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
11
16
  };
12
17
  export default SimpleStyleKeyboardAwareScrollView;
13
18
  //# 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,GAEpC,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,uBAAuB,IACtB,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqB,KACxC,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kCAAkC,CAAC"}
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,GAEpC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACpC,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,CACf,CAAC;IAEF,OAAO,CACL,oBAAC,uBAAuB,IACtB,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,KACxC,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kCAAkC,CAAC"}
@@ -10,11 +10,21 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
10
10
  const SimpleStyleKeyboardAwareScrollView: React.FC<
11
11
  Omit<KeyboardAwareScrollViewProps, "contentContainerStyle">
12
12
  > = ({ style: styleProp, ...rest }) => {
13
- const { style, contentContainerStyle } =
14
- useSplitContentContainerStyles(styleProp);
13
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
14
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
15
+
16
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
17
+ styleProp,
18
+ measuredWidth,
19
+ measuredHeight
20
+ );
15
21
 
16
22
  return (
17
23
  <KeyboardAwareScrollView
24
+ onLayout={(event) => {
25
+ setMeasuredWidth(event.nativeEvent.layout.width);
26
+ setMeasuredHeight(event.nativeEvent.layout.height);
27
+ }}
18
28
  style={style}
19
29
  contentContainerStyle={contentContainerStyle}
20
30
  {...rest}
@@ -6,8 +6,13 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleMasonryFlashList = ({ style: styleProp, data, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
10
- return (React.createElement(MasonryFlashList, { style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
12
+ return (React.createElement(MasonryFlashList, { onLayout: (event) => {
13
+ setMeasuredWidth(event.nativeEvent.layout.width);
14
+ setMeasuredHeight(event.nativeEvent.layout.height);
15
+ }, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
11
16
  };
12
17
  export default SimpleStyleMasonryFlashList;
13
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,IAAI,EACJ,GAAG,IAAI,EACiD,EAAE,EAAE;IAC5D,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GACpC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,oBAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,qBAAqB,EAAE,qBAAqC,EAC5D,IAAI,EAAE,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,2BAA2B,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"}
@@ -12,11 +12,22 @@ const SimpleStyleMasonryFlashList = <T extends any>({
12
12
  data,
13
13
  ...rest
14
14
  }: Omit<MasonryFlashListProps<T>, "contentContainerStyle">) => {
15
- const { style, contentContainerStyle } =
16
- useSplitContentContainerStyles(styleProp);
15
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
16
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
17
+
18
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
19
+ styleProp,
20
+ measuredWidth,
21
+ measuredHeight,
22
+ [data]
23
+ );
17
24
 
18
25
  return (
19
26
  <MasonryFlashList
27
+ onLayout={(event) => {
28
+ setMeasuredWidth(event.nativeEvent.layout.width);
29
+ setMeasuredHeight(event.nativeEvent.layout.height);
30
+ }}
20
31
  style={style}
21
32
  contentContainerStyle={contentContainerStyle as ContentStyle}
22
33
  data={data}
@@ -6,8 +6,13 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleScrollView = ({ style: styleProp, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
10
- return (React.createElement(ScrollView, { style: style, contentContainerStyle: contentContainerStyle, ...rest }));
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight);
12
+ return (React.createElement(ScrollView, { onLayout: (event) => {
13
+ setMeasuredWidth(event.nativeEvent.layout.width);
14
+ setMeasuredHeight(event.nativeEvent.layout.height);
15
+ }, style: style, contentContainerStyle: contentContainerStyle, ...rest }));
11
16
  };
12
17
  export default SimpleStyleScrollView;
13
18
  //# 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,GAEvB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACpC,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,CACf,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,IACT,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,KACxC,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -10,11 +10,21 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
10
10
  const SimpleStyleScrollView: React.FC<
11
11
  Omit<ScrollViewProps, "contentContainerStyle">
12
12
  > = ({ style: styleProp, ...rest }) => {
13
- const { style, contentContainerStyle } =
14
- useSplitContentContainerStyles(styleProp);
13
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
14
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
15
+
16
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
17
+ styleProp,
18
+ measuredWidth,
19
+ measuredHeight
20
+ );
15
21
 
16
22
  return (
17
23
  <ScrollView
24
+ onLayout={(event) => {
25
+ setMeasuredWidth(event.nativeEvent.layout.width);
26
+ setMeasuredHeight(event.nativeEvent.layout.height);
27
+ }}
18
28
  style={style}
19
29
  contentContainerStyle={contentContainerStyle}
20
30
  {...rest}
@@ -6,10 +6,15 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleSectionList = ({ style: styleProp, data, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
10
12
  return (
11
13
  //@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 }));
14
+ React.createElement(SectionList, { onLayout: (event) => {
15
+ setMeasuredWidth(event.nativeEvent.layout.width);
16
+ setMeasuredHeight(event.nativeEvent.layout.height);
17
+ }, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
13
18
  };
14
19
  export default SimpleStyleSectionList;
15
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,IAAI,EACJ,GAAG,IAAI,EA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E,IAAI,KACN,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -18,12 +18,23 @@ const SimpleStyleSectionList = <T extends { [key: string]: any }>({
18
18
  FlatListSectionListProps<T> | FlashListSectionListProps<T>,
19
19
  "contentContainerStyle"
20
20
  >) => {
21
- const { style, contentContainerStyle } =
22
- useSplitContentContainerStyles(styleProp);
21
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
22
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
23
+
24
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
25
+ styleProp,
26
+ measuredWidth,
27
+ measuredHeight,
28
+ [data]
29
+ );
23
30
 
24
31
  return (
25
32
  //@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
26
33
  <SectionList
34
+ onLayout={(event) => {
35
+ setMeasuredWidth(event.nativeEvent.layout.width);
36
+ setMeasuredHeight(event.nativeEvent.layout.height);
37
+ }}
27
38
  style={style}
28
39
  contentContainerStyle={contentContainerStyle}
29
40
  data={data}
@@ -6,10 +6,15 @@ import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
6
6
  * the appropriate style keys into the `contentContainerStyle`
7
7
  */
8
8
  const SimpleStyleSwipeableList = ({ style: styleProp, data, ...rest }) => {
9
- const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp);
9
+ const [measuredWidth, setMeasuredWidth] = React.useState();
10
+ const [measuredHeight, setMeasuredHeight] = React.useState();
11
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(styleProp, measuredWidth, measuredHeight, [data]);
10
12
  return (
11
13
  //@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 }));
14
+ React.createElement(SwipeableList, { onLayout: (event) => {
15
+ setMeasuredWidth(event.nativeEvent.layout.width);
16
+ setMeasuredHeight(event.nativeEvent.layout.height);
17
+ }, style: style, contentContainerStyle: contentContainerStyle, data: data, ...rest }));
13
18
  };
14
19
  export default SimpleStyleSwipeableList;
15
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,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;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"}
@@ -18,12 +18,23 @@ const SimpleStyleSwipeableList = <T extends { [key: string]: any }>({
18
18
  FlashListSwipeableListProps<T> | FlatListSwipeableListProps<T>,
19
19
  "contentContainerStyle"
20
20
  >) => {
21
- const { style, contentContainerStyle } =
22
- useSplitContentContainerStyles(styleProp);
21
+ const [measuredWidth, setMeasuredWidth] = React.useState<number>();
22
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>();
23
+
24
+ const { style, contentContainerStyle } = useSplitContentContainerStyles(
25
+ styleProp,
26
+ measuredWidth,
27
+ measuredHeight,
28
+ [data]
29
+ );
23
30
 
24
31
  return (
25
32
  //@ts-ignore contentContainerStyle has different types for FlashList and FlatList implmentations and confuses TS
26
33
  <SwipeableList
34
+ onLayout={(event) => {
35
+ setMeasuredWidth(event.nativeEvent.layout.width);
36
+ setMeasuredHeight(event.nativeEvent.layout.height);
37
+ }}
27
38
  style={style}
28
39
  contentContainerStyle={contentContainerStyle}
29
40
  data={data}
@@ -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";
@@ -20,12 +21,39 @@ export const contentContainerStyleNames = [
20
21
  "columnGap",
21
22
  "rowGap",
22
23
  ];
23
- export default function useSplitContentContainerStyles(originalStyle) {
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);
24
39
  return useDeepCompareMemo(() => {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25
41
  const flattenedStyle = StyleSheet.flatten(originalStyle);
26
- const contentContainerStyle = pick(flattenedStyle, contentContainerStyleNames);
42
+ let contentContainerStyle = pick(flattenedStyle, contentContainerStyleNames);
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;
27
47
  // contentContainerStyle should always at least fill the parent to ensure sizing changes reflects properly on component and children.
28
- contentContainerStyle.flexGrow = 1;
48
+ // The measured sizes include borders, so we need to subtract those before applying
49
+ if (measuredWidth) {
50
+ contentContainerStyle.minWidth =
51
+ measuredWidth - leftBorderWidth - rightBorderWidth;
52
+ }
53
+ if (measuredHeight) {
54
+ contentContainerStyle.minHeight =
55
+ measuredHeight - topBorderWidth - bottomBorderWidth;
56
+ }
29
57
  let style = omit(flattenedStyle, contentContainerStyleNames);
30
58
  // ScrollView's implementation defaults flexGrow to 1, which prevents the ability to set a static size or use a flex larger than 1
31
59
  // See: https://github.com/facebook/react-native/issues/3422
@@ -37,8 +65,11 @@ export default function useSplitContentContainerStyles(originalStyle) {
37
65
  }
38
66
  return {
39
67
  style,
40
- contentContainerStyle,
68
+ contentContainerStyle: StyleSheet.flatten([
69
+ contentContainerStyle,
70
+ tempContentContainerStyle,
71
+ ]),
41
72
  };
42
- }, [originalStyle]);
73
+ }, [originalStyle, measuredWidth, measuredHeight, tempContentContainerStyle]);
43
74
  }
44
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,CA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AAa,EAAE,aAAa,EAAE,cAAc,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -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";
@@ -28,18 +29,56 @@ export const contentContainerStyleNames = [
28
29
  ];
29
30
 
30
31
  export default function useSplitContentContainerStyles(
31
- originalStyle: StyleProp<ViewStyle>
32
+ originalStyle: StyleProp<ViewStyle>,
33
+ measuredWidth?: number,
34
+ measuredHeight?: number,
35
+ recalculateSizeDeps: React.DependencyList = []
32
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
+
33
55
  return useDeepCompareMemo<Styles>(() => {
34
56
  const flattenedStyle = StyleSheet.flatten(originalStyle);
35
57
 
36
- const contentContainerStyle = pick(
58
+ let contentContainerStyle = pick(
37
59
  flattenedStyle,
38
60
  contentContainerStyleNames
39
61
  );
40
62
 
63
+ const leftBorderWidth =
64
+ flattenedStyle?.borderLeftWidth ?? flattenedStyle?.borderWidth ?? 0;
65
+ const rightBorderWidth =
66
+ flattenedStyle?.borderRightWidth ?? flattenedStyle?.borderWidth ?? 0;
67
+ const topBorderWidth =
68
+ flattenedStyle?.borderTopWidth ?? flattenedStyle?.borderWidth ?? 0;
69
+ const bottomBorderWidth =
70
+ flattenedStyle?.borderBottomWidth ?? flattenedStyle?.borderWidth ?? 0;
71
+
41
72
  // contentContainerStyle should always at least fill the parent to ensure sizing changes reflects properly on component and children.
42
- contentContainerStyle.flexGrow = 1;
73
+ // The measured sizes include borders, so we need to subtract those before applying
74
+ if (measuredWidth) {
75
+ contentContainerStyle.minWidth =
76
+ measuredWidth - leftBorderWidth - rightBorderWidth;
77
+ }
78
+ if (measuredHeight) {
79
+ contentContainerStyle.minHeight =
80
+ measuredHeight - topBorderWidth - bottomBorderWidth;
81
+ }
43
82
 
44
83
  let style = omit(flattenedStyle, contentContainerStyleNames);
45
84
 
@@ -53,7 +92,10 @@ export default function useSplitContentContainerStyles(
53
92
 
54
93
  return {
55
94
  style,
56
- contentContainerStyle,
95
+ contentContainerStyle: StyleSheet.flatten([
96
+ contentContainerStyle,
97
+ tempContentContainerStyle,
98
+ ]),
57
99
  };
58
- }, [originalStyle]);
100
+ }, [originalStyle, measuredWidth, measuredHeight, tempContentContainerStyle]);
59
101
  }