Open leegilhak opened 3 years ago
My Code
<View> <DropdownList title="반려동물" items={items} defaultValue={'반려동물을 선택해주세요.'} onChange={(item: string) => { const targetItem = items.find(petItem => petItem.value === item); dispatch({type: 'ANIMALINSERT', animal_type: item}); dispatch({ type: 'ANIMALIDINSERT', animal_type_id: targetItem.key, }); }} customStyleCancelText={{ cancelTextLight: { fontSize: 15, fontWeight: '500', color: '#FF5924', }, cancelTextDark: { fontSize: 15, fontWeight: '500', color: '#FF5924', }, }} /> </View>
onChange android not working
else if (react_native_1.Platform.OS === 'android') { return (jsx_runtime_1.jsxs(react_native_1.View, Object.assign({ style: renderContainerStyle() }, { children: [jsx_runtime_1.jsx(react_native_1.View, Object.assign({ style: styles.labelContainer }, { children: jsx_runtime_1.jsx(react_native_1.Text, Object.assign({ style: renderLabelTextStyle() }, { children: props.title }), void 0) }), void 0), jsx_runtime_1.jsx(picker_1.Picker, Object.assign({ mode: "dropdown", selectedValue: value, style: { height: 60, width: width - 16 }, onValueChange: (value) => setValue(value) }, { children: props.items.map((item, i) => { return (jsx_runtime_1.jsx(picker_1.Picker.Item, { label: item.label, value: item.value, color: renderPickerItemStyle() }, i)); }) }), void 0)] }), void 0)); }
In the above code, 'setValue' is 'OnValueChange: (Value) => setValue(Value)}', so onChange does not work in the props. It should be modified to 'selectValue'.
+1
My Code
onChange android not workingIn the above code, 'setValue' is 'OnValueChange: (Value) => setValue(Value)}', so onChange does not work in the props. It should be modified to 'selectValue'.