atlas-design-system 1.17.3 → 1.17.5

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.
@@ -40,6 +40,7 @@ const hooks_1 = require("../../hooks");
40
40
  const Button_1 = __importDefault(require("../Button"));
41
41
  const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
42
42
  const FieldError_1 = require("../FieldError/FieldError");
43
+ const animations_1 = require("../../constants/animations");
43
44
  const getFormat = (mode) => {
44
45
  switch (mode) {
45
46
  case "date": {
@@ -78,7 +79,9 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
78
79
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
79
80
  return {
80
81
  transform: [
81
- { translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8]) },
82
+ {
83
+ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
84
+ },
82
85
  ],
83
86
  fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
84
87
  };
@@ -86,7 +89,7 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
86
89
  const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
87
90
  return {
88
91
  flex: 1,
89
- transform: [{ translateY: animatedValue.value * 6 }],
92
+ transform: [{ translateY: animatedValue.value * 7 }],
90
93
  };
91
94
  });
92
95
  return (<>
@@ -77,7 +77,7 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
77
77
  return {
78
78
  transform: [
79
79
  {
80
- translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8], react_native_reanimated_1.Extrapolation.CLAMP),
80
+ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE, react_native_reanimated_1.Extrapolation.CLAMP),
81
81
  },
82
82
  ],
83
83
  fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10], react_native_reanimated_1.Extrapolation.CLAMP),
@@ -86,7 +86,7 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
86
86
  const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
87
87
  return {
88
88
  flex: 1,
89
- transform: [{ translateY: animatedValue.value * 6 }],
89
+ transform: [{ translateY: animatedValue.value * 7 }],
90
90
  };
91
91
  }, [animatedValue]);
92
92
  const handleOptionPress = (0, react_1.useCallback)((option) => {
@@ -84,20 +84,23 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
84
84
  const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
85
85
  (0, react_1.useEffect)(() => {
86
86
  var _a;
87
- if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) {
88
- return;
89
- }
90
87
  if (isInitialMount.current) {
91
88
  isInitialMount.current = false;
92
89
  animatedValue.value = value ? 1 : 0;
90
+ }
91
+ if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) {
93
92
  return;
94
93
  }
95
- 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
+ }
96
97
  }, [value]);
97
98
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
98
99
  return {
99
100
  transform: [
100
- { translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8]) },
101
+ {
102
+ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
103
+ },
101
104
  ],
102
105
  fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
103
106
  };
@@ -3,3 +3,5 @@ export declare const DEFAULT_TIMING_CONFIG: {
3
3
  duration: number;
4
4
  easing: import("react-native-reanimated").EasingFunction;
5
5
  };
6
+ export declare const LABEL_INTERPOLATION_RANGE: number[];
7
+ export declare const LABEL_INTERPOLATION_OUTPUT_RANGE: number[];
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_TIMING_CONFIG = exports.DEFAULT_EASING = void 0;
3
+ exports.LABEL_INTERPOLATION_OUTPUT_RANGE = exports.LABEL_INTERPOLATION_RANGE = exports.DEFAULT_TIMING_CONFIG = exports.DEFAULT_EASING = void 0;
4
4
  const react_native_reanimated_1 = require("react-native-reanimated");
5
5
  exports.DEFAULT_EASING = react_native_reanimated_1.Easing.inOut(react_native_reanimated_1.Easing.quad);
6
6
  exports.DEFAULT_TIMING_CONFIG = {
7
7
  duration: 150,
8
8
  easing: exports.DEFAULT_EASING,
9
9
  };
10
+ exports.LABEL_INTERPOLATION_RANGE = [0, 1];
11
+ exports.LABEL_INTERPOLATION_OUTPUT_RANGE = [1, -9];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.17.3",
3
+ "version": "1.17.5",
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",