atlas-design-system 1.17.1 → 1.17.3

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.
@@ -36,6 +36,7 @@ const MenuItemDescription_1 = require("../MenuItemDescription");
36
36
  const hooks_1 = require("../../hooks");
37
37
  const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
38
38
  const Chevron_1 = __importDefault(require("../Chevron"));
39
+ const animations_1 = require("../../constants/animations");
39
40
  const SelectionItem_1 = __importDefault(require("./components/SelectionItem"));
40
41
  function SelectInput({ caption, label, options = [], onChange, error, renderOption, containerStyle, }) {
41
42
  const styles = useStyles().styles;
@@ -43,7 +44,8 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
43
44
  return options.find((v) => v.selected);
44
45
  }, [options]);
45
46
  const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
46
- const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
47
+ const isInitialMount = (0, react_1.useRef)(true);
48
+ const animatedValue = (0, react_native_reanimated_1.useSharedValue)(0);
47
49
  const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
48
50
  (0, react_1.useEffect)(() => {
49
51
  if (error) {
@@ -60,7 +62,16 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
60
62
  styles.itemContainer.borderColor,
61
63
  ]);
62
64
  (0, react_1.useEffect)(() => {
63
- animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, { duration: 250 });
65
+ if (isInitialMount.current) {
66
+ // skip animation on initial mount we already have the value
67
+ isInitialMount.current = false;
68
+ animatedValue.value = value ? 1 : 0;
69
+ return;
70
+ }
71
+ else {
72
+ // After initial mount, animate the value changes
73
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
74
+ }
64
75
  }, [value]);
65
76
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
66
77
  return {
@@ -79,13 +79,19 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
79
79
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
80
80
  },
81
81
  }));
82
- const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
82
+ const animatedValue = (0, react_native_reanimated_1.useSharedValue)(0);
83
+ const isInitialMount = (0, react_1.useRef)(true);
83
84
  const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
84
85
  (0, react_1.useEffect)(() => {
85
86
  var _a;
86
87
  if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) {
87
88
  return;
88
89
  }
90
+ if (isInitialMount.current) {
91
+ isInitialMount.current = false;
92
+ animatedValue.value = value ? 1 : 0;
93
+ return;
94
+ }
89
95
  animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
90
96
  }, [value]);
91
97
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "description": "A react native design system for the Atlas workout app",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",