Create Right-Docked Settings Modal - #1325
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
marcaaron
left a comment
There was a problem hiding this comment.
Looks great so far! Just leaving early feedback since it's still in WIP.
| class MainView extends Component { | ||
| render() { | ||
| const reportIDInUrl = parseInt(this.props.match.params.reportID, 10); | ||
| let activeReportID = parseInt(this.props.match.params.reportID, 10); |
There was a problem hiding this comment.
I'm curious what would happen if we simply stopped relying on the match params here. IIRC we should be updating the currentlyViewedReportID when we hit one of these routes.
There was a problem hiding this comment.
By that you mean just doing
activeReportID = parseInt(this.props.currentlyViewedReportID, 10);always, right?
There was a problem hiding this comment.
Yeah exactly. I'm trying to think of a time when the reportID in the URL wouldn't be the currentlyViewedReportID and not sure there is one. If we don't need it then the logic in this file becomes a little simpler and we can stop making an exception for the settings route.
| case CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED: | ||
| modalStyle = { | ||
| margin: 0, | ||
| flexDirection: 'row-reverse', |
There was a problem hiding this comment.
Is this doing anything? I think it would be flex-end that would move the modal to the right of the screen.
There was a problem hiding this comment.
I was following the flex-direction example here: https://reactnative.dev/docs/flexbox#flex-direction
If I remove this then the modal goes to the left side.
There was a problem hiding this comment.
Cool. I guess it works then? If your width was 100% of the screen then I'd think flex-end would stick it at the right side but didn't really dig too much into what this is doing
There was a problem hiding this comment.
I think I see what you're saying. Switched this up to use row and end below.
| break; | ||
| case CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED: | ||
| modalStyle = { | ||
| margin: 0, |
There was a problem hiding this comment.
NAB, pretty much every modal has this margin: 0 on it. I wonder if this should just be a default for all of them.
| justifyContent: 'end', | ||
| }; | ||
| modalContainerStyle = { | ||
| width: isSmallScreen ? '100%' : '40%', |
There was a problem hiding this comment.
cc @shawnborton we might want to use a constant for the right side pane instead of the 40%? I know there wasn't really a clear guideline for this part.
There was a problem hiding this comment.
Yeah maybe a max-width? 450px maybe?
There was a problem hiding this comment.
What if we just reuse the variable for the LHN? So basically at mobile breakpoints, this should take up the whole screen (like the LHN) but at wider desktops, this should share the same LHN variable which would make it 375px. This is what we've been doing in all of our mockups.
There was a problem hiding this comment.
@yuwenmemon I think you'll need to pull master, and then you should find sideBarWidth: 375 inside of variables.js
| height: '100%', | ||
| overflow: 'hidden', | ||
| marginRight: 0, | ||
| paddingTop: 0, |
There was a problem hiding this comment.
NAB, I haven't looked yet but who/what is adding margin and padding that we need to reset it? Maybe it would be better to only add margin/padding to the places that need it instead of override it here.
| > | ||
| <View> | ||
| <SettingsPage /> | ||
| </View> |
There was a problem hiding this comment.
Do we need this extra View?
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
|
Removing WIP |
|
@shawnborton Interesting, is it disappearing or is it just the same color as the overlay? |
|
It's actually disappearing, the property gets removed. |
| currentlyViewedReportID: '', | ||
| }; | ||
|
|
||
| class SettingsModal extends Component { |
There was a problem hiding this comment.
NAB, we can probably make this a stateless functional component by using an anonymous arrow function for the onClose method.
| </Text> | ||
| </TouchableOpacity> | ||
| </View> | ||
|
|
| /> | ||
| {this.props.currentURL === '/settings' && <SettingsPage />} | ||
| <SettingsModal | ||
| isVisible={this.props.currentURL === '/settings'} |
There was a problem hiding this comment.
NAB, this was left by someone else but can we take this opportunity to update /settings to use the constant in ROUTES?
| class MainView extends Component { | ||
| render() { | ||
| const reportIDInUrl = parseInt(this.props.match.params.reportID, 10); | ||
| let activeReportID = parseInt(this.props.match.params.reportID, 10); |
There was a problem hiding this comment.
Yeah exactly. I'm trying to think of a time when the reportID in the URL wouldn't be the currentlyViewedReportID and not sure there is one. If we don't need it then the logic in this file becomes a little simpler and we can stop making an exception for the settings route.
|
Tests great and looks real nice so far. Left some NABs. And I'm still curious if we can just ditch the match params for 2021-01-26_07-06-41.mp4 |
bfe5f14 to
2223202
Compare
2223202 to
6039761
Compare
|
Signing off for the night, so don't block on me if you want to merge this today. I think we just need to update the screenshots and make sure the side modal on desktop is 375px wide. Nice work @yuwenmemon ! |
d98a40f to
6f20d8e
Compare
marcaaron
left a comment
There was a problem hiding this comment.
Looks good two more small comments.
| const SettingsModal = props => ( | ||
| <ModalWithHeader | ||
| type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED} | ||
| onClose={() => redirect(ROUTES.getReportRoute(props.currentlyViewedReportID))} |
There was a problem hiding this comment.
This seems like a minor regression from what we were doing before. Which is, cover the case where currentlyViewedReportID has no value.
There was a problem hiding this comment.
Ah yep, missed that - nice catch.
| // viewed on a smaller device (e.g. mobile or mobile web). | ||
| modalStyle = { | ||
| margin: 0, | ||
| modalStyle = _.extend(modalStyle, { |
There was a problem hiding this comment.
NAB, I believe we have more or less standardized on using spread operator instead of _.extend but could be wrong about that.
There was a problem hiding this comment.
Actually yes double checked, there are 0 usages in the codebase. For consistency, maybe we can stick to just using spread operator? Mostly my concern is that we will have 2 ways of doing one thing. Just like we shouldn't be mixing Array.map and _.map we shouldn't be using {...something} and _.extend(something, {});
|
Updated, and updated the Web GIF to be more up to date |
| : [styles.sidebarHeader]; | ||
|
|
||
| const {recentReports} = getSidebarOptions(props.reports, props.personalDetails, props.draftComments, reportIDInUrl); | ||
| const {recentReports} = getSidebarOptions(props.reports, props.personalDetails, props.draftComments, activeReportID); |
There was a problem hiding this comment.
We should fix this. It's a warning but we are treating them as not optional. I have an open issue to make this more clear.
There was a problem hiding this comment.
Ah, sorry didn't realize what you were referring to at first. You're referring to the fact that this is a linter warning.
|
This is looking good to me and testing well. However, the out animation looks a little fast on web (almost like it's not happening at all?). also, the mobile web video seems to just be web at a mobile resolution. We should make sure we are testing mobile web by using something like iOS simulator + Safari. |
|
Looks like the animations for the side bar are not happening on Android. iOS looks ok though. |
|
Oh hmm, that is super weird. Maybe it's a bug within the modal library. Either way we don't necessarily have to worry about it now. |
|
Once work-around could be to set a different |
|
@marcaaron do we want to worry about the modal animation timing inconsistency across platforms for now or not? |
|
It would be nice to know why if we can look into it now. But it's up to you. I'm also fine with creating a new issue to follow up. |
|
@marcaaron dug around for an hour or so, didn't really get anywhere so I vote we move forward and just create a new issue to follow up. |
|
Ok I agree. One follow-up idea is to see if this is just generally reproducible and then create an issue in Separately, there are a couple of unresolved comments from me here. Other than that I am 👍 |
|
Yeah, I'd also want to try it on real devices as opposed to simulators. Also, I believe there was just the one comment about style. Sorry, didn't understand what you were saying at first. But I'm not sure there are any others? If you could point them out that would be helpful. |
|
Looks great thanks! |
|
Looks great! I agree, let's please do a follow up issue for finessing the animation style. |






@marcaaron please review
Details
Create a right-docked settings modal.
Fixed Issues
Fixes https://github.com/Expensify/Expensify/issues/150956
Tests
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android