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

What's the use of this.props.onChange && this.props.onChange(valueRating)? #2

Open
aziz-boudi4 opened this issue Nov 3, 2018 · 1 comment

Comments

@aziz-boudi4
Copy link

aziz-boudi4 commented Nov 3, 2018

Thanks for your work.
I have a question out of curiosity:
What is the use of this.props.onChange && this.props.onChangeMove(valueRating)?

What's the idea behind setting the state in the component and also setting the state of the parent by using this.props.onChange && this.props.onChangeMove(valueRating)?

Thanks

@aziz-boudi4 aziz-boudi4 changed the title What What's the use of this.props.onChange && this.props.onChange(valueRating) Nov 3, 2018
@aziz-boudi4 aziz-boudi4 changed the title What's the use of this.props.onChange && this.props.onChange(valueRating) What's the use of this.props.onChange && this.props.onChange(valueRating)? Nov 3, 2018
@DevAlien
Copy link
Owner

DevAlien commented Nov 3, 2018

The idea of having the onChange and onChange move is to keep track of the current value.

The inChange is triggered just when it stops moving the finger. The inChange nove returns the value Everytime the finger moves on the rating.

In the example you can see the usage of those. https://github.com/DevAlien/react-native-rating-simple/blob/master/example/App.js

Basically I show on top, the actual value of the rating thanks to those callbacks.

In the last example (mapped) it displays a word instead of a number.

Let me know if this answers your question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants