-
Notifications
You must be signed in to change notification settings - Fork 734
Support passing max item width to grid view #1640
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
Conversation
/** | ||
* @description: A auto-generated grid view that calculate item size according to given props | ||
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx | ||
*/ | ||
class GridView extends UIComponent<GridViewProps, State> { |
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.
Why you're not passing 'State'?
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.
Fixed
src/components/gridView/index.tsx
Outdated
/** | ||
* @description: A auto-generated grid view that calculate item size according to given props | ||
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx | ||
*/ | ||
class GridView extends UIComponent<GridViewProps, State> { | ||
class GridView extends UIComponent<GridViewProps> { | ||
static displayName = 'GridView'; | ||
|
||
static defaultProps = { | ||
numColumns: 3, |
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.
DEFAULT_NUM_COLUMNS instead of "3"
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.
Fixed
src/components/gridView/index.tsx
Outdated
/** | ||
* @description: A auto-generated grid view that calculate item size according to given props | ||
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx | ||
*/ | ||
class GridView extends UIComponent<GridViewProps, State> { | ||
class GridView extends UIComponent<GridViewProps> { | ||
static displayName = 'GridView'; | ||
|
||
static defaultProps = { | ||
numColumns: 3, | ||
itemSpacing: Spacings.s4 |
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.
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.
Done
import {Colors, Spacings} from 'style'; | ||
// TODO: we should use asBaseComponent here instead of using UIComponent directly |
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.
Don't you want to include this in your refactor?
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.
not at the moment..
Co-authored-by: Inbal Tish <[email protected]>
Description
maxItemWidth
prop to GridView to support a responsive item width without having to know number of columsWOAUILIB-2207
Changelog
GridView now supports
maxItemWidth
prop for a responsive item size (this is instead of passingnumColumns
prop)