-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Replace navigation blur listeners with useFocusEffect
#53735
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
Replace navigation blur listeners with useFocusEffect
#53735
Conversation
c8aefed to
c55bde7
Compare
Caused by `CONST.UPGRADE_FEATURE_INTRO_MAPPING` returning a new object on each invocation
c55bde7 to
8bbeaef
Compare
|
942b3e2 to
2f89f4c
Compare
|
@dukenv0307 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] |
|
@dukenv0307 please ignore |
|
@Ollyws Can you please jump on this one on monday? @kirillzyusko can you please review as well? thanks! |
|
🚧 @mountiny has triggered a test build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
|
From code perspective it looks good to me |
|
Looks good, will test a bit more and hopefully will be good to go tomorrow. |
Reviewer Checklist
Screenshots/VideosAndroid: Native01_Android_Native.mp4Android: mWeb Chrome02_Android_Chrome.mp4iOS: Native03_iOS_Native.mp4iOS: mWeb Safari04_iOS_Safari.mp4MacOS: Chrome / Safari05_MacOS_Chrome.mp4MacOS: Desktop06_MacOS_Desktop.mp4 |
Ollyws
left a comment
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.
Tested the flows using useWaitForNavigation and it all looks good.
| unsubscribeBlur(); | ||
| }; | ||
| }, [navigation]); | ||
| useFocusEffect( |
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.
@adamgrzybowski @WojtekBoman could you also please review this change in case you could see any issue with it in future?
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.
I don't see anything weird about these changes.
One thing I wonder is why useFocusEffect works and addEventListnere('blur', ()=> {...}) doesn't while useFocusEffect uses the blur event underneath 🤔
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.
@adamgrzybowski because useFocusEffect runs cleanup on unmount (in native-stack we can't get blur event n that code)
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.
Nice, great job adding such test!
mountiny
left a comment
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.
Lets give this a try!
|
✋ 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/mountiny in version: 9.0.76-0 🚀
|
|
@CyberAndrii @kirillzyusko @mountiny @Ollyws we ended up reverting this PR in an attempt to fix the issue that caused #fireroom-2024-12-17-hybridapp-crash. This PR was NOT the cause of the issue. I'm reverting the revert here |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.0.76-12 🚀
|
Explanation of Change
Replaces
navigation.addListener('blur', () => { ... });withuseFocusEffectas the former does not invoke the event handler on unmount on native platforms. This is a known issue with@react-navigation/native-stack.Fixed Issues
$ #53360
$ #53505
PROPOSAL: #53360 (comment)
Tests
Same as QA Steps.
Offline tests
N/A
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
53360.WorkshopUpgradePage.android.native.new.webm
Android: mWeb Chrome
53360.WorkshopUpgradePage.android.chrome.new.webm
iOS: Native
53360.ios.native.mp4
iOS: mWeb Safari
53360.ios.safari.mp4
MacOS: Chrome / Safari
53360.macos.chrome.mov
MacOS: Desktop
53360.macos.desktop.mov