@artsy/palette-mobile 20.0.0 → 20.1.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,7 +1,7 @@
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, useRef } from "react";
4
- import { View, Animated } from "react-native";
3
+ import { memo, useState } from "react";
4
+ import { View } from "react-native";
5
5
  import { Blurhash } from "react-native-blurhash";
6
6
  import { getImageURL } from "./helpers/getImageURL";
7
7
  import { useColor } from "../../utils/hooks";
@@ -9,20 +9,16 @@ import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
9
9
  import { Flex } from "../Flex";
10
10
  import { Skeleton, SkeletonBox } from "../Skeleton";
11
11
  export const Image = memo(({ aspectRatio, width, height, performResize = true, src, style, resizeMode, geminiResizeMode, showLoadingState = false, blurhash, ...flexProps }) => {
12
+ const [isLoading, setIsLoading] = useState(false);
12
13
  const dimensions = useImageDimensions({ aspectRatio, width, height });
13
14
  const color = useColor();
14
- const opacity = useRef(new Animated.Value(0)).current;
15
15
  const onLoadEnd = () => {
16
- Animated.timing(opacity, {
17
- toValue: 1,
18
- duration: 200,
19
- useNativeDriver: true,
20
- }).start();
16
+ setIsLoading(false);
21
17
  };
22
18
  if (showLoadingState) {
23
19
  return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
24
20
  }
25
- 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: [
21
+ return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [isLoading && (_jsx(View, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) })), _jsx(FastImage, { style: [
26
22
  dimensions,
27
23
  style,
28
24
  // If we have a blurhash, we don't want to show a background color
@@ -55,7 +51,7 @@ const useImageDimensions = (props) => {
55
51
  };
56
52
  export const ImageSkeleton = ({ dimensions, blurhash, style }) => {
57
53
  if (!!blurhash) {
58
- return (_jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: style, children: _jsx(Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16 }) }));
54
+ return (_jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: style, children: _jsx(Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16, decodeAsync: true }) }));
59
55
  }
60
56
  return (_jsx(Flex, { style: style, children: _jsx(Skeleton, { children: _jsx(SkeletonBox, { ...dimensions }) }) }));
61
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "20.0.0",
3
+ "version": "20.1.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "expo run:android --port 8082",