@draftbit/core 50.6.4-d8eff0.2 → 50.6.4-e0ee73.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "50.6.4-d8eff0.2+d8eff0f",
3
+ "version": "50.6.4-e0ee73.2+e0ee730",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/src/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@dotlottie/react-player": "1.6.1",
44
44
  "@draftbit/react-theme-provider": "^2.1.1",
45
- "@draftbit/theme": "^50.6.4-d8eff0.2+d8eff0f",
45
+ "@draftbit/theme": "^50.6.4-e0ee73.2+e0ee730",
46
46
  "@expo/vector-icons": "^14.0.0",
47
47
  "@gorhom/bottom-sheet": "5.0.0-alpha.7",
48
48
  "@lottiefiles/react-lottie-player": "3.5.3",
@@ -123,5 +123,5 @@
123
123
  ],
124
124
  "testEnvironment": "node"
125
125
  },
126
- "gitHead": "d8eff0f36889ae8e9532c4017cd46ca5a2cec401"
126
+ "gitHead": "e0ee7302ce74320ee32ee93fafe04c2eb5fa2258"
127
127
  }
@@ -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 = {
@@ -37,28 +12,17 @@ const resizeModeToContentFit = (resizeMode) => {
37
12
  };
38
13
  return (_a = mapping[resizeMode]) !== null && _a !== void 0 ? _a : "cover";
39
14
  };
40
- const ExpoImage = ({ source, resizeMode = "cover", style, transition = 300, contentFit = "cover", contentPosition = "center", cachePolicy = "memory-disk", allowDownscaling = true, blurRadius, blurhash, ...props }) => {
41
- let imageSource = source === null || source === undefined
42
- ? Config.placeholderImageURL
43
- : source;
44
- const styles = StyleSheet.flatten(style || {});
45
- const { aspectRatio, width, height } = generateDimensions(styles);
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 }) => {
16
+ const imageSource = source !== null && source !== void 0 ? source : Config.placeholderImageURL;
46
17
  const finalContentFit = resizeMode
47
18
  ? resizeModeToContentFit(resizeMode)
48
19
  : contentFit;
49
- if (aspectRatio) {
50
- return (React.createElement(AspectRatio, { style: [style, { width, height, aspectRatio }] },
51
- React.createElement(Image, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: {
52
- blurhash,
53
- }, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, blurRadius: blurRadius, style: [
54
- style,
55
- {
56
- height: "100%",
57
- width: "100%",
58
- },
59
- ] })));
60
- }
61
- return (React.createElement(Image, { ...props, source: source, contentFit: finalContentFit, placeholder: {
20
+ const transition = {
21
+ timing: transitionTiming,
22
+ duration: transitionDuration,
23
+ effect: transitionEffect,
24
+ };
25
+ return (React.createElement(Image, { ...props, source: imageSource, contentFit: finalContentFit, placeholder: {
62
26
  blurhash,
63
27
  }, transition: transition, contentPosition: contentPosition, cachePolicy: cachePolicy, allowDownscaling: allowDownscaling, blurRadius: blurRadius, style: style }));
64
28
  };
@@ -1 +1 @@
1
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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,29 +6,18 @@ 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
- transition?:
20
- | number
21
- | {
22
- duration?: number;
23
- effect?:
24
- | "cross-dissolve"
25
- | "flip-from-top"
26
- | "flip-from-right"
27
- | "flip-from-bottom"
28
- | "flip-from-left"
29
- | "curl-up"
30
- | "curl-down";
31
- timing?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
32
- };
11
+ transitionDuration?: number;
12
+ transitionEffect?:
13
+ | "cross-dissolve"
14
+ | "flip-from-top"
15
+ | "flip-from-right"
16
+ | "flip-from-bottom"
17
+ | "flip-from-left"
18
+ | "curl-up"
19
+ | "curl-down";
20
+ transitionTiming?: "ease-in-out" | "ease-in" | "ease-out" | "linear";
33
21
  contentFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
34
22
  contentPosition?: ImageContentPosition;
35
23
  cachePolicy?: "none" | "disk" | "memory" | "memory-disk";
@@ -38,41 +26,6 @@ interface ExtendedImageProps extends ExpoImageProps {
38
26
  blurhash?: string;
39
27
  }
40
28
 
41
- const generateDimensions = ({
42
- aspectRatio,
43
- width,
44
- height,
45
- }: ImageStyleProp): {
46
- aspectRatio?: number;
47
- width?: DimensionValue;
48
- height?: DimensionValue;
49
- } => {
50
- if (aspectRatio && !width && !height) {
51
- return {
52
- aspectRatio,
53
- width: "100%",
54
- };
55
- }
56
-
57
- if (aspectRatio && height) {
58
- return {
59
- aspectRatio,
60
- height,
61
- width: aspectRatio * height,
62
- };
63
- }
64
-
65
- if (aspectRatio && width) {
66
- return {
67
- aspectRatio,
68
- width,
69
- height: width / aspectRatio,
70
- };
71
- }
72
-
73
- return { width, height };
74
- };
75
-
76
29
  const resizeModeToContentFit = (
77
30
  resizeMode: "cover" | "contain" | "stretch" | "repeat" | "center"
78
31
  ): ImageContentFit => {
@@ -90,7 +43,9 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
90
43
  source,
91
44
  resizeMode = "cover",
92
45
  style,
93
- transition = 300,
46
+ transitionDuration = 300,
47
+ transitionEffect = "cross-dissolve",
48
+ transitionTiming = "ease-in-out",
94
49
  contentFit = "cover",
95
50
  contentPosition = "center",
96
51
  cachePolicy = "memory-disk",
@@ -99,51 +54,21 @@ const ExpoImage: React.FC<ExtendedImageProps> = ({
99
54
  blurhash,
100
55
  ...props
101
56
  }) => {
102
- let imageSource =
103
- source === null || source === undefined
104
- ? Config.placeholderImageURL
105
- : source;
106
-
107
- const styles = StyleSheet.flatten(style || {});
108
- const { aspectRatio, width, height } = generateDimensions(
109
- styles as ImageStyleProp
110
- );
111
-
57
+ const imageSource = source ?? Config.placeholderImageURL;
112
58
  const finalContentFit = resizeMode
113
59
  ? resizeModeToContentFit(resizeMode)
114
60
  : contentFit;
115
61
 
116
- if (aspectRatio) {
117
- return (
118
- <AspectRatio style={[style, { width, height, aspectRatio }]}>
119
- <Image
120
- {...props}
121
- source={imageSource as ImageSourcePropType}
122
- contentFit={finalContentFit}
123
- placeholder={{
124
- blurhash,
125
- }}
126
- transition={transition}
127
- contentPosition={contentPosition}
128
- cachePolicy={cachePolicy}
129
- allowDownscaling={allowDownscaling}
130
- blurRadius={blurRadius}
131
- style={[
132
- style,
133
- {
134
- height: "100%",
135
- width: "100%",
136
- },
137
- ]}
138
- />
139
- </AspectRatio>
140
- );
141
- }
62
+ const transition = {
63
+ timing: transitionTiming,
64
+ duration: transitionDuration,
65
+ effect: transitionEffect,
66
+ };
142
67
 
143
68
  return (
144
69
  <Image
145
70
  {...props}
146
- source={source as ImageSourcePropType}
71
+ source={imageSource}
147
72
  contentFit={finalContentFit}
148
73
  placeholder={{
149
74
  blurhash,