I am storing user text input into states like so
<TextInput
placeholder = "Hello"
onChangeText = {(text) => this.setState({greeting: text})}
/>
I want to do a similar thing using react-native-modal-dropdown.
<ModalDropdown
style = {styles.enterSearch}
options = {this.state.gasOptions}
onSelect {(renderButtonText) => this.setState({gas: renderButtonText})}
/>
With this code I can select what option I want but I cannot find a way to get the value of the text option selected.
Any help would be great.
For some reason you have to put String in front of the value for it to actually read it correctly. This took me a while to figure out so I hope it helps someone else out.
<ModalDropdown
style = {styles.enterSearch}
options = {this.state.gasOptions}
onSelect {(value) => this.setState({gas: (String(this.state.gasOptions[value]))})}
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With