-
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: navigation for exisiting report screen #5131
Conversation
src/libs/Navigation/CustomActions.js
Outdated
@@ -24,7 +24,19 @@ function pushDrawerRoute(screenName, params, navigationRef) { | |||
|
|||
if (activeReportID === params.reportID) { | |||
if (state.type !== 'drawer') { | |||
navigationRef.current.dispatch(StackActions.pop()); | |||
navigationRef.current.dispatch(() => { | |||
// If there are multiple routes then we can pop back to the first route |
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 code looks familiar... 😄
Are you OK with just copying and pasting things from other places?
Or should we think of a better way to handle this duplication?
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.
Sorry about that. I just found this to be straight to start with this. I can definitely refactor it into a function. 😄
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 am not sure the best way to dry this up. I can basically call the DismissModal
here instead. It does basically the same thing. What do you suggest?
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.
Please take some time to look into it and propose some options?
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.
Sure. Thanks.
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 Updated. Please review.
// Navigate back to where we were before we launched the modal | ||
goBack(shouldOpenDrawer); | ||
|
||
if (!normalizedShouldOpenDrawer) { | ||
return; | ||
} | ||
|
||
openDrawer(); |
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.
@marcaaron I didn't understand this part. Why were this code opening Drawer two times?
- via goback when
shouldOpenDrawer
istrue
. - Then OpenDrawer call which happens when
shouldOpenDrawer
istrue
.
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.
Can you rephrase this question? I'm not really sure what you are asking.
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 looked at the code. It seems to me that this piece of code was calling openDrawer
two times.
- Via goback when
shouldOpenDrawer
is true. - Then
OpenDrawer
call which happens whenshouldOpenDrawer
is true.
Or am I wrong?
Just a heads up this is very far down my list of priorities and will take some time to review. |
Hi @parasharrajat, I've placed this issue on hold as per this update, as we are prioritising issues related to a feature release scheduled for 9/24. As an apology for the delay, we will add a $100 bonus as a thank you for waiting. |
@marcaaron Ready for review. |
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.
Really like the clean up here and eliminating the need to explicitly call Navigation.dismissModal()
in some places. But I have some thoughts and suggestions about how to make the code clearer.
src/libs/Navigation/CustomActions.js
Outdated
* Go back to the Main Drawer | ||
* @param {Object} navigationRef | ||
*/ | ||
function navigateBackToDrawer(navigationRef) { |
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'm having trouble with this name because it implies we are calling this when the drawer is not active. It looks like something I would call if I was not on the drawer to take me back to the drawer. However, if you look we also have logic for handling when a nested drawer is active.
Ultimately, I find handling both responsibilities confusing and would love to figure out an alternative.
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 didn't find any good name for this method. To me, it seems to do multiple things. But I just removed the duplicate behaviour from our navigation and put it into one method. I found it difficult to break this into two and still abstract away the duplicates.
I will try to find something cleaner.
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.
Ok no worries. I think with the better naming this is acceptable now.
src/libs/Navigation/CustomActions.js
Outdated
@@ -24,7 +60,7 @@ function pushDrawerRoute(screenName, params, navigationRef) { | |||
|
|||
if (activeReportID === params.reportID) { | |||
if (state.type !== 'drawer') { | |||
navigationRef.current.dispatch(StackActions.pop()); | |||
navigateBackToDrawer(navigationRef); |
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.
One thing that sticks out to me is that we are checking state.type !== 'drawer'
and then again checking in navigateBackToDrawer()
. So it seems the method has more responsibility than it needs.
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.
Yeah. I think its more cleaner if we change the name to navigateBackToRootDrawer
or navigateBackToReportDrawer
.
if (state.type === 'drawer') { | ||
isLeavingDrawerNavigator = true; | ||
return StackActions.pop(); | ||
} |
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.
Do we still have nested drawer navigators in use? I think we got rid of the one case. In any case, I think if we want to keep this logic we should make a distinction between a "nested drawer navigator" and a "main" or "root" drawer navigator.
Otherwise, these variable names are confusing. I understand this code but someone might have a thought like, "Why do we have isLeavingDrawerNavigator
in a method called navigateBackToDrawer()
? Shouldn't isLeavingDrawerNavigator
always be false
?" Maybe it should be isLeavingNestedDrawerNavigator
instead.
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.
Yeah, I agree.
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.
Thanks for the updates 👍
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@@ -52,4 +88,5 @@ function pushDrawerRoute(screenName, params, navigationRef) { | |||
|
|||
export default { | |||
pushDrawerRoute, | |||
navigateBackToDrawer: navigateBackToRootDrawer, |
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.
@marcaaron Oh, my editor messed it up. Should I send another PR now?
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.
Follow up #5937
🚀 Deployed to staging by @marcaaron in version: 1.1.8-10 🚀
|
Accessibility issue: There is an color contrast issue in the chats page. |
Accessibility issue: WACG failure 1.3.1 info and relationship. concierge.announces.twice.mp4 |
Accessibility issue: WACG failure 2.4.9 Link purpose 2.4.9.phone.button.and.pin.button.is.not.descriptive.mp4Other occurrences: 2.4.9.phone.button.and.pin.button.is.not.descriptive.emoji.and.send.button.mp4 |
Accessibility issue: WACG failure 2.4.3 Focus order meaning. 2.4.3.focus.moving.to.the.hidden.content.mp4Other Occurrences: 2.4.3.focus.is.moving.to.the.dectrative.content.mp4focus.moves.to.the.hidden.content.mp4 |
🚀 Deployed to production by @roryabraham in version: 1.1.10-2 🚀
|
@@ -83,7 +83,6 @@ class EnableStep extends React.Component { | |||
title: translate('workspace.bankAccount.chatWithConcierge'), | |||
icon: ChatBubble, | |||
onPress: () => { | |||
Navigation.dismissModal(); |
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.
Comming from #34456, remove dismiss modal here potential causes that bug.
Details
Fixed Issues
$ #4545
Tests | QA Steps
Report a bug
.Tested On
Screenshots
Web | Desktop
report-wd.mp4
Mobile Web
report-m.mp4
iOS
Android
report-a.mp4