atlas-design-system 1.5.0 → 1.5.2
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
|
|
44
|
-
return options.
|
|
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)(
|
|
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 =
|
|
64
|
-
}, [
|
|
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
|
-
{!!
|
|
100
|
-
{
|
|
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}>
|
|
@@ -122,7 +122,6 @@ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((th
|
|
|
122
122
|
borderWidth: theme.borderWidth,
|
|
123
123
|
borderColor: theme.colors.backgroundPrimary,
|
|
124
124
|
backgroundColor: theme.colors.backgroundOnPrimary,
|
|
125
|
-
marginBottom: theme.size.baseSize * 2,
|
|
126
125
|
borderRadius: theme.borderRadius,
|
|
127
126
|
minHeight: theme.size.baseSize * 8,
|
|
128
127
|
flexDirection: "row",
|