react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.49k stars 280 forks source link

Picker with view alignItems center #325

Closed paulobordignon closed 3 years ago

paulobordignon commented 3 years ago

On React Native (0.64) Android using expo (42.0.0):

` <KeyboardAvoidingView style={styles.background} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>

<View style={styles.container}>
    <Picker
    selectedValue="selecione"
    onValueChange={(itemValue, itemIndex) => setCategoryId(itemValue)}>
        <Picker.Item label="Java" value="java" />
        <Picker.Item label="JavaScript" value="js" />
    </Picker>
</View>

`

background: { flex: 1, backgroundColor: colors.textLight, }, container: { flex: 1, alignItems: 'center', marginTop: getStatusBarHeight() + 150, paddingTop: 50, backgroundColor: colors.background, borderRadius: 25, },

Because alignItems: 'center' in container style, the picker hasn't working.

2021-09-09_00-25

LuxikHS commented 3 years ago

You have to change Picker width, because now is to big to render on screen.

paulobordignon commented 3 years ago

Thanks @LuxikHS

style={{width: '90%'}}

It's the solution for my problem.