@artsy/palette-mobile 17.16.0 → 17.18.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
import { FastImageProps } from "react-native-fast-image";
|
|
3
4
|
import { GeminiResizeMode } from "../../utils/createGeminiUrl";
|
|
4
5
|
type CustomFastImageProps = Omit<FastImageProps, "onLoadStart" | "onLoadEnd" | "source">;
|
|
@@ -21,4 +22,13 @@ export interface ImageProps extends CustomFastImageProps {
|
|
|
21
22
|
src: string;
|
|
22
23
|
}
|
|
23
24
|
export declare const Image: React.FC<ImageProps>;
|
|
25
|
+
type ImageSkeletonProps = {
|
|
26
|
+
dimensions: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
};
|
|
30
|
+
blurhash?: string | null | undefined;
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
32
|
+
};
|
|
33
|
+
export declare const ImageSkeleton: React.FC<ImageSkeletonProps>;
|
|
24
34
|
export {};
|
|
@@ -25,7 +25,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
|
|
|
25
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
26
|
}, []);
|
|
27
27
|
if (showLoadingState) {
|
|
28
|
-
return _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash });
|
|
28
|
+
return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
|
|
29
29
|
}
|
|
30
30
|
let uri = src;
|
|
31
31
|
if (performResize) {
|
|
@@ -36,7 +36,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
|
|
|
36
36
|
resizeMode: geminiResizeMode,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(View, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash }) }), _jsx(Animated.View, { style: animatedStyles, children: _jsx(FastImage, { style: [
|
|
39
|
+
return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(View, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) }), _jsx(Animated.View, { style: animatedStyles, children: _jsx(FastImage, { style: [
|
|
40
40
|
dimensions,
|
|
41
41
|
style,
|
|
42
42
|
// If we have a blurhash, we don't want to show a background color
|
|
@@ -67,9 +67,9 @@ const useImageDimensions = (props) => {
|
|
|
67
67
|
};
|
|
68
68
|
return dimensions;
|
|
69
69
|
};
|
|
70
|
-
const ImageSkeleton = ({ dimensions, blurhash }) => {
|
|
70
|
+
export const ImageSkeleton = ({ dimensions, blurhash, style }) => {
|
|
71
71
|
if (!!blurhash) {
|
|
72
|
-
return (_jsx(Flex, {
|
|
72
|
+
return (_jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: style, children: _jsx(Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16 }) }));
|
|
73
73
|
}
|
|
74
|
-
return (_jsx(Flex, {
|
|
74
|
+
return (_jsx(Flex, { style: style, children: _jsx(Skeleton, { children: _jsx(SkeletonBox, { ...dimensions }) }) }));
|
|
75
75
|
};
|
package/dist/setupJest.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/dist/setupJest.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import "@testing-library/react-native/extend-expect";
|
|
2
1
|
import mockSafeAreaContext from "react-native-safe-area-context/jest/mock";
|
|
3
2
|
jest.mock("react-native-safe-area-context", () => mockSafeAreaContext);
|
|
3
|
+
jest.mock("react-native-blurhash", () => {
|
|
4
|
+
const ReactNative = require("react-native");
|
|
5
|
+
return {
|
|
6
|
+
Blurhash: ReactNative.View,
|
|
7
|
+
};
|
|
8
|
+
});
|
|
4
9
|
require("react-native-reanimated").setUpTests();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artsy/palette-mobile",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.18.0",
|
|
4
4
|
"description": "Artsy's design system for React Native",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"android": "RCT_METRO_PORT=8082 react-native run-android --port 8082 --terminal terminal",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lodash": "^4.17.21",
|
|
42
42
|
"moti": "^0.25.3",
|
|
43
43
|
"react-nanny": "^2.15.0",
|
|
44
|
-
"react-native-blurhash": "^1.1
|
|
44
|
+
"react-native-blurhash": "^2.1.1",
|
|
45
45
|
"react-native-collapsible-tab-view": "^8.0.0",
|
|
46
46
|
"react-native-fast-image": "^8.6.3",
|
|
47
47
|
"react-native-pager-view": "6.5.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@react-native/metro-config": "0.76.9",
|
|
84
84
|
"@react-native/typescript-config": "0.76.9",
|
|
85
85
|
"@storybook/react-native": "6.0.1-beta.11",
|
|
86
|
-
"@testing-library/react-native": "
|
|
86
|
+
"@testing-library/react-native": "13.2.0",
|
|
87
87
|
"@types/events": "^3.0.0",
|
|
88
88
|
"@types/jest": "29.4.0",
|
|
89
89
|
"@types/lodash": "4.14.191",
|