@tamagui/image 1.72.3 → 1.73.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/dist/cjs/Image.js +3 -3
- package/dist/cjs/Image.js.map +1 -1
- package/dist/cjs/Image.native.js +3 -3
- package/dist/cjs/Image.native.js.map +1 -1
- package/dist/esm/Image.js +4 -4
- package/dist/esm/Image.js.map +1 -1
- package/dist/jsx/Image.js +4 -4
- package/dist/jsx/Image.js.map +1 -1
- package/dist/jsx/Image.native.js +4 -4
- package/dist/jsx/Image.native.js.map +1 -1
- package/package.json +3 -3
- package/src/Image.tsx +24 -4
- package/types/Image.d.ts.map +1 -1
package/dist/cjs/Image.js
CHANGED
|
@@ -29,12 +29,12 @@ const StyledImage = (0, import_core.styled)(import_react_native.Image, {
|
|
|
29
29
|
let hasWarned = !1;
|
|
30
30
|
const Image = StyledImage.extractable(
|
|
31
31
|
(0, import_react.forwardRef)((inProps, ref) => {
|
|
32
|
-
const props = (0, import_core.
|
|
32
|
+
const [props, style] = (0, import_core.usePropsAndStyle)(inProps), { src, source, ...rest } = props;
|
|
33
33
|
process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.warn(
|
|
34
34
|
'React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.'
|
|
35
35
|
)));
|
|
36
|
-
|
|
37
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, { ref, source: finalSource, ...rest });
|
|
36
|
+
let finalSource = typeof src == "string" ? { uri: src, ...import_core.isWeb && { width: props.width, height: props.height } } : source ?? src;
|
|
37
|
+
return finalSource && typeof finalSource == "object" && finalSource.default && (finalSource = finalSource.default), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, { ref, source: finalSource, style, ...rest });
|
|
38
38
|
})
|
|
39
39
|
);
|
|
40
40
|
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U,oBAAAA,MAAQ;AACxB,MAAM,qBAAqB,oBAAAA,MAAQ;AACnC,MAAM,WAAW,oBAAAA,MAAQ;AACzB,MAAM,uBAAuB,oBAAAA,MAAQ;AACrC,MAAM,gBAAgB,oBAAAA,MAAQ;AAC9B,MAAM,aAAa,oBAAAA,MAAQ;",
|
|
5
5
|
"names": ["RNImage"]
|
|
6
6
|
}
|
package/dist/cjs/Image.native.js
CHANGED
|
@@ -30,12 +30,12 @@ const StyledImage = (0, import_core.styled)(import_react_native.Image, {
|
|
|
30
30
|
let hasWarned = !1;
|
|
31
31
|
const Image = StyledImage.extractable(
|
|
32
32
|
(0, import_react.forwardRef)((inProps, ref) => {
|
|
33
|
-
const props = (0, import_core.
|
|
33
|
+
const [props, style] = (0, import_core.usePropsAndStyle)(inProps), { src, source, ...rest } = props;
|
|
34
34
|
process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.warn(
|
|
35
35
|
'React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.'
|
|
36
36
|
)));
|
|
37
|
-
|
|
38
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, { ref, source: finalSource, ...rest });
|
|
37
|
+
let finalSource = typeof src == "string" ? { uri: src, ...import_core.isWeb && { width: props.width, height: props.height } } : source ?? src;
|
|
38
|
+
return finalSource && typeof finalSource == "object" && (Array.isArray(finalSource) || typeof finalSource.uri == "number" && (finalSource = finalSource.uri, source && typeof source == "object" && !Array.isArray(source) && (style.width ??= source.width, style.height ??= source.height)), finalSource.default && (finalSource = finalSource.default)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, { ref, source: finalSource, style, ...rest });
|
|
39
39
|
})
|
|
40
40
|
);
|
|
41
41
|
Image.getSize = import_react_native.Image.getSize;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version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AU,QAAQ,aAAa,OAAe,GAAI,MAAc;AAAA,EACtF,CAAC;AACH;AAEA,MAAM,UAAU,oBAAAA,MAAQ;AACxB,MAAM,qBAAqB,oBAAAA,MAAQ;AACnC,MAAM,WAAW,oBAAAA,MAAQ;AACzB,MAAM,uBAAuB,oBAAAA,MAAQ;AACrC,MAAM,gBAAgB,oBAAAA,MAAQ;AAC9B,MAAM,aAAa,oBAAAA,MAAQ;",
|
|
5
5
|
"names": ["RNImage"]
|
|
6
6
|
}
|
package/dist/esm/Image.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isWeb,
|
|
3
3
|
setupReactNative,
|
|
4
4
|
styled,
|
|
5
|
-
|
|
5
|
+
usePropsAndStyle
|
|
6
6
|
} from "@tamagui/core";
|
|
7
7
|
import { forwardRef } from "react";
|
|
8
8
|
import { Image as RNImage } from "react-native";
|
|
@@ -18,12 +18,12 @@ const StyledImage = styled(RNImage, {
|
|
|
18
18
|
let hasWarned = !1;
|
|
19
19
|
const Image = StyledImage.extractable(
|
|
20
20
|
forwardRef((inProps, ref) => {
|
|
21
|
-
const props =
|
|
21
|
+
const [props, style] = usePropsAndStyle(inProps), { src, source, ...rest } = props;
|
|
22
22
|
process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.warn(
|
|
23
23
|
'React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.'
|
|
24
24
|
)));
|
|
25
|
-
|
|
26
|
-
return /* @__PURE__ */ jsx(StyledImage, { ref, source: finalSource, ...rest });
|
|
25
|
+
let finalSource = typeof src == "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : source ?? src;
|
|
26
|
+
return finalSource && typeof finalSource == "object" && finalSource.default && (finalSource = finalSource.default), /* @__PURE__ */ jsx(StyledImage, { ref, source: finalSource, style, ...rest });
|
|
27
27
|
})
|
|
28
28
|
);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,MAAM,UAAU,QAAQ;AACxB,MAAM,qBAAqB,QAAQ;AACnC,MAAM,WAAW,QAAQ;AACzB,MAAM,uBAAuB,QAAQ;AACrC,MAAM,gBAAgB,QAAQ;AAC9B,MAAM,aAAa,QAAQ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/jsx/Image.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isWeb,
|
|
3
3
|
setupReactNative,
|
|
4
4
|
styled,
|
|
5
|
-
|
|
5
|
+
usePropsAndStyle
|
|
6
6
|
} from "@tamagui/core";
|
|
7
7
|
import { forwardRef } from "react";
|
|
8
8
|
import { Image as RNImage } from "react-native";
|
|
@@ -17,12 +17,12 @@ const StyledImage = styled(RNImage, {
|
|
|
17
17
|
let hasWarned = !1;
|
|
18
18
|
const Image = StyledImage.extractable(
|
|
19
19
|
forwardRef((inProps, ref) => {
|
|
20
|
-
const props =
|
|
20
|
+
const [props, style] = usePropsAndStyle(inProps), { src, source, ...rest } = props;
|
|
21
21
|
process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.warn(
|
|
22
22
|
'React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.'
|
|
23
23
|
)));
|
|
24
|
-
|
|
25
|
-
return <StyledImage ref={ref} source={finalSource} {...rest} />;
|
|
24
|
+
let finalSource = typeof src == "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : source ?? src;
|
|
25
|
+
return finalSource && typeof finalSource == "object" && finalSource.default && (finalSource = finalSource.default), <StyledImage ref={ref} source={finalSource} style={style} {...rest} />;
|
|
26
26
|
})
|
|
27
27
|
);
|
|
28
28
|
Image.getSize = RNImage.getSize;
|
package/dist/jsx/Image.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src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,cAAc,YAAY,UAKvB,CAAC,YAAY,KAAK,KAAK,QAAQ,aAAa,OAAO,WAAY,MAAc;AAAA,EACtF,CAAC;AACH;AAEA,MAAM,UAAU,QAAQ;AACxB,MAAM,qBAAqB,QAAQ;AACnC,MAAM,WAAW,QAAQ;AACzB,MAAM,uBAAuB,QAAQ;AACrC,MAAM,gBAAgB,QAAQ;AAC9B,MAAM,aAAa,QAAQ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/jsx/Image.native.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isWeb,
|
|
3
3
|
setupReactNative,
|
|
4
4
|
styled,
|
|
5
|
-
|
|
5
|
+
usePropsAndStyle
|
|
6
6
|
} from "@tamagui/core";
|
|
7
7
|
import { forwardRef } from "react";
|
|
8
8
|
import { Image as RNImage } from "react-native";
|
|
@@ -17,12 +17,12 @@ const StyledImage = styled(RNImage, {
|
|
|
17
17
|
let hasWarned = !1;
|
|
18
18
|
const Image = StyledImage.extractable(
|
|
19
19
|
forwardRef((inProps, ref) => {
|
|
20
|
-
const props =
|
|
20
|
+
const [props, style] = usePropsAndStyle(inProps), { src, source, ...rest } = props;
|
|
21
21
|
process.env.NODE_ENV === "development" && typeof src == "string" && (typeof props.width == "string" && props.width[0] !== "$" || typeof props.height == "string" && props.height[0] !== "$") && (hasWarned || (hasWarned = !0, console.warn(
|
|
22
22
|
'React Native expects a numerical width/height. If you want to use a percent you must define the "source" prop with width, height, and uri.'
|
|
23
23
|
)));
|
|
24
|
-
|
|
25
|
-
return <StyledImage ref={ref} source={finalSource} {...rest} />;
|
|
24
|
+
let finalSource = typeof src == "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : source ?? src;
|
|
25
|
+
return finalSource && typeof finalSource == "object" && (Array.isArray(finalSource) || typeof finalSource.uri == "number" && (finalSource = finalSource.uri, source && typeof source == "object" && !Array.isArray(source) && (style.width ??= source.width, style.height ??= source.height)), finalSource.default && (finalSource = finalSource.default)), <StyledImage ref={ref} source={finalSource} style={style} {...rest} />;
|
|
26
26
|
})
|
|
27
27
|
);
|
|
28
28
|
Image.getSize = RNImage.getSize;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Image.tsx"],
|
|
4
|
-
"mappings": "AAAA;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,kBAAkB;AAClC,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AACpB,CAAC;AA6BD,IAAI,YAAY;AAET,MAAM,QAAQ,YAAY;AAAA,EAC/B,WAAW,CAAC,SAAqB,QAAQ;AACvC,UAAM,
|
|
4
|
+
"mappings": "AAAA;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,kBAAkB;AAClC,SAAS,SAAS,eAAe;AAEjC,iBAAiB;AAAA,EACf,OAAO;AACT,CAAC;AAED,MAAM,cAAc,OAAO,SAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AACpB,CAAC;AA6BD,IAAI,YAAY;AAET,MAAM,QAAQ,YAAY;AAAA,EAC/B,WAAW,CAAC,SAAqB,QAAQ;AACvC,UAAM,CAAC,OAAO,KAAK,IAAI,iBAAiB,OAAO,GACzC,EAAE,KAAK,QAAQ,GAAG,KAAK,IAAI;AAEjC,IAAI,QAAQ,IAAI,aAAa,iBACvB,OAAO,OAAQ,aAEd,OAAO,MAAM,SAAU,YAAY,MAAM,MAAM,CAAC,MAAM,OACtD,OAAO,MAAM,UAAW,YAAY,MAAM,OAAO,CAAC,MAAM,SAEpD,cACH,YAAY,IACZ,QAAQ;AAAA,MACN;AAAA,IACF;AAMR,QAAI,cACF,OAAO,OAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE,UAAU;AAEhB,WAAI,eAAe,OAAO,eAAgB,aAGjC,MAAM,QAAQ,WAAW,KACxB,OAAO,YAAY,OAAQ,aAC7B,cAAc,YAAY,KACtB,UAAU,OAAO,UAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,MAC/D,MAAM,UAAU,OAAO,OACvB,MAAM,WAAW,OAAO,UAO5B,YAAY,YACd,cAAc,YAAY,WAKvB,CAAC,YAAY,KAAK,KAAK,QAAQ,aAAa,OAAO,WAAY,MAAc;AAAA,EACtF,CAAC;AACH;AAEA,MAAM,UAAU,QAAQ;AACxB,MAAM,qBAAqB,QAAQ;AACnC,MAAM,WAAW,QAAQ;AACzB,MAAM,uBAAuB,QAAQ;AACrC,MAAM,gBAAgB,QAAQ;AAC9B,MAAM,aAAa,QAAQ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/image",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.73.1",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"clean:build": "tamagui-build clean:build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tamagui/core": "1.
|
|
26
|
+
"@tamagui/core": "1.73.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-native": "*"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "1.
|
|
33
|
+
"@tamagui/build": "1.73.1",
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-native": "^0.72.1"
|
|
36
36
|
},
|
package/src/Image.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isWeb,
|
|
8
8
|
setupReactNative,
|
|
9
9
|
styled,
|
|
10
|
-
|
|
10
|
+
usePropsAndStyle,
|
|
11
11
|
} from '@tamagui/core'
|
|
12
12
|
import React, { forwardRef } from 'react'
|
|
13
13
|
import { Image as RNImage } from 'react-native'
|
|
@@ -53,7 +53,7 @@ let hasWarned = false
|
|
|
53
53
|
|
|
54
54
|
export const Image = StyledImage.extractable(
|
|
55
55
|
forwardRef((inProps: ImageProps, ref) => {
|
|
56
|
-
const props =
|
|
56
|
+
const [props, style] = usePropsAndStyle(inProps)
|
|
57
57
|
const { src, source, ...rest } = props
|
|
58
58
|
|
|
59
59
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -72,13 +72,33 @@ export const Image = StyledImage.extractable(
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
let finalSource =
|
|
76
76
|
typeof src === 'string'
|
|
77
77
|
? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }
|
|
78
78
|
: source ?? src
|
|
79
79
|
|
|
80
|
+
if (finalSource && typeof finalSource === 'object') {
|
|
81
|
+
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
82
|
+
// fix: normalize import style images
|
|
83
|
+
if (!Array.isArray(finalSource)) {
|
|
84
|
+
if (typeof finalSource.uri === 'number') {
|
|
85
|
+
finalSource = finalSource.uri
|
|
86
|
+
if (source && typeof source === 'object' && !Array.isArray(source)) {
|
|
87
|
+
style.width ??= source.width
|
|
88
|
+
style.height ??= source.height
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// require compat across native/web
|
|
95
|
+
if (finalSource['default']) {
|
|
96
|
+
finalSource = finalSource['default']
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
80
100
|
// must set defaultSource to allow SSR, default it to the same as src
|
|
81
|
-
return <StyledImage ref={ref} source={finalSource} {...(rest as any)} />
|
|
101
|
+
return <StyledImage ref={ref} source={finalSource} style={style} {...(rest as any)} />
|
|
82
102
|
})
|
|
83
103
|
) as any as ImageType
|
|
84
104
|
|
package/types/Image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAKnB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAM/C,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAIf,CAAA;AAEF,KAAK,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,WAAW,CAAC,EAAE,cAAc,CAAC,GAAG;IAC3E,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,KAAK,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IACnF,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,kBAAkB,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,kBAAkB,CAAA;IAE1D;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAA;AAEtE,KAAK,WAAW,GAAG,OAAO,OAAO,CAAA;AAEjC,KAAK,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,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