react-native-picker / picker

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

How to have small width picker on Android? #322

Open emclab opened 3 years ago

emclab commented 3 years ago

Here is the picker code on React Native (0.64) Android:

           <Picker
                selectedValue={shippingMethod}
                mode={"dropdown"}
                style={{height: 40, width: 120}}. //<<==width 120 is still too big. How to make a smaller width picker?
                onValueChange={(itemValue, itemIndex) => {
                    setShippingMethod(itemValue)
                }}>
                <Picker.Item label="陆运" value="3" />
                <Picker.Item label="快递" value="2" />
                <Picker.Item label="特快" value="1" />
            </Picker>

Here is the how the picker looks like:

Screen Shot 2021-09-02 at 1 12 02 PM

The picker selection and the arrow-down is taking about half of the screen. How to make a smaller width picker? The current problem is that if width is too small, such as 80, then the selection result disappears and not visible.

NicolayS commented 3 years ago

Hello guys, I have exactly the same question, the funny thing is previous version from "react-native" works with such task easily. I cannot realize why this version is going to replace the previous one, if this version cannot accomplish functionality previous one.

Cmoen11 commented 2 years ago

No response? When trying to make them smaller, It will replace the content with dots, even though there is plenty of space left?

KevinvdBurg commented 2 years ago

I have the same issue! Is there any update?

elimau commented 1 year ago

This seems like a big issue as it does not work on android without giving it a width. Also the width requirement is not part of the documentation. Hence this is a bug. Is there any update?