-
Notifications
You must be signed in to change notification settings - Fork 6
Updated pin view #1
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
base: master
Are you sure you want to change the base?
Conversation
…hrough the every time user presses a key. The parent must now provide the value to the component through the setting - see the README for example.
| @@ -0,0 +1,3 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remove ide-specific file from commit.
|
|
||
| Required options: | ||
| * Pincode (`pinCode`) - this is the value displayed and modified by the `Pin` component | ||
| * Callback method (`onPinEntered(value)`) - this is called for everytime the use touches the keyboard (except when a digit is pressed and the `pinLength` has been reached) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, rename props to value and onChange.
Upgrade to RN 0.46.4 gives warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to merge it after you fix the things I mentioned in comments above.
| render() { | ||
| // Extract props | ||
| const pinCode = this.props.pinCode; | ||
| const pinLength = this.props.pinLength ? this.props.pinLength : this.defaultProps.pinLength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you fixed defaultProps defintion, you can simply do like this:
const {pinCode, pinLength, prompt} = this.props;
| const dots = makeDots(pinLength - pinCode.length); | ||
|
|
||
| // Build buttons | ||
| const clearButton = this.buildButton(clearVisible, "Clear", () => this.doClear()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, explicitly bind event handlers to this in constructor (not in render function). Something like this would do:
constructor(props) { super(props); this.handleClear = this.handleClear.bind(this); }
I have made a some updates to the
Pincomponent to make it more usable, at least for our purposes :)Hope you will like them and like to merge to them.