0

I am trying to create a drop down menu using Expo and React-native-picker.

                 <TouchableOpacity style={styles.pickerContainer}>
                    <Picker 
                        selectedValue={selectedProduct}
                        style={styles.pickerStyle}
                        itemStyle={styles.pickerItemStyle}
                        onValueChange={(value, key) => {
                            setSelectedProduct(value)
                        }}
                        
                        
                    >   
                        {getProductOptions(products)}
                    </Picker>
                </TouchableOpacity> 

When I run expo start the drop down menu appears just as I want. However, when I open it in iOS simulator, I get a scroll wheel. Is there a some prop that needs to be changed to get the drop down menu in iOS?

  • As far as I know that is just how the ios picker looks. I think it's easier to look for alternative ui elements to choose from that look more like the drop down menu you're looking for. Relevant post https://stackoverflow.com/q/41181683/9098350. – 5eb Nov 08 '20 at 16:11

1 Answers1

0

React-native-picker has a prop mode('dialog', 'dropdown') but unfortunally it is only supported in ANDROID . if you want to show dropdown in ios also, you have to change the library.

You can try https://github.com/hossein-zare/react-native-dropdown-picker

Mehran Khan
  • 3,616
  • 1
  • 13
  • 10