Skip to content

Commit 69d5ffe

Browse files
authored
fix: correct Chip touchable style (#2976)
1 parent bd0bae2 commit 69d5ffe

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

example/src/Examples/ChipExample.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ const ChipExample = () => {
216216
With custom close icon
217217
</Chip>
218218
</View>
219+
<Chip mode="outlined" onPress={() => {}} style={styles.fullWidthChip}>
220+
Full width chip
221+
</Chip>
219222
</List.Section>
220223
</ScreenWrapper>
221224
<Snackbar
@@ -253,6 +256,10 @@ const styles = StyleSheet.create({
253256
bigTextStyle: {
254257
flex: -1,
255258
},
259+
fullWidthChip: {
260+
marginVertical: 4,
261+
marginHorizontal: 12,
262+
},
256263
});
257264

258265
export default ChipExample;

src/components/Chip.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ const styles = StyleSheet.create({
355355
alignItems: 'center',
356356
paddingLeft: 4,
357357
position: 'relative',
358+
flexGrow: 1,
358359
},
359360
icon: {
360361
padding: 4,
@@ -391,7 +392,7 @@ const styles = StyleSheet.create({
391392
alignItems: 'center',
392393
},
393394
touchable: {
394-
flex: 1,
395+
flexGrow: 1,
395396
},
396397
});
397398

src/components/__tests__/__snapshots__/Chip.test.js.snap

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ exports[`renders chip with close button 1`] = `
4141
"borderRadius": 16,
4242
},
4343
Object {
44-
"flex": 1,
44+
"flexGrow": 1,
4545
},
4646
],
4747
]
@@ -53,6 +53,7 @@ exports[`renders chip with close button 1`] = `
5353
Object {
5454
"alignItems": "center",
5555
"flexDirection": "row",
56+
"flexGrow": 1,
5657
"paddingLeft": 4,
5758
"position": "relative",
5859
},
@@ -263,7 +264,7 @@ exports[`renders chip with custom close button 1`] = `
263264
"borderRadius": 16,
264265
},
265266
Object {
266-
"flex": 1,
267+
"flexGrow": 1,
267268
},
268269
],
269270
]
@@ -275,6 +276,7 @@ exports[`renders chip with custom close button 1`] = `
275276
Object {
276277
"alignItems": "center",
277278
"flexDirection": "row",
279+
"flexGrow": 1,
278280
"paddingLeft": 4,
279281
"position": "relative",
280282
},
@@ -485,7 +487,7 @@ exports[`renders chip with icon 1`] = `
485487
"borderRadius": 16,
486488
},
487489
Object {
488-
"flex": 1,
490+
"flexGrow": 1,
489491
},
490492
],
491493
]
@@ -497,6 +499,7 @@ exports[`renders chip with icon 1`] = `
497499
Object {
498500
"alignItems": "center",
499501
"flexDirection": "row",
502+
"flexGrow": 1,
500503
"paddingLeft": 4,
501504
"position": "relative",
502505
},
@@ -634,7 +637,7 @@ exports[`renders chip with onPress 1`] = `
634637
"borderRadius": 16,
635638
},
636639
Object {
637-
"flex": 1,
640+
"flexGrow": 1,
638641
},
639642
],
640643
]
@@ -646,6 +649,7 @@ exports[`renders chip with onPress 1`] = `
646649
Object {
647650
"alignItems": "center",
648651
"flexDirection": "row",
652+
"flexGrow": 1,
649653
"paddingLeft": 4,
650654
"position": "relative",
651655
},
@@ -735,7 +739,7 @@ exports[`renders outlined disabled chip 1`] = `
735739
"borderRadius": 16,
736740
},
737741
Object {
738-
"flex": 1,
742+
"flexGrow": 1,
739743
},
740744
],
741745
]
@@ -747,6 +751,7 @@ exports[`renders outlined disabled chip 1`] = `
747751
Object {
748752
"alignItems": "center",
749753
"flexDirection": "row",
754+
"flexGrow": 1,
750755
"paddingLeft": 4,
751756
"position": "relative",
752757
},
@@ -836,7 +841,7 @@ exports[`renders selected chip 1`] = `
836841
"borderRadius": 16,
837842
},
838843
Object {
839-
"flex": 1,
844+
"flexGrow": 1,
840845
},
841846
],
842847
]
@@ -848,6 +853,7 @@ exports[`renders selected chip 1`] = `
848853
Object {
849854
"alignItems": "center",
850855
"flexDirection": "row",
856+
"flexGrow": 1,
851857
"paddingLeft": 4,
852858
"position": "relative",
853859
},

src/components/__tests__/__snapshots__/ListItem.test.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ exports[`renders list item with custom description 1`] = `
124124
"borderRadius": 16,
125125
},
126126
Object {
127-
"flex": 1,
127+
"flexGrow": 1,
128128
},
129129
],
130130
]
@@ -136,6 +136,7 @@ exports[`renders list item with custom description 1`] = `
136136
Object {
137137
"alignItems": "center",
138138
"flexDirection": "row",
139+
"flexGrow": 1,
139140
"paddingLeft": 4,
140141
"position": "relative",
141142
},

0 commit comments

Comments
 (0)