Skip to content

GridView - fix after gridListIItem change (#3001) #3215

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/src/screens/componentScreens/GridViewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class GridViewScreen extends Component {
_.map(contacts, contact => ({
imageProps: {source: {uri: contact.thumbnail}, borderRadius: 999, style: {backgroundColor: Colors.grey60}},
title: _.split(contact.name, ' ')[0],
titleLines: 1,
onPress: () => Alert.alert('My name is ' + contact.name)
})))(conversations),
products: _.flow(products => _.take(products, 8),
Expand Down
7 changes: 6 additions & 1 deletion src/components/gridListItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ class GridListItem extends Component<GridListItemProps> {
accessible={renderCustomItem ? true : undefined}
{...Modifiers.extractAccessibilityProps(this.props)}
>
{imageProps && <Image style={itemSize} {...imageProps} customOverlayContent={children}/>}
{imageProps && (
<View style={[{borderRadius: imageProps?.borderRadius}, itemSize]}>
<Image {...imageProps} style={[itemSize, imageProps?.style]}/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the issue is coming from the style override.

style={itemSize} {...imageProps}

So when the user pass some style via imageProps the size getting override.

I think the better solution will be to fix the style override.

{imageProps && <Image {...imageProps} style={[itemSize, imageProps?.style]} customOverlayContent={children}/>}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So create a PR, if it works I'll close this one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{children}
</View>
)}
{!_.isNil(renderCustomItem) && <View style={{width}}>{renderCustomItem()}</View>}
{renderOverlay && <View style={[styles.overlay, itemSize]}>{renderOverlay()}</View>}
<TextContainer {...textContainerStyle}>
Expand Down