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

Bug: Make height and width required in the style prop #411

Open ShivamJoker opened 2 years ago

ShivamJoker commented 2 years ago

The picker doesn't work at all if we don't specify width and height, and there is no mention in the docs that we need to put it to make it work.

If we can have a default or height width or at least require it then it would be great for new devs cause I had to waste lot of minutes figuring it out.

Maria199714 commented 1 year ago

It is really right ,I spent much time to find this reason, Thanks.

tempranova commented 1 year ago

Chiming in to agree with this

Osamasomy commented 1 year ago

Thats how i solve my problem.

<Picker
    placeholder={placeholder}
    selectedValue={value}
    onValueChange={setValue}
    mode='dropdown'
    style={{
        borderRadius: 5,
        fontSize: 12,
        transform: [
            { translateY: Platform.OS === "ios"? -8: -8 }, // Adjust this value to align the arrow and label
            // { translateX: -5 }, // Adjust this value to align the arrow and label
            {scaleY: .9},
            // {scaleX: 1},
        ]
    }}
    itemStyle ={{
        fontSize: 12,

    }}
    {...dropdownProps}
    >
        <Picker.Item label={placeholder} value={""} />
</Picker>

Also refresh the application once you change in transform property.