@artsy/palette-mobile 11.0.14 → 11.0.16
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# v11.0.16 (Tue Apr 18 2023)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- feat(progress-bar): Add `animationDuration` prop [#89](https://github.com/artsy/palette-mobile/pull/89) ([@damassi](https://github.com/damassi))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Christopher Pappas ([@damassi](https://github.com/damassi))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# v11.0.15 (Fri Apr 14 2023)
|
|
14
|
+
|
|
15
|
+
#### 🐛 Bug Fix
|
|
16
|
+
|
|
17
|
+
- fix(button): fix worklet crash error in eigen [#88](https://github.com/artsy/palette-mobile/pull/88) ([@damassi](https://github.com/damassi))
|
|
18
|
+
|
|
19
|
+
#### Authors: 1
|
|
20
|
+
|
|
21
|
+
- Christopher Pappas ([@damassi](https://github.com/damassi))
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
1
25
|
# v11.0.14 (Fri Apr 14 2023)
|
|
2
26
|
|
|
3
27
|
#### 🐛 Bug Fix
|
|
@@ -89,6 +89,7 @@ const Button = ({ children, disabled: disabledProp, haptic, icon, iconPosition =
|
|
|
89
89
|
};
|
|
90
90
|
});
|
|
91
91
|
const textAnim = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
92
|
+
"worklet";
|
|
92
93
|
const colors = colorsForVariantAndState[variant];
|
|
93
94
|
if (loading) {
|
|
94
95
|
return { color: "rgba(0, 0, 0, 0)" };
|
|
@@ -119,6 +120,7 @@ const useStateWithProp = (prop) => {
|
|
|
119
120
|
setState(!!prop);
|
|
120
121
|
}, [prop]);
|
|
121
122
|
const stateV = (0, react_native_reanimated_1.useDerivedValue)(() => {
|
|
123
|
+
"worklet";
|
|
122
124
|
if (!!state) {
|
|
123
125
|
return 1;
|
|
124
126
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Color } from "../../types";
|
|
3
3
|
export interface ProgressBarProps {
|
|
4
|
-
|
|
5
|
-
height?: number;
|
|
6
|
-
trackColor?: Color;
|
|
4
|
+
animationDuration?: number;
|
|
7
5
|
backgroundColor?: Color;
|
|
6
|
+
height?: number;
|
|
8
7
|
onCompletion?: () => void;
|
|
8
|
+
progress: number;
|
|
9
|
+
trackColor?: Color;
|
|
9
10
|
}
|
|
10
|
-
export declare const ProgressBar: ({
|
|
11
|
+
export declare const ProgressBar: ({ animationDuration, backgroundColor, height, onCompletion, progress: unclampedProgress, trackColor, }: ProgressBarProps) => JSX.Element;
|
|
@@ -30,14 +30,14 @@ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"
|
|
|
30
30
|
const useColor_1 = require("../../utils/hooks/useColor");
|
|
31
31
|
const Flex_1 = require("../Flex");
|
|
32
32
|
const clamp = (num, min, max) => Math.max(min, Math.min(num, max));
|
|
33
|
-
const ProgressBar = ({
|
|
33
|
+
const ProgressBar = ({ animationDuration = 200, backgroundColor = "black30", height = 2, onCompletion, progress: unclampedProgress, trackColor = "blue100", }) => {
|
|
34
34
|
const color = (0, useColor_1.useColor)();
|
|
35
35
|
const width = (0, react_native_reanimated_1.useSharedValue)("0%");
|
|
36
36
|
const progress = clamp(unclampedProgress, 0, 100);
|
|
37
37
|
const progressAnim = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({ width: width.value }));
|
|
38
38
|
const [onCompletionCalled, setOnCompletionCalled] = (0, react_1.useState)(false);
|
|
39
39
|
(0, react_1.useEffect)(() => {
|
|
40
|
-
width.value = (0, react_native_reanimated_1.withTiming)(`${progress}%`, { duration:
|
|
40
|
+
width.value = (0, react_native_reanimated_1.withTiming)(`${progress}%`, { duration: animationDuration });
|
|
41
41
|
if (progress === 100 && !onCompletionCalled) {
|
|
42
42
|
onCompletion?.();
|
|
43
43
|
setOnCompletionCalled(true);
|