React-native-picker-select: Android: Not working with Parent View {flexDirection:'row'}

Created on 4 Nov 2019  路  1Comment  路  Source: lawnstarter/react-native-picker-select

YOU MUST FILL OUT EVERY SECTION. INCOMPLETE BUG REPORTS WILL BE CLOSED.

Describe the bug

I want to use with in a single row. So, when I make the Parent flexDirection: row, I see only the arrow and no text. Even if I remove the I don't see any text.

To Reproduce

Steps to reproduce the behavior:

Below is the code to reproduce this on Android

import React, { Component } from 'react';
import {
    StyleSheet,
   View,
} from 'react-native';
import RNPickerSelect from 'react-native-picker-select';

type Props = {}

const countryCode = [
{
label: '+91',
value: '+91',
},
{
 label: '+1',
 value: '+1',
}
];

export default class PickerTest extends Component<Props> {

    constructor() {
  super()
  this.state = {
      phoneNumber: "",
      countryCode: ""
   }
   }

render() {
return (
    <View style={{flexDirection:'row'}}>
        <View paddingVertical={5}>
        {/* and hiding the InputAccessoryView on iOS */}
        <RNPickerSelect
        placeholder={{}}
        items={countryCode}
        style={pickerSelectStyles}
        onValueChange={value => {
          this.setState({
            countryCode: value,
          });
        }}
        InputAccessoryView={() => null}
        style={pickerSelectStyles}
        value={this.state.countryCode}
        />
        </View>
    </View>
 );
}
}

const pickerSelectStyles = StyleSheet.create({
inputIOS: {
fontSize: 16,
paddingVertical: 12,
paddingHorizontal: 10,
borderWidth: 1,
borderColor: 'gray',
borderRadius: 4,
color: 'black',
paddingRight: 30, // to ensure the text is never behind the icon
},
inputAndroid: {
fontSize: 16,
paddingHorizontal: 10,
paddingVertical: 8,
borderWidth: 0.5,
borderColor: 'purple',
borderRadius: 8,
color: 'black',
paddingRight: 30, // to ensure the text is never behind the icon
},
});

Expected behavior

I want the text to be seen when I change flexDirection to 'row'

Screenshots

image

Additional details

  • Device: Android Simulator
  • OS: Android Pie
  • react-native-picker-select version: 6.3.3
  • react-native version: 0.61.2
  • react version: 16.9.0

Reproduction and/or code sample

https://snack.expo.io/H1vBssTqS

Most helpful comment

this is an upstream issue: https://snack.expo.io/HkygCqhsr

options:

  1. useNativeAndroidPickerStyle prop
  2. set width and height with inputAndroid style prop

>All comments

this is an upstream issue: https://snack.expo.io/HkygCqhsr

options:

  1. useNativeAndroidPickerStyle prop
  2. set width and height with inputAndroid style prop
Was this page helpful?
0 / 5 - 0 ratings

Related issues

luizParreira picture luizParreira  路  8Comments

dakairus picture dakairus  路  3Comments

marioteik picture marioteik  路  4Comments

gregogalante picture gregogalante  路  4Comments

Unforgiven-wanda picture Unforgiven-wanda  路  4Comments