NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Extend selected Picker Item label

Open dipernaa opened this issue 8 years ago • 4 comments

Is there a way to parse a different label for a selected Item for a Picker? For example, my options are red, blue, and green. When I have red selected, I want the picker to display "red color"

react: 16.2.0 react-native: 0.53.0 native-base: 2.3.8

dipernaa avatar Mar 05 '18 16:03 dipernaa

@dipernaa That is not possible to do, NativeBase Picker is replacement of React Native Picker. React Native Picker has not come across this feature

You can do this at max,

<Picker
       iosHeader="Select one"
       mode="dropdown"
       selectedValue={this.state.selected1}
       onValueChange={this.onValueChange.bind(this)}
       itemStyle={{ backgroundColor: 'lightgrey', marginLeft: 0, paddingLeft: 15 }}
       itemTextStyle={{ fontSize: 18, color: 'white' }}
       textStyle={{ color: "red" }}
>

#338

SupriyaKalghatgi avatar Mar 06 '18 06:03 SupriyaKalghatgi

i dont see why this is actually closed. none of itemStyle, itemTextStyle and textStyle worked for me.

itspauloroberto avatar Feb 27 '19 19:02 itspauloroberto

https://docs.nativebase.io/Components.html#picker-text-and-item-text-styles-headref

SupriyaKalghatgi avatar Feb 28 '19 03:02 SupriyaKalghatgi

you can use like this for selected value from PICKER: <Picker.Item color={(this.state.selectedId =='id') ? 'red' : 'grey' } label={'Value'} value={'id'} />

sridix avatar May 01 '21 08:05 sridix