Open lightning331 opened 4 years ago
try to wrap <Picker>
component with <View>
component
Can you try this
<View
style={{
flexDirection: "row",
alignItems: "center",
}}
>
<Text>Language:</Text>
<PickerIOS
style={{ flex: 1 }}
mode="dialog"
itemStyle={{ fontWeight: "bold", color: "#ff0000" }}
selectedValue={this.state.language}
onValueChange={(itemValue, itemIndex) =>
this.setState({ language: itemValue })
}
>
<PickerIOS.Item label="Java" value="java" />
<PickerIOS.Item label="JavaScript" value="js" />
</PickerIOS>
</View>
Is there a solution for Android?
I tried
const Task = ({route}) => (
<ScrollView>
<View
style={tw`flex flex-row justify-between items-center bg-white border border-gray-200`}
>
<Text>Task state</Text>
<Picker>
<Picker.Item label="NEXT" value="NEXT" />
<Picker.Item label="INPROGRESS" value="INPROGRESS" />
</Picker>
</View>
</ScrollView>
);
and launched the app in Android, which looks like this. But the problem is that clicking on the picker results in nothing, i.e. the selections don't show up.
I made it work according to this: https://stackoverflow.com/a/42851316/1460448. Setting flex:.5
on both the Text and the Picker was the key.
My example code: