@draftbit/core 51.0.1-e67e91.2 → 51.0.1

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": "51.0.1-e67e91.2+e67e913",
3
+ "version": "51.0.1",
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
  "@dotlottie/react-player": "1.6.1",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/theme": "^51.0.1-e67e91.2+e67e913",
44
+ "@draftbit/theme": "51.0.1",
45
45
  "@emotion/react": "^11.13.5",
46
46
  "@emotion/styled": "^11.13.5",
47
47
  "@expo/vector-icons": "^14.0.3",
@@ -118,5 +118,5 @@
118
118
  ],
119
119
  "testEnvironment": "node"
120
120
  },
121
- "gitHead": "e67e91363c34a158ba92ffe2ff3225b12eaf8283"
121
+ "gitHead": "1986bc3c0d34b6f5ee88ad8941e375971422d180"
122
122
  }
@@ -1,31 +1,6 @@
1
1
  import React from "react";
2
- import { StyleSheet } from "react-native";
3
2
  import { Image, } from "expo-image";
4
3
  import Config from "./Config";
5
- import AspectRatio from "./AspectRatio";
6
- const generateDimensions = ({ aspectRatio, width, height, }) => {
7
- if (aspectRatio && !width && !height) {
8
- return {
9
- aspectRatio,
10
- width: "100%",
11
- };
12
- }
13
- if (aspectRatio && height) {
14
- return {
15
- aspectRatio,
16
- height,
17
- width: aspectRatio * height,
18
- };
19
- }
20
- if (aspectRatio && width) {
21
- return {
22
- aspectRatio,
23
- width,
24
- height: width / aspectRatio,
25
- };
26
- }
27
- return { width, height };
28
- };
29
4
  const resizeModeToContentFit = (resizeMode) => {
30
5
  var _a;
31
6
  const mapping = {
@@ -38,11 +13,7 @@ const resizeModeToContentFit = (resizeMode) => {
38
13
  return (_a = mapping[resizeMode]) !== null && _a !== void 0 ? _a : "cover";
39
14
  };
40
15
  const ExpoImage = ({ source, resizeMode = "cover", style, transitionDuration = 300, transitionEffect = "cross-dissolve", transitionTiming = "ease-in-out", contentFit = "cover", contentPosition = "center", cachePolicy = "memory-disk", allowDownscaling = true, blurRadius, blurhash, ...props }) => {
41
- const imageSource = source === null || source === undefined
42
- ? Config.placeholderImageURL
43
- : source;
44
- const styles = StyleSheet.flatten(style || {});
45
- const { aspectRatio, width, height } = generateDimensions(styles);
16
+ const imageSource = source !== null && source !== void 0 ? source : Config.placeholderImageURL;
46
17
  const finalContentFit = resizeMode
47
18
  ? resizeModeToContentFit(resizeMode)
48
19
  : contentFit;
@@ -51,19 +22,7 @@ const ExpoImage = ({ source, resizeMode = "cover", style, transitionDuration = 3
51
22
  duration: transitionDuration,
52
23
  effect: transitionEffect,
53
24
  };
54
- if (aspectRatio) {
55
- return (React.createElement(AspectRatio, { style: [style, { width, height, aspectRatio }] },
56
- React.createElement(Image, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: {
57
- blurhash,
58
- }, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, blurRadius: blurRadius, style: [
59
- style,
60
- {
61
- height: "100%",
62
- width: "100%",
63
- },
64
- ] })));
65
- }
66
- return (React.createElement(Image, { ...props, source: source, contentFit: finalContentFit, placeholder: {
25
+ return (React.createElement(Image, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: {
67
26
  blurhash,
68
27
  }, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, blurRadius: blurRadius, style: style }));
69
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoImage.js","sourceRoot":"","sources":["ExpoImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAuC,MAAM,cAAc,CAAC;AAC/E,OAAO,EACL,KAAK,GAI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,kBAAkB;QAC5B,MAAM,EAAE,gBAAgB;KACzB,CAAC;IAEF,OAAO,CACL,oBAAC,KAAK,OACA,KAAK,EACT,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,eAAe,EAC3B,WAAW,EAAE;YACX,QAAQ;SACT,EACD,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import { StyleSheet, ImageSourcePropType, DimensionValue } from "react-native";
3
2
  import {
4
3
  Image,
5
4
  ImageContentPosition,
@@ -7,13 +6,6 @@ import {
7
6
  ImageContentFit,
8
7
  } from "expo-image";
9
8
  import Config from "./Config";
10
- import AspectRatio from "./AspectRatio";
11
-
12
- type ImageStyleProp = {
13
- width?: number;
14
- height?: number;
15
- aspectRatio?: number;
16
- };
17
9
 
18
10
  interface ExtendedImageProps extends ExpoImageProps {
19
11
  transitionDuration?: number;
@@ -34,41 +26,6 @@ interface ExtendedImageProps extends ExpoImageProps {
34
26
  blurhash?: string;
35
27
  }
36
28
 
37
- const generateDimensions = ({
38
- aspectRatio,
39
- width,
40
- height,
41
- }: ImageStyleProp): {
42
- aspectRatio?: number;
43
- width?: DimensionValue;
44
- height?: DimensionValue;
45
- } => {
46
- if (aspectRatio && !width && !height) {
47
- return {
48
- aspectRatio,
49
- width: "100%",
50
- };
51
- }
52
-
53
- if (aspectRatio && height) {
54
- return {
55
- aspectRatio,
56
- height,
57
- width: aspectRatio * height,
58
- };
59
- }
60
-
61
- if (aspectRatio && width) {
62
- return {
63
- aspectRatio,
64
- width,
65
- height: width / aspectRatio,
66
- };
67
- }
68
-
69
- return { width, height };
70
- };
71
-
72
29
  const resizeModeToContentFit = (
73
30
  resizeMode: "cover" | "contain" | "stretch" | "repeat" | "center"
74
31
  ): ImageContentFit => {
@@ -97,16 +54,7 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
97
54
  blurhash,
98
55
  ...props
99
56
  }) => {
100
- const imageSource =
101
- source === null || source === undefined
102
- ? Config.placeholderImageURL
103
- : source;
104
-
105
- const styles = StyleSheet.flatten(style || {});
106
- const { aspectRatio, width, height } = generateDimensions(
107
- styles as ImageStyleProp
108
- );
109
-
57
+ const imageSource = source ?? Config.placeholderImageURL;
110
58
  const finalContentFit = resizeMode
111
59
  ? resizeModeToContentFit(resizeMode)
112
60
  : contentFit;
@@ -117,37 +65,10 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
117
65
  effect: transitionEffect,
118
66
  };
119
67
 
120
- if (aspectRatio) {
121
- return (
122
- <AspectRatio style={[style, { width, height, aspectRatio }]}>
123
- <Image
124
- {...props}
125
- source={imageSource as ImageSourcePropType}
126
- contentFit={finalContentFit}
127
- placeholder={{
128
- blurhash,
129
- }}
130
- transition={transition}
131
- contentPosition={contentPosition}
132
- cachePolicy={cachePolicy}
133
- allowDownscaling={allowDownscaling}
134
- blurRadius={blurRadius}
135
- style={[
136
- style,
137
- {
138
- height: "100%",
139
- width: "100%",
140
- },
141
- ]}
142
- />
143
- </AspectRatio>
144
- );
145
- }
146
-
147
68
  return (
148
69
  <Image
149
70
  {...props}
150
- source={source as ImageSourcePropType}
71
+ source={imageSource}
151
72
  contentFit={finalContentFit}
152
73
  placeholder={{
153
74
  blurhash,