Skip to content
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

[$500] Request money - Text input isn't auto focused after screen transition ends #27450

Closed
6 tasks
lanitochka17 opened this issue Sep 14, 2023 · 14 comments
Closed
6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 14, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Issue found when executing PR #27294

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Press FAB >> Request money >> Distance
    Choose Start & End locations >> Next

Expected Result:

Verify that the text input is auto focused after screen transition ends

Actual Result:

Text input isn't auto focused after screen transition ends

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.70-2

Reproducible in staging?: Yes

Reproducible in production?: Yes

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6200485_27294_Safari.mp4

Bug6200485_focus_2

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bfadaee4d9a59119
  • Upwork Job ID: 1702347116753686528
  • Last Price Increase: 2023-09-14
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Triggered auto assignment to @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@akinwale
Copy link
Contributor

akinwale commented Sep 14, 2023

Proposal

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

Text input isn't auto focused after screen transition ends when creating / editing a waypoint in the distance request waypoint editor

What is the root cause of that problem?

The screen entry transition end event handler in WaypointEditor doesn't always fire except the screen is at the top of the navigation stack.

onEntryTransitionEnd={() => textInput.current && textInput.current.focus()}

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

We are now using a new approach to autofocus text inputs upon launching a screen according to https://expensify.slack.com/archives/C01GTK53T8Q/p1694660990479979

Implement these changes in the WaypointEditor component.

  1. Add the timeout ref and the useFocusEffect hook.
const focusTimeoutRef = useRef(null);
useFocusEffect(useCallback(() => {
    focusTimeoutRef.current = setTimeout(() => textInput.current && textInput.current.focus(), CONST.ANIMATED_TRANSITION);
    return () => {
        if (!focusTimeoutRef.current) {
            return;
        }
        clearTimeout(focusTimeoutRef.current);
    };
}, []));
  1. Remove the onEntryTransitionEnd prop from the root ScreenWrapper for cleanup.

What alternative solutions did you explore? (Optional)

None.

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Sep 14, 2023
@melvin-bot melvin-bot bot changed the title Request money - Text input isn't auto focused after screen transition ends [$500] Request money - Text input isn't auto focused after screen transition ends Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01bfadaee4d9a59119

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Current assignee @lschurr is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

@Inspired715
Copy link

This works well in my end.
What's wrong with you?
Thanks.

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

📣 @dev3606! 📣
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. 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.
  2. 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.
  3. 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>

@PiyushChandra17
Copy link

PiyushChandra17 commented Sep 14, 2023

Proposal

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

Text input isn't auto focused after screen transition ends

What is the root cause of that problem?

We are using onEntryTransitionEnd on ScreenWrapper component.

onEntryTransitionEnd={() => textInput.current && textInput.current.focus()}

onEntryTransitionEnd is only fired for the top card in the stack, and therefore does not fire on the new top card when popping a card off the stack.

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

We need to add useFocusEffect hook and remove onEntryTransitionEnd from ScreenWrapper in WaypointEditor component.

import { useFocusEffect } from '@react-navigation/native';

const focusTimeoutRef = useRef(null);
useFocusEffect(useCallback(() => {
    focusTimeoutRef.current = setTimeout(textInputRef.current.focus, CONST.ANIMATED_TRANSITION);
    return () => {
        if (!focusTimeoutRef.current) {
            return;
        }
        clearTimeout(focusTimeoutRef.current);
    };
}, []));

What alternative solutions did you explore? (Optional)

NA

@Inspired715
Copy link

Inspired715 commented Sep 14, 2023 via email

@Inspired715
Copy link

Inspired715 commented Sep 14, 2023 via email

@sakluger
Copy link
Contributor

This is a duplicate of #27202.

@Inspired715
Copy link

Inspired715 commented Sep 14, 2023 via email

@akinwale
Copy link
Contributor

This is a duplicate of #27202.

@sakluger This deals with the screens for picking the waypoints, while #27202 deals with the screen for picking the target workspace, so I'd say they're different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

7 participants