Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OnValueChange prop to Select Component #799

Closed
jobinmatt opened this issue Jan 3, 2020 · 6 comments
Closed

Add OnValueChange prop to Select Component #799

jobinmatt opened this issue Jan 3, 2020 · 6 comments
Labels
💡 Proposal 📱 Components components module-specific

Comments

@jobinmatt
Copy link

🚀 Feature Proposal

It would be nice if there was an onValueChange prop for the Select Component as this will allow updating the selectedOption when there is a stateChange on the selectedOption value.

Currently, there is only an onSelect prop which updates the selectedOption when the user selects the option manually.

@matheuszenker
Copy link

Removed select form my screens because I need to clear all the fields.

@artyorsh
Copy link
Collaborator

@matheuszenker what do you mean with clear?

@matheuszenker
Copy link

Need to set my state as empty after clicking in other component, but the select besides the state is now empty shows the value of selection, not from state.

@artyorsh
Copy link
Collaborator

@matheuszenker we've got a temporary workaround on this with #824 so you can use clear method via ref. This is going to be released soon, but we also will back to this issue in future releases

@artyorsh
Copy link
Collaborator

artyorsh commented Feb 7, 2020

@jobinmatt can you please also provide an example code of what you're trying to achieve? Seems like I couldn't catch your idea for the proper implementation

@jobinmatt
Copy link
Author

jobinmatt commented Feb 10, 2020

One of the issues that I was having was that the select component's selectedOption property (selectedOption={this.state.selected}) would not update(the selected option that is displayed by the component) when the selected state variable(this.state.selected) was updated by some other code(this.setState({selected: 'some value'})). I was hoping that there could be an onValueChange property that would get triggered and would update the displayed selectedOption when the variable referenced by the selectedOption property is updated by some code.

Here is a sample code of this implementation using the 'react-native-picker-select' library:
image

@artyorsh artyorsh added the 📱 Components components module-specific label Feb 11, 2020
@artyorsh artyorsh mentioned this issue Mar 16, 2020
Merged
2 tasks
@artyorsh artyorsh closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Proposal 📱 Components components module-specific
Projects
None yet
Development

No branches or pull requests

3 participants