Closed zirlman closed 3 years ago
How can I change the style props of Menu/
Code:
export type DropdownItem = { label: string; value: string; }; type DropdownProps = { label: string; items: DropdownItem[]; }; const Dropdown: FC<DropdownProps> = ({label, items}) => { const [open, setOpen] = useState(false); const [value, setValue] = useState(items?.[0].value ?? ''); return ( <Provider> <SafeAreaView style={style.containerStyle}> <DropDown label={label} mode={'outlined'} value={value} setValue={val => setValue(val.toString())} list={items} showDropDown={() => setOpen(true)} onDismiss={() => setOpen(false)} visible={open} inputProps={{ right: <TextInput.Icon name={'menu-down'} />, }} theme={dropdownInputTheme} dropDownStyle={style.dropdownStyle} dropDownItemStyle={style.dropdownItemStyle} /> </SafeAreaView> </Provider> ); }; const selectionColor = '#DD622B'; const dropdownInputTheme = { ...DefaultTheme, roundness: 2, dark: false, colors: { ...DefaultTheme.colors, primary: selectionColor, }, }; const style = StyleSheet.create({ containerStyle: { marginHorizontal: 20, }, dropdownStyle: { backgroundColor: 'red', padding: 10, }, dropdownItemStyle: { // padding: 20, backgroundColor: 'white', borderColor: 'blue', // marginVertical: -8, }, });
Will be fixing in next update
I have upgraded the library and added new props to handle these cases.
How can I change the style props of Menu/
Code: