Remove close button from HeaderWithCloseButton#17963
Remove close button from HeaderWithCloseButton#17963staszekscp wants to merge 10 commits intoExpensify:navigation-refactorfrom adamgrzybowski:remove-close-button
Conversation
* test flatlist for android * fix linter * fix name * fix not working features * limit rerenders
|
@puneetlath 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] |
puneetlath
left a comment
There was a problem hiding this comment.
This mostly looks good to me. Just a few things:
- you have lint errors
- I don't think we should pass the
onBackButtonPressprop if we're just setting it toNavigation.goBacksince that is the default - Let's make sure that we do the all-device testing and include videos since this touches so many components
cc @mountiny in case you want to review as well.
| onDownloadButtonPress: () => {}, | ||
| onCloseButtonPress: () => {}, | ||
| onBackButtonPress: () => {}, | ||
| onBackButtonPress: Navigation.goBack, |
There was a problem hiding this comment.
I notice that on a lot of components we set this prop to Navigation.goBack, but given that is the default, why even pass this prop at all?
There was a problem hiding this comment.
Agree. We should remove all redundant code.
There was a problem hiding this comment.
In some cases the onBackButtonPress should bring user back to a previous step in a flow (some screens are implemented as "steps", therefore navigation is not used)
There was a problem hiding this comment.
We can override this prop on those cases, but no need on normal cases as Navigation.goBack is already set as default value.
Your current branch has double Navigation.goBack for most screens. I know this is already existing code but we can remove all of them since Navigation.goBack is now set as default prop.
|
@mountiny perhaps we want to get a C+ to test this PR as well? |
|
Thanks @puneetlath Lets fix the lint issues and we can run the internal release which will help with testing. this should mainly remove the X button from all the RHP pages so there should not be a big problem hopefully |
mountiny
left a comment
There was a problem hiding this comment.
Thanks! Asking for a C+
| onBackButtonPress: () => {}, | ||
| onBackButtonPress: Navigation.goBack, | ||
| onThreeDotsButtonPress: () => {}, | ||
| shouldShowBackButton: false, |
There was a problem hiding this comment.
Was there any place where the shouldShowBackButton was false? are we covering that case?
There was a problem hiding this comment.
This cannot be removed. i.e. ReportScreen have conditional back button render based on this prop.
|
@staszekscp please run |
| onThreeDotsButtonPress: () => {}, | ||
| shouldShowBackButton: false, |
There was a problem hiding this comment.
This cannot be removed. i.e. ReportScreen have conditional back button render based on this prop.
| onDownloadButtonPress: () => {}, | ||
| onCloseButtonPress: () => {}, | ||
| onBackButtonPress: () => {}, | ||
| onBackButtonPress: Navigation.goBack, |
There was a problem hiding this comment.
Agree. We should remove all redundant code.
| <HeaderWithBackButton | ||
| title={props.translate('reimbursementAccountLoadingAnimation.oneMoment')} | ||
| onCloseButtonPress={Navigation.dismissModal} | ||
| shouldShowBackButton={props.network.isOffline} |
There was a problem hiding this comment.
Doesn't this cause regression? I think it was intentional to set props.network.isOffline
There was a problem hiding this comment.
Thanks for the feedback! I've noticed that if we remove X icon from every modal we won't have a chance to dismiss/go back and users would get stuck... That's why I decided to remove the shouldShowBackButton prop.
We can provide it conditionally (the default could be true to avoid passing the prop to almost every component), but then there should be some kind of mechanism to allow users to go back. Maybe we could leave conditional X button?
There was a problem hiding this comment.
That's why I decided to remove the
shouldShowBackButtonprop
Report screen doesn't need back button on web but on mobile, so this prop is necessary
There was a problem hiding this comment.
And it seems to be working fine with this implementation - the back button is only visible on small screen (on wide web there is no back button as expected)
There was a problem hiding this comment.
RHP modal screens still need back button even on web
There was a problem hiding this comment.
On the small screen the button is visible
There was a problem hiding this comment.
Actually ReportScreen uses another component called HeaderView to render the back button, so this PR shouldn't affect it at all
There was a problem hiding this comment.
So you still suggest to remove shouldShowBackButton prop completely and always show back arrow right?
I will check and confirm if any other pages need this button hidden.
There was a problem hiding this comment.
You can also click the UP/Back button to close it so we are good here!
|
Thanks for the discussion so far, running an internal build so this is a bit easier to test https://github.com/Expensify/App/actions/runs/4811973135 |
|
🧪🧪 Use the links below to test this build in android and iOS. Happy testing! 🧪🧪 |
|
Tested the build on web and on my ihone and it looks great ot what I can see There is this skeleton issue with LHN on iOS for me |
| <HeaderWithBackButton | ||
| title={props.translate('reimbursementAccountLoadingAnimation.oneMoment')} | ||
| onCloseButtonPress={Navigation.dismissModal} | ||
| shouldShowBackButton={props.network.isOffline} |
|
Not related to this PR but this regression is caused by navigation refactor and should be fixed: Screen.Recording.2023-04-26.at.11.32.00.PM.mov |
Oh good catch, I think the attachement modal on desktop should have X it makes more sense than < but mobile would still have the < |
|
@staszekscp please fix merge conflict. Also, I think we should re-think about
Based on this, we may still need both |
|
@0xmiroslav I would say if the attachment modal is the only place we found, I think we dont need that and we could make some custom wrapper fro that header. I think eventually we will drop usage of that modal and the gallery for pictures will be more common to what you are used to from whatsapp or messenger. |
Send attachment design will also change? |
|
I would imagine, this is not being worked on yet. But yeah, we need to keep it for now so whatever is easier now, keep the props and use it only in the attachment modal or something else. We need it there. btw created an issue here #18064 |
|
There are actually two modals where the X button could be applied. I think we could add a prop |
|
You may have a look now after some cleanup and fixes :) |
mountiny
left a comment
There was a problem hiding this comment.
I have noticed this one little bug on pronouns page and create issue for it so we dont forget #18092 lets not fix it here
@0xmiroslav would you be able to go through the checklist here please? thank you!
0xmiroslav
left a comment
There was a problem hiding this comment.
I see you changed FlatList/index.android.js. Is this relevant to this issue?
| /** Whether we should show a close button */ | ||
| shouldShowCloseButton: PropTypes.bool, | ||
|
|
||
| /** Method to trigger when pressing close button of the header */ | ||
| onCloseButtonPress: PropTypes.func, | ||
|
|
There was a problem hiding this comment.
Please put this in original order for no code diff
There was a problem hiding this comment.
Can we deprecate onCloseButtonPress and use onBackButtonPress always as there's no case of both back button and close button show
There was a problem hiding this comment.
There's an edge case in two modals, so I decided to keep it for the web
0xmiroslav
left a comment
There was a problem hiding this comment.
These change original behavior. As they were added intentionally, let's make sure that there aren't any regressions after these removals.
| title={this.props.translate('common.description')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={Navigation.goBack} | ||
| onCloseButtonPress={this.onCloseButtonPress} |
There was a problem hiding this comment.
There was IOU.setMoneyRequestDescription(''); call when close page.
| <HeaderWithBackButton | ||
| title={this.props.translate('workspace.invite.invitePeople')} | ||
| subtitle={policyName} | ||
| onCloseButtonPress={() => this.clearErrors(true)} |
There was a problem hiding this comment.
There was this.clearErrors(true) call when close page
| title={titleForStep} | ||
| shouldShowBackButton={shouldShowBackButton} | ||
| onBackButtonPress={isEditingAmountAfterConfirm ? () => navigateToStep(moneyRequestStepIndex) : navigateToPreviousStep} | ||
| onBackButtonPress={currentStepIndex === 0 ? Navigation.dismissModal : navigateBack} |
There was a problem hiding this comment.
There was conditional navigation, so if isEditingAmountAfterConfirm = true, should navigate to request step
There was a problem hiding this comment.
This logic is still present, I just decided to move it to navigateBack instead
| <HeaderWithBackButton | ||
| title={props.translate('initialSettingsPage.about')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS)} |
There was a problem hiding this comment.
When navigate to this page directly, it simply closes. Before, it went to Settings page always.
| <HeaderWithBackButton | ||
| title={props.translate('common.payPalMe')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_PAYMENTS)} |
| <HeaderWithBackButton | ||
| title={this.props.translate('timezonePage.timezone')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_TIMEZONE)} |
| <HeaderWithBackButton | ||
| title={this.props.translate('closeAccountPage.closeAccount')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_SECURITY)} |
| <HeaderWithBackButton | ||
| title={props.translate('initialSettingsPage.security')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS)} |
| <HeaderWithBackButton | ||
| title={props.translate('workspace.common.workspace')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)} |
| <HeaderWithBackButton | ||
| title={this.props.translate('common.workspaces')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS)} |
|
@staszekscp lets get this one ready for review and merge it so we can continue with the UP implementation. |
|
Hey, I've applied requested changes to this PR, because it is needed to continue work with the navigation reboot :) |
|
Closing in favour of #18402 @puneetlath thanks for a review, if you are interested please feel free to review there |







Details
Removes close button from
HeaderWithCloseButtoncomponent - expained hereFixed Issues
$ #15850
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android