Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.03k stars 2.54k forks source link

Fix split amount input does not animate smoothly #42241

Closed bernhardoj closed 3 days ago

bernhardoj commented 2 weeks ago

Details

The input currently use autoGrow which needs to initialize the width from the onLayout event, so for a brief moment, the width is 0. This PR changes it to a fixed width input.

Fixed Issues

$ https://github.com/Expensify/App/issues/41751 PROPOSAL: https://github.com/Expensify/App/issues/41751#issuecomment-2099742434

Tests

Same as QA Steps

Offline tests

Same as QA Steps

QA Steps

  1. Open split bill from FAB and enter any amount
  2. Select any user participant and press next
  3. In the confirm page, verify the split input shows without delay
    • [x] Verify that no errors appear in the JS console

PR Author Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/App/assets/50919443/79ef7c28-ae35-4331-a5e3-f5d0e5d9155d
Android: mWeb Chrome https://github.com/Expensify/App/assets/50919443/cda81540-1f58-440f-9843-ea7aa2a818b0
iOS: Native https://github.com/Expensify/App/assets/50919443/41039adc-5708-4614-8139-fb7805c9f1d7
iOS: mWeb Safari https://github.com/Expensify/App/assets/50919443/fc250cff-5e8f-4dd6-aaf1-793d7c9a9f59
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/50919443/bfabcd6c-6cf0-43bc-bb03-4e8499f49aac
MacOS: Desktop https://github.com/Expensify/App/assets/50919443/da16da90-7e40-40c3-ba98-18b9d03e017d
melvin-bot[bot] commented 2 weeks ago

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

melvin-bot[bot] commented 2 weeks ago

@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

bernhardoj commented 2 weeks ago

@youssef-lr I noticed another issue. The cents amount doesn't show immediately as you can see from the video below (0:10)

https://github.com/Expensify/App/assets/50919443/c7793744-d8c2-4079-a64d-19660839c920

This is because the initial state of the amount is always converted to the FE amount that removes the cent (/ 100).

https://github.com/Expensify/App/blob/e9cf0c53b9874d8449b2f04b06b1ff93a7094f4b/src/components/MoneyRequestAmountInput.tsx#L116-L118

I want to do it like this

https://github.com/Expensify/App/blob/e9cf0c53b9874d8449b2f04b06b1ff93a7094f4b/src/components/MoneyRequestAmountInput.tsx#L185

but I think formatAmountOnBlur doesn't sound correct. Should we rename it to something else or just keep the name?

bernhardoj commented 1 week ago

Ok I fixed it by moving the logic to a prop (onFormatAmount), this allows for more reusablity for having different formatting logic.

youssef-lr commented 1 week ago

I noticed another issue. The cents amount doesn't show immediately as you can see from the video below

I don't remember seeing this issue initially, could it be from the refactor to using UserListItem?

youssef-lr commented 1 week ago

bump @abdulrahuman5196 for review please

abdulrahuman5196 commented 4 days ago

Checking now

abdulrahuman5196 commented 4 days ago

@bernhardoj I am seeing layout issues in android chrome which is not present in staging. Other platforms there is no issue. Could you check on this?

https://github.com/Expensify/App/assets/46707890/931e04c2-1e29-41e7-ba71-84db099f700c

bernhardoj commented 4 days ago

IT's a known issue. I have merged with main to pull the fix.

abdulrahuman5196 commented 4 days ago

IT's a known issue. I have merged with main to pull the fix.

Got it. Thank you.

abdulrahuman5196 commented 4 days ago

Reviewer Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/App/assets/46707890/423d210e-2095-424d-9fbc-0a325313bc7a
Android: mWeb Chrome https://github.com/Expensify/App/assets/46707890/8f2953cd-7f5f-4df8-b477-77651315be34
iOS: Native https://github.com/Expensify/App/assets/46707890/90aa3740-02ff-455b-b9df-c516123f0e29
iOS: mWeb Safari https://github.com/Expensify/App/assets/46707890/25f1ab7a-b0c0-44d3-b2e1-9974370a295d
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/46707890/62219d2c-c0c0-47ae-87f2-1bd83187a19f
MacOS: Desktop https://github.com/Expensify/App/assets/46707890/ff818906-b4aa-4a1a-a441-8e33ce92e39b
OSBotify commented 3 days ago

:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

OSBotify commented 2 days ago

πŸš€ Deployed to staging by https://github.com/youssef-lr in version: 1.4.77-11 πŸš€

platform result
πŸ€– android πŸ€– failure ❌
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ…
OSBotify commented 2 days ago

πŸš€ Deployed to staging by https://github.com/youssef-lr in version: 1.4.77-11 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 success βœ…
πŸ•Έ web πŸ•Έ success βœ