Skip to content
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/listitem icon spacing #1017

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fix: right icon margin fixes #1003
  • Loading branch information
jbinda committed Apr 24, 2019
commit c300747480bf04984c73694751035497c3461278
2 changes: 1 addition & 1 deletion src/components/List/ListIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class ListIcon extends React.Component<Props> {

const styles = StyleSheet.create({
item: {
marginRight: 16,
margin: 8,
height: 40,
width: 40,
alignItems: 'center',
Expand Down
11 changes: 7 additions & 4 deletions src/components/List/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ class ListItem extends React.Component<Props> {
{left
? left({
color: descriptionColor,
style: description ? styles.iconMarginLeft : null,
style: description
? styles.iconMarginLeft
: { ...styles.iconMarginLeft, ...styles.marginVerticalNone },
})
: null}
<View style={[styles.item, styles.content]} pointerEvents="none">
Expand Down Expand Up @@ -152,8 +154,8 @@ class ListItem extends React.Component<Props> {
? right({
color: descriptionColor,
style: description
? { ...styles.iconMarginRight, ...styles.iconMarginLeft }
: styles.iconMarginRight,
? styles.iconMarginRight
: { ...styles.iconMarginRight, ...styles.marginVerticalNone },
})
: null}
</View>
Expand All @@ -175,7 +177,8 @@ const styles = StyleSheet.create({
description: {
fontSize: 14,
},
iconMarginLeft: { marginVertical: 8 },
marginVerticalNone: { marginVertical: 0 },
iconMarginLeft: { marginLeft: 0, marginRight: 16 },
iconMarginRight: { marginRight: 0 },
item: {
marginVertical: 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ exports[`renders list accordion with children 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
undefined,
Expand Down Expand Up @@ -404,7 +404,7 @@ exports[`renders list accordion with left items 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
undefined,
Expand Down
12 changes: 8 additions & 4 deletions src/components/__tests__/__snapshots__/ListItem.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ exports[`renders list item with left and right items 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
Object {
"marginVertical": 8,
"marginRight": 0,
},
]
}
Expand Down Expand Up @@ -294,10 +294,14 @@ exports[`renders list item with left item 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
null,
Object {
"marginLeft": 0,
"marginRight": 16,
"marginVertical": 0,
},
]
}
>
Expand Down
32 changes: 24 additions & 8 deletions src/components/__tests__/__snapshots__/ListSection.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,14 @@ exports[`renders list section with subheader 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
null,
Object {
"marginLeft": 0,
"marginRight": 16,
"marginVertical": 0,
},
]
}
>
Expand Down Expand Up @@ -235,10 +239,14 @@ exports[`renders list section with subheader 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
null,
Object {
"marginLeft": 0,
"marginRight": 16,
"marginVertical": 0,
},
]
}
>
Expand Down Expand Up @@ -409,10 +417,14 @@ exports[`renders list section without subheader 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
null,
Object {
"marginLeft": 0,
"marginRight": 16,
"marginVertical": 0,
},
]
}
>
Expand Down Expand Up @@ -530,10 +542,14 @@ exports[`renders list section without subheader 1`] = `
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 16,
"margin": 8,
"width": 40,
},
null,
Object {
"marginLeft": 0,
"marginRight": 16,
"marginVertical": 0,
},
]
}
>
Expand Down