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.
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.
@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 |
|
✋ 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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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