Skip to content

Commit

Permalink
fix: correct Chip layout
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak committed Sep 22, 2022
1 parent 2e9fdcc commit 39b91a1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
13 changes: 11 additions & 2 deletions src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ const Chip = ({
variant="labelLarge"
selectable={false}
numberOfLines={1}
style={[styles.text, labelTextStyle, labelSpacings, textStyle]}
style={[
isV3 ? styles.md3LabelText : styles.labelText,
labelTextStyle,
labelSpacings,
textStyle,
]}
ellipsizeMode={ellipsizeMode}
>
{children}
Expand Down Expand Up @@ -402,12 +407,16 @@ const styles = StyleSheet.create({
marginRight: 8,
padding: 0,
},
text: {
labelText: {
minHeight: 24,
lineHeight: 24,
textAlignVertical: 'center',
marginVertical: 4,
},
md3LabelText: {
textAlignVertical: 'center',
marginVertical: 6,
},
avatar: {
width: 24,
height: 24,
Expand Down
24 changes: 6 additions & 18 deletions src/components/__tests__/__snapshots__/Chip.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ exports[`renders chip with close button 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down Expand Up @@ -403,9 +401,7 @@ exports[`renders chip with custom close button 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down Expand Up @@ -650,9 +646,7 @@ exports[`renders chip with icon 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down Expand Up @@ -802,9 +796,7 @@ exports[`renders chip with onPress 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down Expand Up @@ -954,9 +946,7 @@ exports[`renders outlined disabled chip 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down Expand Up @@ -1141,9 +1131,7 @@ exports[`renders selected chip 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down
4 changes: 1 addition & 3 deletions src/components/__tests__/__snapshots__/ListItem.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ exports[`renders list item with custom description 1`] = `
},
Array [
Object {
"lineHeight": 24,
"marginVertical": 4,
"minHeight": 24,
"marginVertical": 6,
"textAlignVertical": "center",
},
Object {
Expand Down

0 comments on commit 39b91a1

Please sign in to comment.