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

Button label not rerendering/updating label #152

Closed CarusonSan closed 3 years ago

CarusonSan commented 3 years ago

Hello,

Following code as set out in example does not re-render the button or update the label.

Code below: <ModalSelector style={styles.modalSelector} data={CategoryData} initValue="Select Category" onChange={(itemValue) => this.setState( {category: ${itemValue.label}}, console.log('Category changed to: ', itemValue.key), ) } />

This is for both iOS and Android.

CarusonSan commented 3 years ago

This was fixed as the initValue cannot be set to a string. If a custom value is needed, use a value from state