Skip to content

Commit

Permalink
fix: correct Chip touchable style (#2976)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Dec 10, 2021
1 parent bd0bae2 commit 69d5ffe
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
7 changes: 7 additions & 0 deletions example/src/Examples/ChipExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ const ChipExample = () => {
With custom close icon
</Chip>
</View>
<Chip mode="outlined" onPress={() => {}} style={styles.fullWidthChip}>
Full width chip
</Chip>
</List.Section>
</ScreenWrapper>
<Snackbar
Expand Down Expand Up @@ -253,6 +256,10 @@ const styles = StyleSheet.create({
bigTextStyle: {
flex: -1,
},
fullWidthChip: {
marginVertical: 4,
marginHorizontal: 12,
},
});

export default ChipExample;
3 changes: 2 additions & 1 deletion src/components/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ const styles = StyleSheet.create({
alignItems: 'center',
paddingLeft: 4,
position: 'relative',
flexGrow: 1,
},
icon: {
padding: 4,
Expand Down Expand Up @@ -391,7 +392,7 @@ const styles = StyleSheet.create({
alignItems: 'center',
},
touchable: {
flex: 1,
flexGrow: 1,
},
});

Expand Down
18 changes: 12 additions & 6 deletions src/components/__tests__/__snapshots__/Chip.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports[`renders chip with close button 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -53,6 +53,7 @@ exports[`renders chip with close button 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down Expand Up @@ -263,7 +264,7 @@ exports[`renders chip with custom close button 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -275,6 +276,7 @@ exports[`renders chip with custom close button 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down Expand Up @@ -485,7 +487,7 @@ exports[`renders chip with icon 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -497,6 +499,7 @@ exports[`renders chip with icon 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down Expand Up @@ -634,7 +637,7 @@ exports[`renders chip with onPress 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -646,6 +649,7 @@ exports[`renders chip with onPress 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down Expand Up @@ -735,7 +739,7 @@ exports[`renders outlined disabled chip 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -747,6 +751,7 @@ exports[`renders outlined disabled chip 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down Expand Up @@ -836,7 +841,7 @@ exports[`renders selected chip 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -848,6 +853,7 @@ exports[`renders selected chip 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/__tests__/__snapshots__/ListItem.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ exports[`renders list item with custom description 1`] = `
"borderRadius": 16,
},
Object {
"flex": 1,
"flexGrow": 1,
},
],
]
Expand All @@ -136,6 +136,7 @@ exports[`renders list item with custom description 1`] = `
Object {
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"paddingLeft": 4,
"position": "relative",
},
Expand Down

0 comments on commit 69d5ffe

Please sign in to comment.