@artsy/palette-mobile 21.0.0 → 21.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.
@@ -13,3 +13,4 @@ export declare const DEFAULT_ICON_SIZE: number;
13
13
  */
14
14
  export declare let DEFAULT_ACTIVE_OPACITY: number;
15
15
  export declare const setGlobalActiveOpacity: (opacity: number) => void;
16
+ export declare const DEFAULT_ANIMATION_DURATION = 200;
package/dist/constants.js CHANGED
@@ -12,3 +12,4 @@ export let DEFAULT_ACTIVE_OPACITY = 0.8;
12
12
  export const setGlobalActiveOpacity = (opacity) => {
13
13
  DEFAULT_ACTIVE_OPACITY = opacity;
14
14
  };
15
+ export const DEFAULT_ANIMATION_DURATION = 200;
@@ -1,25 +1,33 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import FastImage from "@d11/react-native-fast-image";
3
3
  import { memo, useState } from "react";
4
- import { View } from "react-native";
5
- // @ts-expect-error
6
4
  import { Blurhash } from "react-native-blurhash";
5
+ import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, } from "react-native-reanimated";
7
6
  import { getImageURL } from "./helpers/getImageURL";
7
+ import { DEFAULT_ANIMATION_DURATION } from "../../constants";
8
8
  import { useColor } from "../../utils/hooks";
9
9
  import { useScreenDimensions } from "../../utils/hooks/useScreenDimensions";
10
10
  import { Flex } from "../Flex";
11
11
  import { Skeleton, SkeletonBox } from "../Skeleton";
12
12
  export const Image = memo(({ aspectRatio, width, height, performResize = true, src, style, resizeMode, geminiResizeMode, showLoadingState = false, blurhash, ...flexProps }) => {
13
- const [isLoading, setIsLoading] = useState(false);
13
+ const [isLoading, setIsLoading] = useState(true);
14
14
  const dimensions = useImageDimensions({ aspectRatio, width, height });
15
+ const opacity = useSharedValue(1);
15
16
  const color = useColor();
16
17
  const onLoadEnd = () => {
17
- setIsLoading(false);
18
+ opacity.value = withSpring(0, { duration: DEFAULT_ANIMATION_DURATION }, () => {
19
+ runOnJS(setIsLoading)(false);
20
+ });
18
21
  };
22
+ const skeletonStyle = useAnimatedStyle(() => {
23
+ return {
24
+ opacity: opacity.value,
25
+ };
26
+ });
19
27
  if (showLoadingState) {
20
28
  return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
21
29
  }
22
- 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: [
30
+ return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(FastImage, { style: [
23
31
  dimensions,
24
32
  style,
25
33
  // If we have a blurhash, we don't want to show a background color
@@ -28,7 +36,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
28
36
  ], resizeMode: resizeMode, onLoadEnd: onLoadEnd, source: {
29
37
  priority: FastImage.priority.normal,
30
38
  uri: getImageURL({ src, dimensions, geminiResizeMode, performResize }),
31
- } })] }));
39
+ } }), isLoading && (_jsx(Animated.View, { style: [dimensions, { position: "absolute" }, skeletonStyle], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) }))] }));
32
40
  });
33
41
  const useImageDimensions = (props) => {
34
42
  const screenDimensions = useScreenDimensions();
@@ -3,7 +3,8 @@ import { EventEmitter } from "events";
3
3
  import { CloseFillIcon, HideIcon, ShowIcon, TriangleDownIcon } from "@artsy/icons/native";
4
4
  import { THEME } from "@artsy/palette-tokens";
5
5
  import themeGet from "@styled-system/theme-get";
6
- import { isArray, isString } from "lodash";
6
+ import isArray from "lodash/isArray";
7
+ import isString from "lodash/isString";
7
8
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
8
9
  import { LayoutAnimation, Platform, TextInput, TouchableOpacity, } from "react-native";
9
10
  import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
@@ -1,13 +1,13 @@
1
- import { JSX, ReactNode } from "react";
1
+ import React, { JSX } from "react";
2
2
  import { FlexProps } from "../Flex";
3
3
  export interface HeaderProps {
4
4
  animated?: boolean;
5
5
  hideLeftElements?: boolean;
6
6
  hideRightElements?: boolean;
7
7
  hideTitle?: boolean;
8
- leftElements?: ReactNode;
8
+ leftElements?: React.ReactNode;
9
9
  onBack?: () => void;
10
- rightElements?: ReactNode;
10
+ rightElements?: React.ReactNode;
11
11
  scrollY?: number;
12
12
  scrollYOffset?: number;
13
13
  title?: string | JSX.Element;
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "21.0.0",
3
+ "version": "21.1.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "workspaces": [
6
6
  "Example"
7
7
  ],
8
8
  "scripts": {
9
9
  "android": "yarn workspace palette-mobile-example android",
10
- "android:clean": "yarn workspace palette-mobile-example android:prebuild --clean",
11
10
  "android:prebuild": "yarn workspace palette-mobile-example android:prebuild",
12
11
  "beta:ios": "bundle e fastlane ios beta",
13
12
  "bundle-install": "bundle install",
@@ -15,7 +14,6 @@
15
14
  "compile": "tsc",
16
15
  "install:all": "yarn install && yarn postinstall && yarn bundle-install",
17
16
  "ios": "yarn workspace palette-mobile-example ios",
18
- "ios:clean": "yarn workspace palette-mobile-example ios:prebuild --clean",
19
17
  "ios:prebuild": "yarn workspace palette-mobile-example ios:prebuild",
20
18
  "lint:all": "yarn lint .",
21
19
  "lint": "eslint --cache --cache-location '.cache/eslint/' --ext .ts,.tsx --fix",
@@ -51,7 +49,7 @@
51
49
  "lodash": "^4.17.21",
52
50
  "moti": "^0.25.3",
53
51
  "react-nanny": "^2.15.0",
54
- "react-native-blurhash": "2.1.2",
52
+ "react-native-blurhash": "2.1.1",
55
53
  "react-native-collapsible-tab-view": "^8.0.1",
56
54
  "react-native-pager-view": "6.7.1",
57
55
  "react-native-popover-view": "^6.1.0",
@@ -83,14 +81,13 @@
83
81
  "@babel/preset-react": "7.18.6",
84
82
  "@babel/preset-typescript": "7.18.6",
85
83
  "@babel/runtime": "^7.25.0",
86
- "@react-native-async-storage/async-storage": "^2.2.0",
87
84
  "@react-native/eslint-config": "0.76.9",
88
85
  "@testing-library/react-native": "13.2.0",
89
86
  "@types/events": "^3.0.0",
90
87
  "@types/jest": "29.4.0",
91
88
  "@types/lodash": "4.14.191",
92
- "@types/react": "~19.1.10",
93
- "@types/react-test-renderer": "19.1.0",
89
+ "@types/react": "~19.0.10",
90
+ "@types/react-test-renderer": "19.0.0",
94
91
  "@types/styled-system": "^5.1.16",
95
92
  "@types/styled-system__theme-get": "^5.0.2",
96
93
  "@typescript-eslint/eslint-plugin": "5.51.0",
@@ -120,28 +117,20 @@
120
117
  "postinstall-prepare": "^2.0.0",
121
118
  "prettier": "^2.8.8",
122
119
  "pull-lock": "1.0.0",
123
- "react": "19.1.0",
124
- "react-native": "0.81.5",
120
+ "react": "19.0.0",
121
+ "react-native": "0.79.6",
125
122
  "react-native-haptic-feedback": "1.14.0",
126
123
  "react-native-linear-gradient": "2.6.2",
127
- "react-native-reanimated": "3.19.4",
128
- "react-native-safe-area-context": "5.6.0",
129
- "react-native-svg": "15.12.1",
130
- "react-test-renderer": "19.1.0",
124
+ "react-native-reanimated": "3.17.5",
125
+ "react-native-safe-area-context": "5.4.1",
126
+ "react-native-svg": "15.12.0",
127
+ "react-test-renderer": "19.0.0",
131
128
  "rimraf": "4.1.2",
132
129
  "styled-components": "6.1.19",
133
130
  "typescript": "5.8.3"
134
131
  },
135
- "resolutions": {
136
- "@types/react": "~19.1.10",
137
- "react": "19.1.0",
138
- "react-test-renderer": "19.1.0",
139
- "react-native-svg": "15.12.1",
140
- "react-native-safe-area-context": "5.6.0"
141
- },
142
132
  "engines": {
143
- "yarn": "4.x",
144
- "node": "24.x"
133
+ "yarn": "4.x"
145
134
  },
146
135
  "files": [
147
136
  "dist"