Repository navigation
FIX: iOS - Expose Pager's internal onPageSelected as onTabSelect to fix Start chat tab switching input fields losing focus - #60468
Conversation
…cus when switching between tabs
|
|
| // @ts-expect-error - props not used | ||
| function WorkspaceNewRoomPage(props, ref: React.Ref<WorkspaceNewRoomPageHandle>) { |
There was a problem hiding this comment.
Ref forwarding, I'll remove the @ts-expect-error though 👍
| const isIOSNative = getPlatform() === CONST.PLATFORM.IOS; | ||
| // We're disabling the useAutoFocusInput functionality on iOS native because we're using the new `onPageSelected` focus method in `NewChatSelectorPage`, otherwise keeping it to align the behavior on all platforms | ||
| const {inputCallbackRef} = useAutoFocusInput(undefined, isIOSNative); | ||
| const roomPageInputRef = useRef<AnimatedTextInputRef>(null); |
There was a problem hiding this comment.
| const roomPageInputRef = useRef<AnimatedTextInputRef>(null); | |
| const roomPageInputRef = useRef<AnimatedTextInputRef | null>(null); |
| return; | ||
| } | ||
| inputCallbackRef(inputRef); | ||
| // @ts-expect-error - inputRef.current is not read-only |
There was a problem hiding this comment.
| // @ts-expect-error - inputRef.current is not read-only |
|
will do thorough review after testing |
…7-ikevin127-startChatTabsInputFocus
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-05-21.at.4.36.27.in.the.afternoon.movAndroid: mWeb ChromeScreen.Recording.2025-05-21.at.3.52.38.in.the.afternoon.moviOS: NativeScreen.Recording.2025-04-28.at.12.56.53.in.the.afternoon.moviOS: mWeb SafariScreen.Recording.2025-05-21.at.4.02.28.in.the.afternoon.movMacOS: Chrome / SafariScreen.Recording.2025-05-21.at.3.49.34.in.the.afternoon.movMacOS: DesktopScreen.Recording.2025-05-28.at.1.14.14.in.the.morning.mov |
…7-ikevin127-startChatTabsInputFocus
…7-ikevin127-startChatTabsInputFocus
…/github.com/ikevin127/Expensify into ikevin127-ikevin127-startChatTabsInputFocus
|
Works flawlessly Screen.Recording.2025-04-28.at.12.48.19.in.the.afternoon.mov |
…7-ikevin127-startChatTabsInputFocus
…7-ikevin127-startChatTabsInputFocus
This comment was marked as outdated.
This comment was marked as outdated.
…7-ikevin127-startChatTabsInputFocus
|
@getusha Thanks for testing thoroughly and catching that, here's the explanation for it:
♻️ To deal with the differences between native / web-based platforms, to make sure we only call
🟢 Ready for final review, please let me know if you find any other issues! |
|
Thanks for the update, seems to work fine on all platforms now. Screen.Recording.2025-05-27.at.6.43.53.in.the.evening.mov@ikevin127 could you fix conflicts so we can ship this? thx |
…7-ikevin127-startChatTabsInputFocus
|
@getusha 🟢 Done, thanks for the thorough review once again! The reassure test seems to fail for cache reasons: as |
arosiclair
left a comment
There was a problem hiding this comment.
Excellent work @ikevin127 👍
|
Not sure why this occurs in the perf test: @ikevin127 can you try merging main? |
…7-ikevin127-startChatTabsInputFocus
|
@arosiclair ✅ Done, should be good now! |
|
✋ 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/arosiclair in version: 9.1.54-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.1.54-7 🚀
|
|
|
||
| ### [react-native-tab-view+4.1.0.patch](react-native-tab-view+4.1.0.patch) | ||
|
|
||
| - Reason: Explanation/details |
There was a problem hiding this comment.
Hi 👋 Thank you for adding this file, good to see we're making some progress on documenting our patches!
We introduced this flow to get a better idea and one source of truth about the patches, so would be nice if you could add a few lines about why we need this patch 🙏
There was a problem hiding this comment.
👋 Hi, this pathch was only updated in this PR since this PR updated the react-native-tab-view version which required updating the patch: react-native-tab-view+3.5.2.patch -> react-native-tab-view+4.1.0.patch, the initial patch was introduced by this PR -> the author @chrispader might be able to add some details here as to why we need this patch.
I added the details.md with as much detail as I could because it was blocking the PR from merging.
There was a problem hiding this comment.
Thanks for the explanation 🙇 @chrispader could you share some details on this patch? I can prepare a PR but need some context 🙏
There was a problem hiding this comment.
I'm not totally sure anymore, but basically it just fixed an issue where the component would not cause a re-render when the tab changes. As in:
This PR fixes a problem where the camera in IOURequestStepScan would not render, because the current position value provided by react-native-tab-view never updates when changing the tab.
We were talking about upstreaming this and i think someone from Callstack might have worked on that: #39854 (comment)
|
|
||
| - Reason: Explanation/details | ||
| - Upstream PR/issue: N/A | ||
| - E/App issue: https://github.com/Expensify/App/issues/38796 | https://github.com/Expensify/App/issues/39285 |
There was a problem hiding this comment.
Also this section is for an E/App issue created exclusively for removing this patch. I'm gonna update the guide with some more explanation
Explanation of Change
♻ From reviewer's comment:
In this PR we're adding a
react-navigationpatch for thereact-native-tab-viewpackage in order to expose theonPageSelectednavigator event method, which offers the right amount of delay in order to fix our issue targeting the key sequence events described above of iOS internal calls, while removing already existing autofocus logic which proved to not be effective.Note
🟢 I fixed the issue for the Chat tab as well, now behaviour all platforms should be aligned - with the exception of iOS: mWeb Safari where the behaviour remains the same as in current staging / production.
Fixed Issues
$ #59388
PROPOSAL: #59388 (comment)
Tests
Offline tests
N/A
QA Steps
Same as Tests.
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: HybridApp
android-hybrid.mp4
Android: mWeb Chrome
android-mweb.mp4
iOS: Native
ios.mp4
iOS: HybridApp
ios-hybrid.mp4
Details
👇 Behaviour is unchanged from current staging / production.
iOS: mWeb Safari
ios-mweb.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov