atlas-design-system 1.5.0 → 1.5.1

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,11 +40,11 @@ const animations_1 = require("../../constants/animations");
40
40
  const SelectionItem_1 = __importDefault(require("./components/SelectionItem"));
41
41
  function SelectInput({ caption, label, options = [], onChange, error, renderOption, }) {
42
42
  const styles = useStyles().styles;
43
- const values = (0, react_1.useMemo)(() => {
44
- return options.filter((v) => v.selected);
45
- }, options);
43
+ const value = (0, react_1.useMemo)(() => {
44
+ return options.find((v) => v.selected);
45
+ }, [options]);
46
46
  const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
47
- const animatedValue = (0, react_native_reanimated_1.useSharedValue)(values.length ? 1 : 0);
47
+ const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
48
48
  const rotation = (0, react_native_reanimated_1.useSharedValue)(sheetOpen ? 1 : 0);
49
49
  const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
50
50
  (0, react_1.useEffect)(() => {
@@ -60,8 +60,8 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
60
60
  rotation.value = (0, react_native_reanimated_1.withTiming)(sheetOpen ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
61
61
  }, [sheetOpen]);
62
62
  (0, react_1.useEffect)(() => {
63
- animatedValue.value = values.length ? 1 : 0;
64
- }, [values.length]);
63
+ animatedValue.value = value ? 1 : 0;
64
+ }, [value]);
65
65
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
66
66
  return {
67
67
  transform: [
@@ -96,8 +96,8 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
96
96
  </react_native_reanimated_1.default.Text>
97
97
  </react_native_1.View>
98
98
  <react_native_reanimated_1.default.View style={animatedValueStyle}>
99
- {!!values.length && (<Text_1.default contrast="low" style={styles.value}>
100
- {values[0].label}
99
+ {!!value && (<Text_1.default contrast="low" style={styles.value}>
100
+ {value.label}
101
101
  </Text_1.default>)}
102
102
  </react_native_reanimated_1.default.View>
103
103
  <react_native_reanimated_1.default.View style={animatedChevronStyle}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
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",