-
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
Add shouldSyncFocus prop to ListItem components #40234
Add shouldSyncFocus prop to ListItem components #40234
Conversation
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.
Seems legit to me - it fixes the problem. I left you small comments
@@ -67,6 +69,8 @@ function UserListItem({ | |||
) : undefined | |||
} | |||
keyForList={item.keyForList} | |||
onFocus={onFocus} |
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.
Im not sure what this onFocus
is doing?
@@ -37,7 +38,7 @@ function BaseListItem<TItem extends ListItem>({ | |||
const pressableRef = useRef<View | HTMLDivElement>(null); | |||
|
|||
// Sync focus on an item | |||
useSyncFocus(pressableRef, Boolean(isFocused)); | |||
useSyncFocus(pressableRef, Boolean(isFocused && !shouldPreventFocusSync)); |
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.
This name is a bit much to parse 😅 I suggest to remove the prevent
from name, so that name stays positive - describing what it does, and not negated - which means I need to think more...
First we name it "prevent" but then we have to run !
before it.
I suggest to use a simpler shouldSyncFocus
name to use everywhere
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.
code LGTM pending C+ review
Reviewer Checklist
Screenshots/VideosAndroid: NativeCleanShot.2024-04-17.at.03.32.47.mp4Android: mWeb ChromeCleanShot.2024-04-16.at.15.08.45.mp4iOS: NativeCleanShot.2024-04-16.at.06.56.21.mp4iOS: mWeb SafariCleanShot.2024-04-16.at.06.59.59.mp4MacOS: Chrome / SafariCleanShot.2024-04-16.at.06.12.02.mp4MacOS: DesktopCleanShot.2024-04-16.at.06.19.23.mp4 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
helping @fedirjh debug android native build: https://expensify.slack.com/archives/C01GTK53T8Q/p1713282847932119 |
@WojtekBoman there are conflicts to resolve here |
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.
Looks good and tests well.
Conflicts resolved :) |
✋ 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/roryabraham in version: 1.4.63-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀
|
cc: @roryabraham
Details
This PR fixes an issue with losing focus on the text input after typing a letter in SelectionList components.
For example:
Screen.Recording.2024-04-15.at.14.22.15.mov
Fixed Issues
$ #39201 (comment)
PROPOSAL:
Tests
Offline tests
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 methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
Android: Native
Screen.Recording.2024-04-15.at.17.05.29.mov
Android: mWeb Chrome
Screen.Recording.2024-04-15.at.17.00.36.mov
iOS: Native
Screen.Recording.2024-04-15.at.18.06.46.mov
iOS: mWeb Safari
Screen.Recording.2024-04-15.at.17.33.54.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-15.at.16.54.14.mov
MacOS: Desktop
Screen.Recording.2024-04-15.at.16.48.47.mov