Reputation: 167
So far I have absoltuely loved using expo. But now, I would like to add a wheel picker (inline) to my app, it works fine on iOS but on Android it just shows a red outline. I think it has to do with needing to add custom build scripts, for this I would have to eject from expo; I really don't want to.
Is there another way I can implement a pickerview on android?
Thank you!
Upvotes: 1
Views: 1305
Reputation: 1555
There is no straight-forward way to create a wheel-picker in react-native for android, especially when you're using Expo which restricts you from importing native code. What was your method of creating a wheel picker for iOS?
But maybe the standard react-native Picker
component is viable for you? In contrast to iOS, a wheel picker is not considered a standard ui component in Android anyway. The normal Picker
component will be rendered as a native android picker with a dropdown menu.
Straight from the docs:
import { Picker } from 'react-native'
// in your render method
<Picker
selectedValue={this.state.language}
onValueChange={(itemValue, itemIndex) => this.setState({language: itemValue})}>
<Picker.Item label="Java" value="java" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
Upvotes: 1