Skip to content

Commit 3813b24

Browse files
author
Vivek Kozhisseri
committed
Resolved android picker styling issues (microsoft#6179)
1 parent 717e30f commit 3813b24

File tree

2 files changed

+58
-26
lines changed

2 files changed

+58
-26
lines changed

source/community/reactnative/src/components/inputs/choice-set/choice-set-input.js

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,30 +182,44 @@ export class ChoiceSetInput extends React.Component {
182182
</View>
183183
</TouchableOpacity>}
184184
{((Platform.OS === Constants.PlatformIOS) ? this.state.isPickerSelected : true) &&
185-
<Picker
186-
mode={'dropdown'}
187-
itemStyle={this.styleConfig.picker}
188-
selectedValue={this.getPickerInitialValue(addInputItem)}
189-
onValueChange={
190-
(itemValue) => {
191-
this.setState({
192-
selectedPickerValue: itemValue,
193-
isError: false
194-
})
195-
addInputItem(this.id, { value: itemValue, errorState: false });
196-
}}>
197-
{this.choices.map((item, key) => (
198-
<Picker.Item
199-
label={item.title}
200-
value={item.value} key={key}
201-
/>)
202-
)}
203-
</Picker>
185+
this.getPickerComponent(addInputItem)
204186
}
205187
</View>
206188
)
207189
}
208190

191+
getPickerComponent(addInputItem) {
192+
let picker = (
193+
<Picker
194+
mode={'dropdown'}
195+
itemStyle={this.styleConfig.picker}
196+
selectedValue={this.getPickerInitialValue(addInputItem)}
197+
onValueChange={
198+
(itemValue) => {
199+
this.setState({
200+
selectedPickerValue: itemValue,
201+
isError: false
202+
})
203+
addInputItem(this.id, { value: itemValue, errorState: false });
204+
}}>
205+
{this.choices.map((item, key) => (
206+
<Picker.Item
207+
label={item.title}
208+
value={item.value} key={key}
209+
/>)
210+
)}
211+
</Picker>
212+
);
213+
if (Platform.OS == Constants.PlatformAndroid) {
214+
picker = (
215+
<View style={this.styleConfig.dropdown}>
216+
{picker}
217+
</View>
218+
)
219+
}
220+
return picker;
221+
}
222+
209223
/**
210224
* @description Renders CheckBoxes component as per the json
211225
*/

source/community/reactnative/src/utils/theme-config.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,31 @@ export const defaultThemeConfig = {
114114
inactiveColor: Constants.LightBlack,
115115
},
116116
dropdown: {
117-
flexDirection: Constants.FlexRow,
118-
justifyContent: Constants.SpaceBetween,
119-
alignItems: Constants.FlexEnd,
120-
borderWidth: 1,
121-
backgroundColor: Constants.WhiteColor,
122-
borderColor: Constants.LightGreyColor,
123-
borderRadius: 5,
117+
ios: {
118+
flexDirection: Constants.FlexRow,
119+
justifyContent: Constants.SpaceBetween,
120+
alignItems: Constants.FlexEnd,
121+
borderWidth: 1,
122+
backgroundColor: Constants.WhiteColor,
123+
borderColor: Constants.LightGreyColor,
124+
borderRadius: 5,
125+
},
126+
android: {
127+
borderWidth: 1,
128+
backgroundColor: Constants.WhiteColor,
129+
borderColor: Constants.LightGreyColor,
130+
borderRadius: 5,
131+
backgroundColor: Constants.LightGreyColor,
132+
},
133+
windows: {
134+
flexDirection: Constants.FlexRow,
135+
justifyContent: Constants.SpaceBetween,
136+
alignItems: Constants.FlexEnd,
137+
borderWidth: 1,
138+
backgroundColor: Constants.WhiteColor,
139+
borderColor: Constants.LightGreyColor,
140+
borderRadius: 5,
141+
}
124142
},
125143
dropdownText: {
126144
color: Constants.BlackColor,

0 commit comments

Comments
 (0)