-
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
fix 22610: Request Money input is not getting focus when navigating back #22985
fix 22610: Request Money input is not getting focus when navigating back #22985
Conversation
@eVoloshchak 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] |
@@ -125,6 +125,16 @@ class BaseOptionsSelector extends Component { | |||
} | |||
|
|||
componentDidUpdate(prevProps) { | |||
if (this.props.autoFocus && !prevProps.isFocused && this.props.isFocused) { | |||
InteractionManager.runAfterInteractions(() => { | |||
// Focus text input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment should say why, on top of what, here's a suggestion, but feel free to add your own update
// Focus text input | |
// If we automatically focus on a text input when mounting a component, | |
// let's automatically focus on it when the component updates as well (eg, when navigating back from a page) |
if (!this.textInput) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this to the top of the function? If we don't have a textInput, we don't need the if, or the call to InteractionManager, right
@cead22 Thanks for your suggestion. I just updated my PR a bit |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-07-19.at.18.12.53.movMobile Web - Chromescreen-20230719-182257.mp4Mobile Web - SafariScreen.Recording.2023-07-19.at.18.17.40.movDesktopScreen.Recording.2023-07-19.at.18.49.55.moviOSScreen.Recording.2023-07-19.at.18.15.54.movAndroidscreen-20230719-182123.mp4 |
There's no keyboard shown when input is focused on mobile Safari, this is known and handled in #10414 Screen.Recording.2023-07-19.at.18.46.56.mov |
@cead22 Can you help review my PR? Thanks |
@cead22 any updates? |
Sorry I was assigned on Wednesday and I was OOO on Thursday and Friday |
✋ 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 staging by https://github.com/cead22 in version: 1.3.45-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.45-7 🚀
|
Details
Inside
BaseOptionSelector
, add focus logic in componentDidUpdate so that the input focus after navigating back.Fixed Issues
$ #22610
PROPOSAL: #22610 (comment)
Tests
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
22610-web.mov
Mobile Web - Chrome
22610-mweb-chrome.mov
Mobile Web - Safari
22610-mweb-safari.mov
Desktop
22610-desktop.mov
iOS
22610-ios.mov
Android
22610-android.mov