@artsy/palette-mobile 23.0.0 → 23.2.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.
@@ -16,12 +16,17 @@ import { Text } from "../Text";
16
16
  */
17
17
  export const Skeleton = ({ children }) => {
18
18
  const opacity = useRef(new Animated.Value(0.5));
19
+ const animationRef = useRef(null);
19
20
  useEffect(() => {
20
- Animated.loop(Animated.timing(opacity.current, {
21
+ animationRef.current = Animated.loop(Animated.timing(opacity.current, {
21
22
  toValue: 1,
22
23
  duration: 1000,
23
24
  useNativeDriver: true,
24
- })).start();
25
+ }));
26
+ animationRef.current.start();
27
+ return () => {
28
+ animationRef.current.stop();
29
+ };
25
30
  }, []);
26
31
  return (_jsx(Animated.View, { style: {
27
32
  opacity: opacity.current,
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useMemo } from "react";
2
+ import { useEffect, useMemo, useRef } from "react";
3
3
  import { Animated, Easing } from "react-native";
4
4
  import styled from "styled-components/native";
5
5
  import { useColor } from "../../utils/hooks";
@@ -38,18 +38,20 @@ export const getSize = (props) => {
38
38
  export const Spinner = ({ size = "medium", color: theColor = "mono100", ...rest }) => {
39
39
  const color = useColor();
40
40
  const rotation = useMemo(() => new Animated.Value(0), []);
41
- const startRotation = () => {
42
- Animated.loop(Animated.timing(rotation, {
41
+ const animationRef = useRef(null);
42
+ useEffect(() => {
43
+ animationRef.current = Animated.loop(Animated.timing(rotation, {
43
44
  toValue: 1,
44
45
  duration: 1000,
45
46
  easing: Easing.linear,
46
47
  useNativeDriver: true,
47
48
  }), {
48
49
  iterations: -1,
49
- }).start();
50
- };
51
- useEffect(() => {
52
- startRotation();
50
+ });
51
+ animationRef.current.start();
52
+ return () => {
53
+ animationRef.current.stop();
54
+ };
53
55
  }, []);
54
56
  const style = [
55
57
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "23.0.0",
3
+ "version": "23.2.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "workspaces": [
6
6
  "Example"
@@ -114,7 +114,7 @@
114
114
  "lint-staged": "13.1.2",
115
115
  "lodash": "4.17.21",
116
116
  "moti": "0.30.0",
117
- "nodemon": "^2.0.20",
117
+ "nodemon": "^3.1.14",
118
118
  "patch-package": "^8.0.0",
119
119
  "postinstall-prepare": "^2.0.0",
120
120
  "prettier": "^2.8.8",