picker icon indicating copy to clipboard operation
picker copied to clipboard

Picker like a modal in iOS ?

Open developerdanx opened this issue 5 years ago • 2 comments

Hi, this is a question and not a bug.

It is possible to get this effect on iOS with this library ?

ex-ios

I've tried with react-native-picker-select but unfortunately is outdated.

developerdanx avatar May 25 '21 10:05 developerdanx

You can build a wrapper for the Picker that will display it like you want.

Just create a component that looks like a input (we used a TouchableOpacity wrapping a Text component). Then, in that same component create a React Native Modal that contains the actual picker and a "Done" button to close the modal.

When the user clicks the input, it will open the Modal so the user can select with the actual Picker so they can make a selection. Just needs some simple state to display the selected text in the input and state to control whether the modal is showing or not.

JCameronP avatar May 25 '21 18:05 JCameronP

You can build a wrapper for the Picker that will display it like you want.

Just create a component that looks like a input (we used a TouchableOpacity wrapping a Text component). Then, in that same component create a React Native Modal that contains the actual picker and a "Done" button to close the modal.

When the user clicks the input, it will open the Modal so the user can select with the actual Picker so they can make a selection. Just needs some simple state to display the selected text in the input and state to control whether the modal is showing or not.

thanks I was thinking the same workaround :)

developerdanx avatar May 26 '21 14:05 developerdanx