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.14k stars 2.63k forks source link

[HOLD for payment 2024-07-10] [HOLD for payment 2024-07-02] [$250] Message - Send button not response in mobile view and after returning to normal view #43650

Closed izarutskaya closed 1 week ago

izarutskaya commented 1 month ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v1.4.82-4 Reproducible in staging?: Y Reproducible in production?: Y Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team

Action Performed:

  1. Open any chat
  2. Send message by clicking on Send button
  3. Open DevTools console
  4. Switch to mobile view
  5. Type a message
  6. Click on Send Button

Expected Result:

Message sent in mobile view as in normal

Actual Result:

Send button not response. Also, after returning to normal view, Send button not response. User need to reload page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

https://github.com/Expensify/App/assets/115492554/28e95393-c8a0-448b-8788-9908726acbed

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013bc99e56ff65d5ac
  • Upwork Job ID: 1801304586589536855
  • Last Price Increase: 2024-06-13
  • Automatic offers:
    • hoangzinh | Reviewer | 102782090
    • truph01 | Contributor | 102782092
Issue OwnerCurrent Issue Owner: @isabelastisser
melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

izarutskaya commented 1 month ago

We think this issue might be related to the #vip-vsb

melvin-bot[bot] commented 1 month ago

Job added to Upwork: https://www.upwork.com/jobs/~013bc99e56ff65d5ac

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External)

vaib-contrib commented 1 month ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

issue is reproducible from the steps mentioned in the issue. In browser, send message button from the chat doesn't register tap event when responsive-mode is turned-on-and-or-off from devtools, until the browser is refreshed.

What is the root cause of that problem?

For send button, we are using GestureDetector from react-native-gesture-handler lib's tap gesture, which is not necessary, and a quick search through codebase results in about 2 places where GestureDetector is used exclusively for tap interactions, while in other cases, PressableWithFeedback or PressableWithoutFeedback is used.

Places where GestureDetector is used for detecting a tap:

  1. Send Button (related to this issue) https://github.com/Expensify/App/blob/361a0000f119618b49076fa51e53560ec2195ac1/src/pages/home/report/ReportActionCompose/SendButton.tsx#L34-L36
other two places... 2. IOURequestStepScan (may be affected) https://github.com/Expensify/App/blob/d565bb1bd068e154a1e90a8d9cb1c6bd004b9844/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx#L488-L490 3. MagicCodeInput (may be affected) https://github.com/Expensify/App/blob/6c3f60519ee716ea91aeab156bac43362831d458/src/components/MagicCodeInput.tsx#L362-L363

What changes do you think we should make in order to solve the problem?

The straight forward solution would be to remove the GestureDetector wrapper, and use TouchableWithFeedback's onPress callback instead. I have tested it locally, and it works fine.

The SendButton component would look like:

  <View
        style={styles.justifyContentEnd}
        // Keep focus on the composer when Send message is clicked.
        onMouseDown={(e) => e.preventDefault()}
    >
        <Tooltip text={translate('common.send')}>
          <PressableWithFeedback
              style={({pressed, isDisabled}) => [
                  styles.chatItemSubmitButton,
                  isDisabledProp || pressed || isDisabled ? undefined : styles.buttonSuccess,
                  isDisabledProp ? styles.cursorDisabled : undefined,
              ]}
              role={CONST.ROLE.BUTTON}
              accessibilityLabel={translate('common.send')}
              disabled={isDisabledProp}
              onPress={handleSendMessage}
          >
            ...

What alternative solutions did you explore? (Optional)

Thinking of confirming if it's an upstream issue with react-native-gesture-handler library for web, if we really need to use GestureDetector in this particular case.

melvin-bot[bot] commented 1 month ago

πŸ“£ @vaib-contrib! πŸ“£ Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
melvin-bot[bot] commented 1 month ago

βœ… Contributor details stored successfully. Thank you for contributing to Expensify!

truph01 commented 1 month ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

What is the root cause of that problem?

What alternative solutions did you explore? (Optional)

isabelastisser commented 1 month ago

Bump @hoangzinh to review the proposals above. Thanks!

hoangzinh commented 1 month ago

Thanks for proposals, everyone.

https://github.com/Expensify/App/assets/9639873/6685efb0-0f70-4f1b-8fed-824a372722ec

truph01 commented 1 month ago

@hoangzinh The video player progress uses Gesture.Pan(), not Gesture.Tap() so there is no issue with it.

hoangzinh commented 1 month ago

@truph01 how about MagicCode? https://github.com/Expensify/App/blob/3e1d94a22e93bdd66753f8f5a955ec5e3b5d366a/src/components/MagicCodeInput.tsx#L214

truph01 commented 1 month ago

@hoangzinh I see that the MagicCodeInput always mounts again one we change from large screen to small screen, so there is no similar bug. You can try to add the below logic to that file:

    useEffect(()=>{
        console.log("mounted")
    }, [])
truph01 commented 1 month ago

@hoangzinh As you can see in this logic, https://github.com/software-mansion/react-native-gesture-handler/blob/0b983ed9dd6c7e11d3b6906a85faa535346a16e0/src/handlers/gestures/GestureDetector/index.tsx#L154-L160, the attachHandler function (that will make the gesture works properly) is only called one time when the component is mounted.

That is why in my solution, I added the key prop, and every time a component's key changes React will create a new component instance rather than update the current one.

hoangzinh commented 1 month ago

Looks good, can you add above into your proposal so internal engineer can review it as well? Thanks

truph01 commented 1 month ago

@hoangzinh I updated proposal

hoangzinh commented 1 month ago

@truph01's proposal https://github.com/Expensify/App/issues/43650#issuecomment-2167195682 looks good to me

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 1 month ago

πŸ“£ @hoangzinh πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 1 month ago

πŸ“£ @truph01 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

truph01 commented 1 month ago

@hoangzinh PR https://github.com/Expensify/App/pull/43976 can be reviewed

melvin-bot[bot] commented 3 weeks ago

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] commented 3 weeks ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.1-19 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-02. :confetti_ball:

For reference, here are some details about the assignees on this issue:

melvin-bot[bot] commented 3 weeks ago

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:

melvin-bot[bot] commented 2 weeks ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.3-7 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-10. :confetti_ball:

For reference, here are some details about the assignees on this issue:

melvin-bot[bot] commented 2 weeks ago

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:

isabelastisser commented 1 week ago

Bump @hoangzinh to complete the checklist above before payment. Thanks!

hoangzinh commented 1 week ago

BugZero Checklist:

isabelastisser commented 1 week ago

@hoangzinh $250 automatic offer (Reviewer), please accept the offer in Upwork, and I will process the payment. Thanks!

@truph01 automatic offer (Contributor). The payment is processed in Upwork.

isabelastisser commented 1 week ago

all set!

hoangzinh commented 1 week ago

Accepted. Thanks @isabelastisser