@multiplatform.one/components 0.2.16 → 0.2.17
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": "@multiplatform.one/components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@mdx-js/mdx": "^2.3.0",
|
|
42
42
|
"@mdx-js/react": "^2.3.0",
|
|
43
|
-
"@tamagui/font-inter": "^1.
|
|
44
|
-
"@tamagui/logo": "^1.
|
|
45
|
-
"@tamagui/react-native-media-driver": "^1.
|
|
46
|
-
"@tamagui/shorthands": "^1.
|
|
47
|
-
"@tamagui/themes": "^1.
|
|
43
|
+
"@tamagui/font-inter": "^1.31.2",
|
|
44
|
+
"@tamagui/logo": "^1.31.2",
|
|
45
|
+
"@tamagui/react-native-media-driver": "^1.31.2",
|
|
46
|
+
"@tamagui/shorthands": "^1.31.2",
|
|
47
|
+
"@tamagui/themes": "^1.31.2",
|
|
48
48
|
"expo-asset": "^8.9.2",
|
|
49
49
|
"fast-xml-parser": "^4.2.4",
|
|
50
50
|
"gray-matter": "^4.0.3",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"rehype-slug": "^5.1.0",
|
|
60
60
|
"remark-frontmatter": "^4.0.1",
|
|
61
61
|
"remark-mdx-frontmatter": "^3.0.0",
|
|
62
|
-
"tamagui": "^1.
|
|
62
|
+
"tamagui": "^1.31.2",
|
|
63
63
|
"unist-util-visit": "^4.1.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"solito": "^3.2.6"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@tamagui/build": "^1.
|
|
71
|
+
"@tamagui/build": "^1.31.2",
|
|
72
72
|
"moti": "^0.25.3",
|
|
73
73
|
"react-native-reanimated": "2.14.4",
|
|
74
74
|
"solito": "^3.2.6",
|
|
@@ -7,17 +7,29 @@ import { Platform, Image as RNImage } from 'react-native';
|
|
|
7
7
|
import { SvgUri } from '../SvgUri';
|
|
8
8
|
import { XMLParser } from 'fast-xml-parser';
|
|
9
9
|
import { YStack, Image } from 'tamagui';
|
|
10
|
+
import { getTokens } from 'tamagui';
|
|
10
11
|
import { useAssets } from '../../hooks/useAssets';
|
|
11
12
|
import { useMemo } from 'react';
|
|
12
13
|
|
|
13
|
-
export type SimpleImageProps = Omit<ImageProps, 'src' | '
|
|
14
|
+
export type SimpleImageProps = Omit<ImageProps, 'src' | 'source'> & {
|
|
14
15
|
src?: ImageURISource | string;
|
|
15
|
-
width?: string | number;
|
|
16
|
-
height?: string | number;
|
|
17
16
|
svg?: boolean;
|
|
18
17
|
};
|
|
19
18
|
|
|
20
|
-
export function SimpleImage({
|
|
19
|
+
export function SimpleImage({
|
|
20
|
+
aspectRatio,
|
|
21
|
+
h,
|
|
22
|
+
height,
|
|
23
|
+
resizeMode,
|
|
24
|
+
src,
|
|
25
|
+
svg,
|
|
26
|
+
w,
|
|
27
|
+
width,
|
|
28
|
+
...imageProps
|
|
29
|
+
}: SimpleImageProps) {
|
|
30
|
+
const tokens = getTokens();
|
|
31
|
+
height = tokens.size[(height || h) as string]?.val || height || h;
|
|
32
|
+
width = tokens.size[(width || w) as string]?.val || width || w;
|
|
21
33
|
const preserveAspectRatio = useMemo(() => getPreserveAspectRatio(resizeMode), [resizeMode]);
|
|
22
34
|
let source: string | number | ImageURISource | undefined = src;
|
|
23
35
|
if ((typeof src === 'object' && typeof (src as ImageURISource).uri === 'undefined') || typeof src === 'number') {
|
|
@@ -74,8 +86,8 @@ export function SimpleImage({ src, svg, width, height, resizeMode, aspectRatio,
|
|
|
74
86
|
return (
|
|
75
87
|
<SvgUri
|
|
76
88
|
{...(imageProps as Partial<SvgUriProps>)}
|
|
77
|
-
width={Number.isFinite(width) ? width : Number.isFinite(height) ? undefined : '100%'}
|
|
78
|
-
height={height}
|
|
89
|
+
width={Number.isFinite(width) ? (width as number) : Number.isFinite(height) ? undefined : '100%'}
|
|
90
|
+
height={height as number}
|
|
79
91
|
preserveAspectRatio={preserveAspectRatio}
|
|
80
92
|
aspectRatio={aspectRatio}
|
|
81
93
|
uri={uri}
|