How to call a function when pressing the default react native picker in react native

117 Views Asked by At

I'm using react-native picker in dialog mode. Now I want to call a function whenever the dialog opens. How can I achieve that because there is no onPress prop? Any help will be appreciated. Please don't recommend any other packages because I want to use the default one.

1

There are 1 best solutions below

0
On

You can achieve it without using Picker, use TouchableOpacity to call a function, and in the same function just open a Modal for showing the list of items of Picker and close the Modal when selecting any item from the list.