peacechen / react-native-modal-selector

A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sections.
MIT License
369 stars 129 forks source link

updates to initValue do not update, even if you cancel onChange #164

Closed Seanmclem closed 3 years ago

Seanmclem commented 3 years ago

So I have my initValue set to a variable that I update when onChange runs. However, if I don't update the value in onChange function -the value in the component's button still updates, even though the tracked variable does not. How can I prevent the value in the components button from updating. Or how exactly can I control it, after the initValue?

I understand that I can use the visible prop to control the menu, and theoretically replace the button provided by the component with another. But, how can I hide the original button provided by the component? Is that better? Is there a real example of that?

Seanmclem commented 3 years ago

Turns out you can just pass whatever you want as the Child of ModalSelector, and that will replace the button provided by the modal, and it will be TouchableOpacity, which satisfies exactly what I need