-
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 can't press pay button if edit composer is focused #53680
Fix can't press pay button if edit composer is focused #53680
Conversation
@DylanDylann 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] |
// When the edit composer loses focus, we want to show the main composer. | ||
// If it loses focus due to a pressable being pressed, the press event might not be captured. | ||
// To address this, we delay showing the main composer to allow the press event to complete. | ||
setTimeout(() => { |
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.
You can use React Native's InteractionManager
for a more elegant solution. It ensures the action is executed after all ongoing interactions (e.g., when the press event is complete):
import { InteractionManager } from 'react-native';
const setShouldShowComposeInputKeyboardAware: SetShouldShowComposeInputKeyboardAware = (shouldShow) => {
InteractionManager.runAfterInteractions(() => {
Composer.setShouldShowComposeInput(shouldShow);
});
};
I think this approach is cleaner and more reliable and avoids the need for arbitrary delays using setTimeout
.
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.
@bernhardoj is this resolved ?
@bernhardoj Could you raise a discussion on Slack about using runAfterInteractions and setTimeout (with 0 milisecond) in our app? |
From the past discussion, it's not preferable to use
If you're concerned with this, we are not using arbitrary delay. Interaction manager also uses the same 0 delay. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-10.at.11.55.33.movAndroid: mWeb ChromeScreen.Recording.2024-12-10.at.11.53.41.moviOS: NativeScreen.Recording.2024-12-10.at.12.00.27.moviOS: mWeb SafariScreen.Recording.2024-12-10.at.11.59.55.movMacOS: Chrome / SafariScreen.Recording.2024-12-10.at.11.56.05.movMacOS: DesktopScreen.Recording.2024-12-10.at.11.57.01.mov |
@bernhardoj minor suggestion. The rest looks fine |
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.
LGTM
✋ 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/Beamanator in version: 9.0.74-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.74-8 🚀
|
Explanation of Change
Fixed Issues
$ #53140
PROPOSAL: #53140 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4