-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD for payment 2022-12-20] [HOLD] [$1000] Mobile keyboard doesn't include /
char when expiration field is in focus
#13133
Comments
Triggered auto assignment to @kadiealexander ( |
ProposalI suggest that we change the placeholder to Line 415 in 3e47bce
Another solution is to remove the keyboard this way the user can switch the keyboard to add numbers and / We have keyboard type numbers-and-punctuation but it is only for ios. If we change this to numbers-and-punctuation this won't be a problem in ios and in android user will see default keyboard. We can also use platform specific file and use phone-pad for android.
Here's a vid of phone-pad - Screen.Recording.2022-11-29.at.9.24.07.PM.movHere's numbers-and-punctuation keyboard
|
@Julesssss is this about not able to add from keyboard? or not able to add slash at all? I remember working on this PR here to add auto-slash |
Not during my testing today. We use the numerical keyboard type, and it wasn't auto-added. I do also recall a conversation about this though 😕 |
It was removed here. |
From this SO: https://stackoverflow.com/c/expensify/questions/14418
|
Current assignee @kadiealexander is eligible for the External assigner, not assigning anyone new. |
/
char when expiration field is in focus/
char when expiration field is in focus
Job added to Upwork: https://www.upwork.com/jobs/~01f986d0cdc2cf028e |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
Current assignee @Julesssss is eligible for the External assigner, not assigning anyone new. |
@Julesssss, any thoughts on this? We can't interfere with the value right now. We need to wait and see if someone can refactor the |
Proposal
<TextInput
inputID="expirationDate"
label={this.props.translate('addDebitCardPage.expiration')}
placeholder={this.props.translate('addDebitCardPage.expirationDate')}
keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD}
+ shouldAppendSlash
/>
this.inputRefs = {};
this.touchedInputs = {};
this.setTouchedInput = this.setTouchedInput.bind(this);
....
+ /**
+ * Append slash if needed e.g. ExpirationDate input
+ * @param {string} inputValue - input value on text change event
+ * @param {string} inputKey - key of state for specific input field
+ * @returns {string}
+ */
+ appendSlashIfNeeded(inputValue, inputKey) {
+ let slashAppended = inputValue;
+ const inputStateValue = this.state.inputValues[inputKey]
+ if (inputStateValue && inputValue.length < inputStateValue.length
+ && (((inputValue.length === 3 && inputValue.charAt(2) === '/')
+ || (inputValue.length === 2 && inputStateValue.charAt(1) === '/')))) {
+ slashAppended = inputValue.substring(0, inputValue.length - 1);
+ } else if (inputValue.length === 2 && _.indexOf(inputValue, '/') === -1) {
+ // An Expiry Date was added, so we should append a slash '/'
+ slashAppended = `${inputValue}/`;
+ } else if (inputValue.length > 2 && _.indexOf(inputValue, '/') === -1) {
+ // Expiry Date with MM and YY without slash, hence adding slash(/)
+ slashAppended = `${inputValue.slice(0, 2)}/${inputValue.slice(2)}`;
+ }
+ return slashAppended;
+ }
...
onInputChange: (value, key) => {
const inputKey = key || inputID;
- this.setState(prevState => ({
- inputValues: {
- ...prevState.inputValues,
- [inputKey]: value,
- },
- }), () => this.validate(this.state.inputValues));
+ if (child.props.shouldAppendSlash) {
+ const slashAppended = this.appendSlashIfNeeded(value, inputKey);
+ this.setState(prevState => ({
+ inputValues: {
+ ...prevState.inputValues,
+ [inputKey]: slashAppended,
+ },
+ }), () => this.validate(this.state.inputValues));
+ } else {
+ this.setState(prevState => ({
+ inputValues: {
+ ...prevState.inputValues,
+ [inputKey]: value,
+ },
+ }), () => this.validate(this.state.inputValues));
+ }
...
Screen.Recording.2022-11-30.at.4.28.21.PM.mov |
ProposalWe can use
|
@railway17, I don't think that's a good solution. We want to keep the logic at AddDebitCardPage.js. |
@varshamb, how is that going to solve this issue? |
ProposalWe can receive a new <TextInput
inputID="expirationDate"
label={this.props.translate('addDebitCardPage.expiration')}
placeholder={this.props.translate('addDebitCardPage.expirationDate')}
keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD}
+ transformer={this.addOrRemoveSlashToExpiryDate}
/> The
And we will use that function on Form children +const transformer = lodashGet(child.props, 'transformer', (v1, v2) => v2);
.....
onInputChange: (value, key) => {
const inputKey = key || inputID;
this.setState(prevState => ({
inputValues: {
...prevState.inputValues,
- [inputKey]: value,
+ [inputKey]: transformer(prevState.inputValues[inputKey], value),
},
}), () => this.validate(this.state.inputValues));
....
} Result 327907.t.mp4 |
That looks great @bernhardoj! I need to test all the cases first since it can cause regression. It's EOD for me, I will test this in the morning. Meanwhile can you update the proposal to resolve eslint errors? |
Also cc: @Julesssss. Should we get some opinions on slack ? Concerned because of this part. |
Sorry, I am not aware there is some eslint errors. I have updated the code. @thesahindia |
Gentle bump @Julesssss |
Yeah, given that this has been discussed before we should probably discuss further. I'm going to hold this in the meantime. |
/
char when expiration field is in focus/
char when expiration field is in focus
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.38-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2022-12-20. 🎊 After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
/
char when expiration field is in focus/
char when expiration field is in focus
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Paid @thesahindia and @Puneet-here the price + bonus for this issue. |
^ This was not a regression |
@Julesssss , we still want BZ to update the regression steps in TestRail so QA can check, right? |
@Julesssss, @kadiealexander, @thesahindia, @Puneet-here Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@Julesssss, @kadiealexander, @thesahindia, @Puneet-here Eep! 4 days overdue now. Issues have feelings too... |
No actions are needed from me so unassigning. |
@Julesssss, bumping to get your thoughts on #13133 (comment) |
Jules is on leave until next week. |
Not overdue. |
Hey, sorry but I ran out of time for this today. Will return to this tomorrow. |
I don't think so in this case. This was specifically designed this way originally, and we simpy improved it. |
I'm going to close this due to the above reasoning, but let me know if you disagree @mallenexpensify and we can discuss further |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
CC @Gonals
Action Performed:
Expected Result:
/
char should appear in the soft keyboard, or we should automatically add it for usersActual Result:
/
char appears in the soft keyboard, or do we automatically add it for usersNote: Users still seem to pass validation without it, but this is still confusing
Platform:
Where is this issue occurring?
Version Number: all
Reproducible in staging?: yes
Reproducible in production?: yes
Email or phone of affected tester (no customers): all
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: