@draftbit/core 48.5.3-75516c.2 → 48.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "48.5.3-75516c.2+75516c5",
3
+ "version": "48.5.3",
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": "^48.5.3-75516c.2+75516c5",
44
+ "@draftbit/types": "48.3.0",
45
45
  "@expo/vector-icons": "^13.0.0",
46
46
  "@material-ui/core": "^4.11.0",
47
47
  "@material-ui/pickers": "^3.2.10",
@@ -102,5 +102,5 @@
102
102
  ],
103
103
  "testEnvironment": "node"
104
104
  },
105
- "gitHead": "75516c54592806dc2d163a47263d9cd23995f23b"
105
+ "gitHead": "8d7f3c8dc6dd4e5b654b80a90073c439eb538835"
106
106
  }
@@ -1,6 +1,27 @@
1
1
  import React from "react";
2
2
  import { View } from "react-native";
3
- const ZStack = ({ reversed, children, ...rest }) => {
3
+ const ZStack = ({ reversed, children, style, ...rest }) => {
4
+ const childSizes = React.useRef(new Map());
5
+ const [maxChildWidth, setMaxChildWidth] = React.useState();
6
+ const [maxChildHeight, setMaxChildHeight] = React.useState();
7
+ const onChildLayout = React.useCallback((index, width, height) => {
8
+ childSizes.current.set(index, {
9
+ width,
10
+ height,
11
+ });
12
+ let maxWidth = 0;
13
+ let maxHeight = 0;
14
+ for (const { width, height } of childSizes.current.values()) {
15
+ if (width > maxWidth) {
16
+ maxWidth = width;
17
+ }
18
+ if (height > maxHeight) {
19
+ maxHeight = height;
20
+ }
21
+ }
22
+ setMaxChildWidth(maxWidth);
23
+ setMaxChildHeight(maxHeight);
24
+ }, [setMaxChildWidth, setMaxChildHeight]);
4
25
  const absoluteChildren = React.useMemo(() => {
5
26
  let childrenArray = React.Children.toArray(children);
6
27
  if (reversed) {
@@ -10,11 +31,28 @@ const ZStack = ({ reversed, children, ...rest }) => {
10
31
  const props = child.props || {};
11
32
  return React.cloneElement(child, {
12
33
  ...props,
34
+ onLayout: (event) => {
35
+ var _a;
36
+ const layout = event.nativeEvent.layout;
37
+ const fullWidth = layout.x + layout.width;
38
+ const fullHeight = layout.y + layout.height;
39
+ onChildLayout(index, fullWidth, fullHeight);
40
+ (_a = props.onLayout) === null || _a === void 0 ? void 0 : _a.call(props, event);
41
+ },
42
+ key: index,
13
43
  style: { position: "absolute", zIndex: index + 1, ...props.style },
14
44
  }, props.children);
15
45
  });
16
- }, [children, reversed]);
17
- return React.createElement(View, { ...rest }, absoluteChildren);
46
+ }, [children, reversed, onChildLayout]);
47
+ React.useEffect(() => {
48
+ childSizes.current.clear();
49
+ }, [absoluteChildren.length]);
50
+ return (React.createElement(View, { style: [
51
+ maxChildWidth && maxChildHeight
52
+ ? { width: maxChildWidth, height: maxChildHeight }
53
+ : {},
54
+ style,
55
+ ], ...rest }, absoluteChildren));
18
56
  };
19
57
  export default ZStack;
20
58
  //# sourceMappingURL=ZStack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZStack.js","sourceRoot":"","sources":["ZStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAM/C,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACxE,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,IAAI,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CACxC,QAAQ,CACe,CAAC;QAE1B,IAAI,QAAQ,EAAE;YACZ,aAAa,GAAG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AAU,CAAC,CAAC;oBAE5C,MAAA,KAAK,CAAC,QAAQ,sDAAG,KAAK,CAAC,CAAC;gBAC1B,CAAC;gBACD,GAAG,EAAE,KAAK;gBACV,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE;aACnE,EACD,KAAK,CAAC,QAAQ,CACf,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAExC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,oBAAC,IAAI,IACH,KAAK,EAAE;YACL,aAAa,IAAI,cAAc;gBAC7B,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE;gBAClD,CAAC,CAAC,EAAE;YACN,KAAK;SACN,KACG,IAAI,IAEP,gBAAgB,CACZ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,11 +1,50 @@
1
1
  import React from "react";
2
- import { View, ViewProps } from "react-native";
2
+ import { View, ViewProps, LayoutChangeEvent } from "react-native";
3
3
 
4
4
  interface ZStackProps extends ViewProps {
5
5
  reversed?: boolean;
6
6
  }
7
7
 
8
- const ZStack: React.FC<ZStackProps> = ({ reversed, children, ...rest }) => {
8
+ interface ChildSize {
9
+ width: number;
10
+ height: number;
11
+ }
12
+
13
+ const ZStack: React.FC<ZStackProps> = ({
14
+ reversed,
15
+ children,
16
+ style,
17
+ ...rest
18
+ }) => {
19
+ const childSizes = React.useRef(new Map<number, ChildSize>());
20
+ const [maxChildWidth, setMaxChildWidth] = React.useState<number>();
21
+ const [maxChildHeight, setMaxChildHeight] = React.useState<number>();
22
+
23
+ const onChildLayout = React.useCallback(
24
+ (index: number, width: number, height: number) => {
25
+ childSizes.current.set(index, {
26
+ width,
27
+ height,
28
+ });
29
+
30
+ let maxWidth = 0;
31
+ let maxHeight = 0;
32
+
33
+ for (const { width, height } of childSizes.current.values()) {
34
+ if (width > maxWidth) {
35
+ maxWidth = width;
36
+ }
37
+ if (height > maxHeight) {
38
+ maxHeight = height;
39
+ }
40
+ }
41
+
42
+ setMaxChildWidth(maxWidth);
43
+ setMaxChildHeight(maxHeight);
44
+ },
45
+ [setMaxChildWidth, setMaxChildHeight]
46
+ );
47
+
9
48
  const absoluteChildren = React.useMemo(() => {
10
49
  let childrenArray = React.Children.toArray(
11
50
  children
@@ -21,14 +60,40 @@ const ZStack: React.FC<ZStackProps> = ({ reversed, children, ...rest }) => {
21
60
  child,
22
61
  {
23
62
  ...props,
63
+ onLayout: (event: LayoutChangeEvent) => {
64
+ const layout = event.nativeEvent.layout;
65
+
66
+ const fullWidth = layout.x + layout.width;
67
+ const fullHeight = layout.y + layout.height;
68
+ onChildLayout(index, fullWidth, fullHeight);
69
+
70
+ props.onLayout?.(event);
71
+ },
72
+ key: index,
24
73
  style: { position: "absolute", zIndex: index + 1, ...props.style },
25
74
  },
26
75
  props.children
27
76
  );
28
77
  });
29
- }, [children, reversed]);
78
+ }, [children, reversed, onChildLayout]);
79
+
80
+ React.useEffect(() => {
81
+ childSizes.current.clear();
82
+ }, [absoluteChildren.length]);
30
83
 
31
- return <View {...rest}>{absoluteChildren}</View>;
84
+ return (
85
+ <View
86
+ style={[
87
+ maxChildWidth && maxChildHeight
88
+ ? { width: maxChildWidth, height: maxChildHeight }
89
+ : {},
90
+ style,
91
+ ]}
92
+ {...rest}
93
+ >
94
+ {absoluteChildren}
95
+ </View>
96
+ );
32
97
  };
33
98
 
34
99
  export default ZStack;
@@ -4,7 +4,7 @@ import { extractStyles } from "../../utilities";
4
4
  const YoutubePlayer = ({ videoId, playlist, autoplay = false, style, }) => {
5
5
  const { viewStyles } = extractStyles(style);
6
6
  const defaultVideoId = "nwMUpDESXrI";
7
- return (React.createElement(YoutubePlayerIFrame, { width: viewStyles.width, height: viewStyles.height, play: autoplay, videoId: !videoId && !playlist ? defaultVideoId : videoId, playList: playlist, webViewStyle: viewStyles }));
7
+ return (React.createElement(YoutubePlayerIFrame, { width: viewStyles.width, height: viewStyles.height, play: autoplay, videoId: !videoId && !playlist ? defaultVideoId : videoId, playList: playlist, webViewStyle: viewStyles, webViewProps: { androidLayerType: "software" } }));
8
8
  };
9
9
  export default YoutubePlayer;
10
10
  //# sourceMappingURL=YoutubePlayer.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"YoutubePlayer.native.js","sourceRoot":"","sources":["YoutubePlayer.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,aAAa,GAAiC,CAAC,EACnD,OAAO,EACP,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,KAAK,GACN,EAAE,EAAE;IACH,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,cAAc,GAAG,aAAa,CAAC;IAErC,OAAO,CACL,oBAAC,mBAAmB,IAClB,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,EACzD,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,UAAU,GACxB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"YoutubePlayer.native.js","sourceRoot":"","sources":["YoutubePlayer.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,aAAa,GAAiC,CAAC,EACnD,OAAO,EACP,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,KAAK,GACN,EAAE,EAAE;IACH,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,cAAc,GAAG,aAAa,CAAC;IAErC,OAAO,CACL,oBAAC,mBAAmB,IAClB,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,EACzD,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAC9C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -20,6 +20,7 @@ const YoutubePlayer: React.FC<YoutubePlayerProps> = ({
20
20
  videoId={!videoId && !playlist ? defaultVideoId : videoId}
21
21
  playList={playlist}
22
22
  webViewStyle={viewStyles}
23
+ webViewProps={{ androidLayerType: "software" }} //Addresses a webview bug causing crashes on android: https://stackoverflow.com/a/71642894/8805150
23
24
  />
24
25
  );
25
26
  };