-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -11,6 +11,9 @@ const propTypes = { | |||||||||
// option Background Color | ||||||||||
optionBackgroundColor: PropTypes.string, | ||||||||||
|
||||||||||
// option flexStyle for the options list container | ||||||||||
listContainerStyles: PropTypes.arrayOf(PropTypes.object), | ||||||||||
|
||||||||||
// Style for hovered state | ||||||||||
// eslint-disable-next-line react/forbid-prop-types | ||||||||||
optionHoveredStyle: PropTypes.object, | ||||||||||
|
@@ -77,6 +80,7 @@ const defaultProps = { | |||||||||
optionBackgroundColor: undefined, | ||||||||||
optionHoveredStyle: undefined, | ||||||||||
contentContainerStyles: [], | ||||||||||
listContainerStyles: [], | ||||||||||
sections: [], | ||||||||||
focusedIndex: 0, | ||||||||||
selectedOptions: [], | ||||||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I think this can be rewritten as
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 I think this can be further simplified to:
Suggested change
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 commentThe 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 commentThe 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! |
||||||||||
{this.props.headerMessage ? ( | ||||||||||
<View style={[styles.ph5, styles.pb5]}> | ||||||||||
<Text style={[styles.textLabel, styles.colorMuted]}> | ||||||||||
|
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: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 😅