-
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 scrolling problem for LHN #2406
Fix scrolling problem for LHN #2406
Conversation
@Julesssss @marcaaron I resolved the regression passing a prop to the OptionsList, but I'm ideally looking for a better solution here. The problem, I think, is that - when you give flex: 1 to the OptionsList, it tries to take up all the available space, and thus, other children can't take available space. I tried different configurations to no avail. Maybe, I'm just not doing right, and my Flex knowledge is lagging me behind here! I'm open to any suggestions :) |
86f78e1
to
70ce407
Compare
I don't think this solution is working? I pulled down this branch and all the lists are still stuck and unable to move. |
src/components/OptionsList.js
Outdated
@@ -77,6 +80,7 @@ const defaultProps = { | |||
optionBackgroundColor: undefined, | |||
optionHoveredStyle: undefined, | |||
contentContainerStyles: [], | |||
listContainerStyles: [], |
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.
Oh I see the issue now, if you give this a default value of undefined
the solution will work because below you are checking:
this.props.listContainerStyles ? this.props.listContainerStyles : [styles.flex1]
and empty array will be truthy value
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.
Ahh my bad 😅
I think this is a fine solution as long as it causes no regressions and solves the original issue 🤷 |
Can you please add a link to the comment where the regression was discovered in the PR description? |
Change the default value for listContainerStyles
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
Hi, @marcaaron! I made the change and also added the Comment in the PR description. :) |
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.
Hey I had one change requested. Let me know what you think!
src/components/OptionsList.js
Outdated
@@ -196,7 +200,7 @@ class OptionsList extends Component { | |||
|
|||
render() { | |||
return ( | |||
<View style={[styles.flexGrow0]}> | |||
<View style={[...(this.props.listContainerStyles ? this.props.listContainerStyles : [styles.flex1])]}> |
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 think this can be rewritten as
<View style={[...(this.props.listContainerStyles ? this.props.listContainerStyles : [styles.flex1])]}> | |
<View style={[...(this.props.listContainerStyles || [styles.flex1])]}> |
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.
Though I'm a little unsure about the use of spread syntax here. Wouldn't [...(x)]
be equal to just x
?
I think this can be further simplified to:
<View style={[...(this.props.listContainerStyles ? this.props.listContainerStyles : [styles.flex1])]}> | |
<View style={this.props.listContainerStyles || [styles.flex1]}> |
Is there a specific reason you'd want to have the syntax in my comment above 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 if we want to make this super clean we can just do this
const defaultProps = {
listContainerStyles: [styles.flex1],
};
...
<View style={this.props.listContainerStyles}
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 love this clean solution! Will implement it and push it. Thank you!
@Julesssss Made a slight change based on Marc's suggestion. Please feel free to review it any time! :) |
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.
LGTM
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.
Looks like we are passing a 2D array now
src/components/OptionsList.js
Outdated
@@ -196,7 +200,7 @@ class OptionsList extends Component { | |||
|
|||
render() { | |||
return ( | |||
<View style={[styles.flexGrow0]}> | |||
<View style={[this.props.listContainerStyles]}> |
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.
You're talking about this line right @marcaaron?
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.
@TomatoToaster @marcaaron Damn, I am really sorry for the silly mistakes in this PR, guys. Looks like the festive season here has taken a toll on me! 😄
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.
Thank you so much for your patience and the time to review this as well! :)
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 fixing it promptly, LGTM.
@marcaaron I see there are no QA steps. Do they need to be added or is this PR |
The steps are currently testable internally (for simplicity). I'll run them now. |
@barun1997 one thing that I've only just noticed is that you can't scroll the bill split contacts on the IOU Confirm page if they extend beyond the screen height. Was that always the case, or did that change with this PR? Thanks! |
Sounds like what we were trying to fix with this PR 😅 |
🚀 [Deployed](https://github.com/Expensify/Expensify.cash
|
@Julesssss Can we repeat QA for this tomorrow and get a more definitive answer? Please either:
Thanks! |
The LHN thing definitely was a blocker but that's resolved now so we can probably check this off. |
Yeah, looks like someone has checked it off already. Thanks! The remaining issue is in no way a blocker. |
I will work on the non-scrolling issue over the weekend if it's okay? I have asked for help in the slack channel as well. In any case, will work extensively on it on Sunday! |
@Jag96 I sent out an update here |
Sounds good @barun1997, please let us know what progress you've made or what you're stuck on so we can help out. I suggest updating the slack thread with the latest progress and asking again in expensify-open-source for another look to get more eyes on it. |
🚀 Deployed to production in version: 1.0.39-5🚀
|
<If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit.>
Details
I originally added flexGrow0 to the OptionsList because the view for IOUConfirmationList wasn’t showing the components as per the design. But flexGrow0 caused a regression in LHN because it stopped it from growing beyond its fixed height and width, and therefore, affected scrolling.
This solution solves the issue by using flexGrow0 only when it is passed as a prop. So components that need flex1 as a style in OptionsList have no regression.
Fixed Issues
The PR fixes the issue mentioned by the following comment:
#2120 (comment)
Tests
QA Steps
Same as Tests.
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android