n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

Change selected item style ? #252

Open CharlotteRdn opened 3 years ago

CharlotteRdn commented 3 years ago

Can I change the selected item style ? I mean get it bold and underlined (I just found selectedItemColor )

Sanil2108 commented 3 years ago

You can pass a function that returns JSX to the prop renderBase

Temirtator commented 3 years ago

@CharlotteRdn you need to set fontWeight: '500' to itemTextStyle

TahaGitHub commented 1 year ago

You can change selected item's style by using the "propsExtractor" key.  Check package flow for "propsExtractor" set at items "Button" in the dropdown list;

react-native-material-dropdown >> src/component/ >> dropdown >> index.js react-native-material-dropdown >> src/component/ >> item >> index.js

For example the style key in next code will change selected item to red.

propsExtractor={(item, index) => { return { style: { backgroundColor: item.value === "Week" ? "red" : "transparent" } } } }

Screenshot from 2022-09-20 22-41-09