@tamagui/image 1.0.1-beta.98 → 1.0.1-rc.0
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 +11 -46
- package/dist/cjs/Image.js.map +3 -3
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/Image.js +16 -46
- package/dist/esm/Image.js.map +2 -2
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/jsx/Image.js +12 -12
- package/dist/jsx/Image.js.map +2 -2
- package/dist/jsx/index.js +0 -0
- package/dist/jsx/index.js.map +1 -1
- package/package.json +7 -5
- package/src/Image.tsx +25 -32
- package/types/Image.d.ts +3 -3
- package/types/index.d.ts +0 -0
- package/types/Image.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
package/dist/cjs/Image.js
CHANGED
|
@@ -1,38 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
6
|
var __export = (target, all) => {
|
|
37
7
|
for (var name in all)
|
|
38
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -45,37 +15,32 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
45
15
|
}
|
|
46
16
|
return to;
|
|
47
17
|
};
|
|
48
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
49
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
50
19
|
var Image_exports = {};
|
|
51
20
|
__export(Image_exports, {
|
|
52
21
|
Image: () => Image
|
|
53
22
|
});
|
|
54
23
|
module.exports = __toCommonJS(Image_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
25
|
var import_core = require("@tamagui/core");
|
|
56
|
-
var import_react = __toESM(require("react"));
|
|
57
26
|
var import_react_native = require("react-native");
|
|
58
|
-
|
|
27
|
+
(0, import_core.setupReactNative)({
|
|
28
|
+
Image: import_react_native.Image
|
|
29
|
+
});
|
|
59
30
|
const StyledImage = (0, import_core.styled)(import_react_native.Image, {
|
|
60
31
|
name: "Image",
|
|
61
32
|
position: "relative",
|
|
62
33
|
source: { uri: "" },
|
|
63
34
|
zIndex: 1
|
|
64
|
-
}, {
|
|
65
|
-
inlineProps: /* @__PURE__ */ new Set(["src", "width", "height"])
|
|
66
35
|
});
|
|
67
36
|
const Image = StyledImage.extractable((inProps) => {
|
|
68
37
|
const props = (0, import_core.getExpandedShorthands)(inProps);
|
|
69
|
-
const
|
|
70
|
-
const source = typeof src === "string" ?
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
return /* @__PURE__ */ import_react.default.createElement(StyledImage, __spreadValues(__spreadProps(__spreadValues({}, !import_core.isWeb && { style: { width, height } }), {
|
|
76
|
-
defaultSource,
|
|
77
|
-
source
|
|
78
|
-
}), rest));
|
|
38
|
+
const { src, ...rest } = props;
|
|
39
|
+
const source = typeof src === "string" ? { uri: src, ...import_core.isWeb && { width: props.width, height: props.height } } : src;
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledImage, {
|
|
41
|
+
source,
|
|
42
|
+
...rest
|
|
43
|
+
});
|
|
79
44
|
});
|
|
80
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
46
|
0 && (module.exports = {
|
package/dist/cjs/Image.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Image.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n StackProps,\n getExpandedShorthands,\n isWeb,\n setupReactNative,\n styled,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCS;AAzCT,kBAOO;AAEP,0BAAiC;AAAA,IAEjC,8BAAiB;AAAA,EACf,OAAO,oBAAAA;AACT,CAAC;AAED,MAAM,kBAAc,oBAAO,oBAAAA,OAAS;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ,EAAE,KAAK,GAAG;AAAA,EAClB,QAAQ;AACV,CAAC;AAYM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,YAAQ,mCAAsB,OAAO;AAC3C,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,qBAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,4CAAC;AAAA,IAAY;AAAA,IAAiB,GAAI;AAAA,GAAc;AACzD,CAAC;",
|
|
6
|
+
"names": ["RNImage"]
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
package/dist/cjs/index.js.map
CHANGED
package/dist/esm/Image.js
CHANGED
|
@@ -1,58 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { getExpandedShorthands, isWeb, styled } from "@tamagui/core";
|
|
33
|
-
import React from "react";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
getExpandedShorthands,
|
|
4
|
+
isWeb,
|
|
5
|
+
setupReactNative,
|
|
6
|
+
styled
|
|
7
|
+
} from "@tamagui/core";
|
|
34
8
|
import { Image as RNImage } from "react-native";
|
|
35
|
-
|
|
9
|
+
setupReactNative({
|
|
10
|
+
Image: RNImage
|
|
11
|
+
});
|
|
36
12
|
const StyledImage = styled(RNImage, {
|
|
37
13
|
name: "Image",
|
|
38
14
|
position: "relative",
|
|
39
15
|
source: { uri: "" },
|
|
40
16
|
zIndex: 1
|
|
41
|
-
}, {
|
|
42
|
-
inlineProps: /* @__PURE__ */ new Set(["src", "width", "height"])
|
|
43
17
|
});
|
|
44
18
|
const Image = StyledImage.extractable((inProps) => {
|
|
45
19
|
const props = getExpandedShorthands(inProps);
|
|
46
|
-
const
|
|
47
|
-
const source = typeof src === "string" ?
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
return /* @__PURE__ */ React.createElement(StyledImage, __spreadValues(__spreadProps(__spreadValues({}, !isWeb && { style: { width, height } }), {
|
|
53
|
-
defaultSource,
|
|
54
|
-
source
|
|
55
|
-
}), rest));
|
|
20
|
+
const { src, ...rest } = props;
|
|
21
|
+
const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
|
|
22
|
+
return /* @__PURE__ */ jsx(StyledImage, {
|
|
23
|
+
source,
|
|
24
|
+
...rest
|
|
25
|
+
});
|
|
56
26
|
});
|
|
57
27
|
export {
|
|
58
28
|
Image
|
package/dist/esm/Image.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Image.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n StackProps,\n getExpandedShorthands,\n isWeb,\n setupReactNative,\n styled,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
|
|
5
|
+
"mappings": "AAyCS;AAzCT;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,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;AAAA,EAClB,QAAQ;AACV,CAAC;AAYM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,sBAAsB,OAAO;AAC3C,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,oBAAC;AAAA,IAAY;AAAA,IAAiB,GAAI;AAAA,GAAc;AACzD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
File without changes
|
package/dist/esm/index.js.map
CHANGED
package/dist/jsx/Image.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
getExpandedShorthands,
|
|
3
|
+
isWeb,
|
|
4
|
+
setupReactNative,
|
|
5
|
+
styled
|
|
6
|
+
} from "@tamagui/core";
|
|
3
7
|
import { Image as RNImage } from "react-native";
|
|
4
|
-
|
|
8
|
+
setupReactNative({
|
|
9
|
+
Image: RNImage
|
|
10
|
+
});
|
|
5
11
|
const StyledImage = styled(RNImage, {
|
|
6
12
|
name: "Image",
|
|
7
13
|
position: "relative",
|
|
8
14
|
source: { uri: "" },
|
|
9
15
|
zIndex: 1
|
|
10
|
-
}, {
|
|
11
|
-
inlineProps: /* @__PURE__ */ new Set(["src", "width", "height"])
|
|
12
16
|
});
|
|
13
17
|
const Image = StyledImage.extractable((inProps) => {
|
|
14
18
|
const props = getExpandedShorthands(inProps);
|
|
15
|
-
const { src,
|
|
16
|
-
const source = typeof src === "string" ? { uri: src, ...isWeb && { width, height } } : src;
|
|
17
|
-
|
|
18
|
-
if (!defaultSource) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return <StyledImage {...!isWeb && { style: { width, height } }} defaultSource={defaultSource} source={source} {...rest} />;
|
|
19
|
+
const { src, ...rest } = props;
|
|
20
|
+
const source = typeof src === "string" ? { uri: src, ...isWeb && { width: props.width, height: props.height } } : src;
|
|
21
|
+
return <StyledImage source={source} {...rest} />;
|
|
22
22
|
});
|
|
23
23
|
export {
|
|
24
24
|
Image
|
package/dist/jsx/Image.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Image.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA;
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n StackProps,\n getExpandedShorthands,\n isWeb,\n setupReactNative,\n styled,\n} from '@tamagui/core'\nimport React from 'react'\nimport { Image as RNImage } from 'react-native'\n\nsetupReactNative({\n Image: RNImage,\n})\n\nconst StyledImage = styled(RNImage, {\n name: 'Image',\n position: 'relative',\n source: { uri: '' },\n zIndex: 1,\n})\n\ntype StyledImageProps = GetProps<typeof StyledImage>\n\ntype BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {\n width: number | string\n height: number | string\n src: string | StyledImageProps['source']\n}\n\nexport type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>\n\nexport const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {\n const props = getExpandedShorthands(inProps)\n const { src, ...rest } = props\n const source =\n typeof src === 'string'\n ? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }\n : src\n\n // must set defaultSource to allow SSR, default it to the same as src\n return <StyledImage source={source} {...(rest as any)} />\n})\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,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;AAAA,EAClB,QAAQ;AACV,CAAC;AAYM,MAAM,QAA8B,YAAY,YAAY,CAAC,YAAY;AAC9E,QAAM,QAAQ,sBAAsB,OAAO;AAC3C,QAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,QAAM,SACJ,OAAO,QAAQ,WACX,EAAE,KAAK,KAAK,GAAI,SAAS,EAAE,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,EAAG,IACvE;AAGN,SAAO,CAAC,YAAY,QAAQ,YAAa,MAAc;AACzD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/index.js
CHANGED
|
File without changes
|
package/dist/jsx/index.js.map
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/image",
|
|
3
|
-
"version": "1.0.1-
|
|
3
|
+
"version": "1.0.1-rc.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -17,19 +17,21 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tamagui-build",
|
|
19
19
|
"watch": "tamagui-build --watch",
|
|
20
|
+
"lint": "eslint src",
|
|
21
|
+
"lint:fix": "yarn lint --fix",
|
|
20
22
|
"clean": "tamagui-build clean",
|
|
21
23
|
"clean:build": "tamagui-build clean:build"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
|
-
"@tamagui/core": "^1.0.1-
|
|
26
|
+
"@tamagui/core": "^1.0.1-rc.0"
|
|
25
27
|
},
|
|
26
28
|
"peerDependencies": {
|
|
27
|
-
"react": "
|
|
29
|
+
"react": ">=18",
|
|
28
30
|
"react-native": "*"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
|
-
"@tamagui/build": "^1.0.1-
|
|
32
|
-
"react": "
|
|
33
|
+
"@tamagui/build": "^1.0.1-rc.0",
|
|
34
|
+
"react": ">=18",
|
|
33
35
|
"react-native": "*"
|
|
34
36
|
},
|
|
35
37
|
"publishConfig": {
|
package/src/Image.tsx
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
GetProps,
|
|
3
|
+
StackProps,
|
|
4
|
+
getExpandedShorthands,
|
|
5
|
+
isWeb,
|
|
6
|
+
setupReactNative,
|
|
7
|
+
styled,
|
|
8
|
+
} from '@tamagui/core'
|
|
2
9
|
import React from 'react'
|
|
3
10
|
import { Image as RNImage } from 'react-native'
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
setupReactNative({
|
|
13
|
+
Image: RNImage,
|
|
14
|
+
})
|
|
6
15
|
|
|
7
|
-
const StyledImage = styled(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
zIndex: 1,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
inlineProps: new Set(['src', 'width', 'height']),
|
|
17
|
-
}
|
|
18
|
-
)
|
|
16
|
+
const StyledImage = styled(RNImage, {
|
|
17
|
+
name: 'Image',
|
|
18
|
+
position: 'relative',
|
|
19
|
+
source: { uri: '' },
|
|
20
|
+
zIndex: 1,
|
|
21
|
+
})
|
|
19
22
|
|
|
20
23
|
type StyledImageProps = GetProps<typeof StyledImage>
|
|
21
24
|
|
|
22
25
|
type BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {
|
|
23
|
-
width: number
|
|
24
|
-
height: number
|
|
26
|
+
width: number | string
|
|
27
|
+
height: number | string
|
|
25
28
|
src: string | StyledImageProps['source']
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -29,22 +32,12 @@ export type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>
|
|
|
29
32
|
|
|
30
33
|
export const Image: React.FC<ImageProps> = StyledImage.extractable((inProps) => {
|
|
31
34
|
const props = getExpandedShorthands(inProps)
|
|
32
|
-
const { src,
|
|
33
|
-
const source =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// placeholder with customizability
|
|
38
|
-
return null
|
|
39
|
-
}
|
|
35
|
+
const { src, ...rest } = props
|
|
36
|
+
const source =
|
|
37
|
+
typeof src === 'string'
|
|
38
|
+
? { uri: src, ...(isWeb && { width: props.width, height: props.height }) }
|
|
39
|
+
: src
|
|
40
40
|
|
|
41
41
|
// must set defaultSource to allow SSR, default it to the same as src
|
|
42
|
-
return (
|
|
43
|
-
<StyledImage
|
|
44
|
-
{...(!isWeb && { style: { width, height } })}
|
|
45
|
-
defaultSource={defaultSource}
|
|
46
|
-
source={source}
|
|
47
|
-
{...(rest as any)}
|
|
48
|
-
/>
|
|
49
|
-
)
|
|
42
|
+
return <StyledImage source={source} {...(rest as any)} />
|
|
50
43
|
})
|
package/types/Image.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ declare const StyledImage: import("@tamagui/core").TamaguiComponent<(import("rea
|
|
|
6
6
|
[x: string]: undefined;
|
|
7
7
|
}>> & import("@tamagui/core").PseudoProps<Partial<import("react-native").ImageProps & Omit<StackProps, keyof import("react-native").ImageProps> & Omit<{}, string | number> & {
|
|
8
8
|
[x: string]: undefined;
|
|
9
|
-
}>>),
|
|
9
|
+
}>>), import("@tamagui/core").TamaguiElement, import("react-native").ImageProps & Omit<StackProps, keyof import("react-native").ImageProps>, {} | {
|
|
10
10
|
[x: string]: undefined;
|
|
11
11
|
}>;
|
|
12
12
|
declare type StyledImageProps = GetProps<typeof StyledImage>;
|
|
13
13
|
declare type BaseProps = Omit<StyledImageProps, 'source' | 'width' | 'height' | 'style' | 'onLayout'> & {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
14
|
+
width: number | string;
|
|
15
|
+
height: number | string;
|
|
16
16
|
src: string | StyledImageProps['source'];
|
|
17
17
|
};
|
|
18
18
|
export declare type ImageProps = BaseProps & Omit<StackProps, keyof BaseProps>;
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/types/Image.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAwC,MAAM,eAAe,CAAA;AAC1F,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,QAAA,MAAM,WAAW;;;;;;;;EAWhB,CAAA;AAED,aAAK,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEpD,aAAK,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IAC9F,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACzC,CAAA;AAED,oBAAY,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,CAAA;AAEtE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoBrC,CAAA"}
|
package/types/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|