2

So I've been looking for a dropdown picker to be toggled on "on Press" since yesterday yet I found nothing, all I want is to put an icon in a "touchable Opacity", and when pressed the dropdown picker shows. I've been advised to use "react-native-picker-select" library, I imported it and added the usage advised by the library like this

const Dropdown = () => {
     return (
         <RNPickerSelect
             onValueChange={(value) => console.log(value)}
             items={[
                 { label: 'Football', value: 'football' },
                 { label: 'Baseball', value: 'baseball' },
                 { label: 'Hockey', value: 'hockey' },
             ]}
         />
     ); };

then I called it from the "on Press" but its showing nothing, so what am I missing?

1 Answers1

0

I think you are trying to call whole element on pressing the button, but there is no need to do that because react-native-picker-select by default supports on press focus which you want. While native 'Picker' from 'react-native' does not support that.

So, you can add this directly like a View or TouchableOpacity. For example:

const App = () => {
    return (
         <View />
         <RNPickerSelect />
         ...
    );
}