atlas-design-system 1.17.2 → 1.17.4

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;
@@ -44,7 +45,7 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
44
45
  }, [options]);
45
46
  const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
46
47
  const isInitialMount = (0, react_1.useRef)(true);
47
- const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
48
+ const animatedValue = (0, react_native_reanimated_1.useSharedValue)(0);
48
49
  const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
49
50
  (0, react_1.useEffect)(() => {
50
51
  if (error) {
@@ -64,11 +65,12 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
64
65
  if (isInitialMount.current) {
65
66
  // skip animation on initial mount we already have the value
66
67
  isInitialMount.current = false;
68
+ animatedValue.value = value ? 1 : 0;
67
69
  return;
68
70
  }
69
71
  else {
70
72
  // After initial mount, animate the value changes
71
- animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, { duration: 250 });
73
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
72
74
  }
73
75
  }, [value]);
74
76
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
@@ -79,14 +79,21 @@ 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;
87
+ if (isInitialMount.current) {
88
+ isInitialMount.current = false;
89
+ animatedValue.value = value ? 1 : 0;
90
+ }
86
91
  if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) {
87
92
  return;
88
93
  }
89
- animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
94
+ if (!isInitialMount.current) {
95
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
96
+ }
90
97
  }, [value]);
91
98
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
92
99
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.17.2",
3
+ "version": "1.17.4",
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",