@artsy/palette-mobile 17.32.0--canary.373.4107.0 → 17.32.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,29 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import FastImage from "@d11/react-native-fast-image";
|
|
3
|
-
import { memo,
|
|
4
|
-
import { PixelRatio, View } from "react-native";
|
|
3
|
+
import { memo, useRef } from "react";
|
|
4
|
+
import { PixelRatio, View, Animated } from "react-native";
|
|
5
5
|
import { Blurhash } from "react-native-blurhash";
|
|
6
|
-
import Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming, } from "react-native-reanimated";
|
|
7
6
|
import { createGeminiUrl } from "../../utils/createGeminiUrl";
|
|
8
7
|
import { useColor } from "../../utils/hooks";
|
|
9
8
|
import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
|
|
10
9
|
import { Flex } from "../Flex";
|
|
11
10
|
import { Skeleton, SkeletonBox } from "../Skeleton";
|
|
12
11
|
export const Image = memo(({ aspectRatio, width, height, performResize = true, src, style, resizeMode, geminiResizeMode, showLoadingState = false, blurhash, ...flexProps }) => {
|
|
13
|
-
const loading = useSharedValue(true);
|
|
14
12
|
const dimensions = useImageDimensions({ aspectRatio, width, height });
|
|
15
13
|
const color = useColor();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// No need to get the js thread involved here
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
}, []);
|
|
14
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
15
|
+
const onLoadEnd = () => {
|
|
16
|
+
Animated.timing(opacity, {
|
|
17
|
+
toValue: 1,
|
|
18
|
+
duration: 200,
|
|
19
|
+
useNativeDriver: true,
|
|
20
|
+
}).start();
|
|
21
|
+
};
|
|
27
22
|
if (showLoadingState) {
|
|
28
23
|
return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
|
|
29
24
|
}
|
|
@@ -36,16 +31,16 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
|
|
|
36
31
|
resizeMode: geminiResizeMode,
|
|
37
32
|
});
|
|
38
33
|
}
|
|
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(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
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(FastImage, { style: [
|
|
35
|
+
dimensions,
|
|
36
|
+
style,
|
|
37
|
+
// If we have a blurhash, we don't want to show a background color
|
|
38
|
+
// That might flash before the image loads
|
|
39
|
+
{ backgroundColor: blurhash ? "transparent" : color("mono30") },
|
|
40
|
+
], resizeMode: resizeMode, onLoadEnd: onLoadEnd, source: {
|
|
41
|
+
priority: FastImage.priority.normal,
|
|
42
|
+
uri,
|
|
43
|
+
} })] }));
|
|
49
44
|
});
|
|
50
45
|
const useImageDimensions = (props) => {
|
|
51
46
|
const screenDimensions = useScreenDimensions();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MasonryFlashListProps, MasonryFlashListRef } from "@shopify/flash-list";
|
|
2
2
|
import { RefObject } from "react";
|
|
3
|
-
export declare function TabMasonry<T>(props:
|
|
4
|
-
innerRef?: RefObject<
|
|
3
|
+
export declare function TabMasonry<T>(props: MasonryFlashListProps<T> & {
|
|
4
|
+
innerRef?: RefObject<MasonryFlashListRef<T>> | null;
|
|
5
5
|
}): JSX.Element;
|
|
@@ -6,7 +6,7 @@ export function TabMasonry(props) {
|
|
|
6
6
|
useListenForTabContentScroll();
|
|
7
7
|
const space = useSpace();
|
|
8
8
|
const contentContainerStyle = (props.contentContainerStyle ?? {});
|
|
9
|
-
return (_jsx(Tabs.
|
|
9
|
+
return (_jsx(Tabs.MasonryFlashList, { contentContainerStyle: {
|
|
10
10
|
paddingHorizontal: space(2),
|
|
11
11
|
...contentContainerStyle,
|
|
12
12
|
}, ...props, ref: props.innerRef }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artsy/palette-mobile",
|
|
3
|
-
"version": "17.32.0
|
|
3
|
+
"version": "17.32.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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@artsy/palette-tokens": "^7.0.0",
|
|
37
37
|
"@d11/react-native-fast-image": "^8.10.0",
|
|
38
|
-
"@shopify/flash-list": "^
|
|
38
|
+
"@shopify/flash-list": "^1.8.3",
|
|
39
39
|
"@styled-system/core": "^5.1.2",
|
|
40
40
|
"@styled-system/theme-get": "^5.1.2",
|
|
41
41
|
"events": "^3.3.0",
|