#6547 add continious deletion of IOU amount on long press#6626
Conversation
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
|
Applied the changes suggested by @parasharrajat |
parasharrajat
left a comment
There was a problem hiding this comment.
LGTM and tests well.
All yours @iwiznia
| * | ||
| * @param {String} key | ||
| */ | ||
| handleLongPressNumberPad(key) { |
There was a problem hiding this comment.
Hmmm shouldn't all this logic be on the BigNumberPad component? Do we expect any BigNumberPad were we don't want long presses to work? I would think we always want this behavior, so reimplementing it on each caller sounds worse than just incorporating it to that component.
There was a problem hiding this comment.
Good point, I was thinking the same but had doubts.
There was a problem hiding this comment.
Basically, my point was Continues keypress event timer logic should be inside the BigNumberPad. This callback should just be doing side-effect.
So that each key reflect the same behaviour and we can choose to execute only on < for now.
There was a problem hiding this comment.
But that component doesn't have any state itself, it is simply responsible to passing the callbacks to the buttons.
Or do you think we should pass some 'deleteSingleChar' prop to the number pad and call it with setInterval inside the BigNumberPad?
There was a problem hiding this comment.
Yup, so you just need to trigger the passed callback as you do now. But longPress will trigger that multiple times.
There was a problem hiding this comment.
Ah, I got you. There is no need for a new prop, I need to call the one that is already used for single press. 👍
There was a problem hiding this comment.
@parasharrajat @iwiznia
I have updated the PR with the change you requested, please review.
parasharrajat
left a comment
There was a problem hiding this comment.
Do not follow StyleGuide. Please have a read of https://github.com/Expensify/App/blob/main/STYLING.md and https://github.com/Expensify/App/blob/main/STYLE.md.
Do you want me to rewrite the component as class component? Before committing I have checked for usages of Anyway, just let me know if that's what you meant. I am slightly confused by you referencing the styling doc where this PR doesn't touch any styles whatsoever. Thanks. |
Yeah, this should be converted to the class component. You should follow styleGuide as much as possible. Exceptions could be made but do you think that is necessary here. I am sure you read the comment on the component App/src/components/AddressSearch.js Line 38 in 5f154bc |
|
Ah, no. I missed that comment, sorry. I will try to update the Thank you. |
|
Updated PR with requested change: rewrite |
| if (key !== '<') { | ||
| return; | ||
| } |
There was a problem hiding this comment.
This should not be part of BigNumberPad. This should be handled in the parent component. The only job of this method should be to call the long press callback on time intervals emitting continuous long-press.
There was a problem hiding this comment.
Sorry, but I don't quite understand. There is no more long press callback in that context. I think we have agreed that this entire logic should be moved to BigNumberPad component.
I have just reread the thread above and @iwiznia clearly says "shouldn't all this logic be on the BigNumberPad component". If we are to do
if (key !== '<') {
return;
}inside parent component we would need to also pass some new arg to callback to indicate that the keyPress was started by the timer. And overall moving it to parent component would mean that we'll have timers on every button and not just the <.
There was a problem hiding this comment.
I agree with @dklymenk, not sure why would anyone want to handle the long presses differently. But even if at some point we do want that, we can extract the logic then.
There was a problem hiding this comment.
OK, I give it a go for now. I still feel that all keys should have the same behaviour irrespective of the Key. If we only want to handle long-press for < then it should be a parent to control that.
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
|
I think this solution is good, but will let @parasharrajat merge or keep engaging on the discussion above. |
parasharrajat
left a comment
There was a problem hiding this comment.
LGTM. we are good to merge @iwiznia .
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to production by @Julesssss in version: 1.1.21-1 🚀
|
Details
This PR adds a long press handler to delete button on mobile numpad that starts continuous deletion of characters until it is released.
Fixed Issues
$ #6547
Tests / QA Steps
Tested On
Screenshots
Web
Mobile Web
Simulator.Screen.Recording.-.iPhone.12.-.2021-12-08.at.12.02.18.mp4
Desktop
iOS
Simulator_Screen_Recording_iPhone_12_2021_12_07_at_22_05_53.mp4
Android
6547-android.mp4