Skip to content

Commit 3592277

Browse files
committed
feat: add container style prop to list accordion
1 parent a16deea commit 3592277

File tree

4 files changed

+59
-25
lines changed

4 files changed

+59
-25
lines changed

src/components/List/ListAccordion.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,17 @@ export type Props = {
7272
*/
7373
background?: PressableAndroidRippleConfig;
7474
/**
75-
* Style that is passed to the wrapping TouchableRipple element.
75+
* Style that is passed to the root TouchableRipple container.
7676
*/
7777
style?: StyleProp<ViewStyle>;
78+
/**
79+
* Style that is passed to the outermost container that wraps the entire content, including left and right items and both title and description.
80+
*/
81+
containerStyle?: StyleProp<ViewStyle>;
82+
/**
83+
* Style that is passed to the content container, which wraps the title and description.
84+
*/
85+
contentStyle?: StyleProp<ViewStyle>;
7886
/**
7987
* Style that is passed to Title element.
8088
*/
@@ -173,6 +181,8 @@ const ListAccordion = ({
173181
descriptionNumberOfLines = 2,
174182
rippleColor: customRippleColor,
175183
style,
184+
containerStyle,
185+
contentStyle,
176186
id,
177187
testID,
178188
background,
@@ -252,7 +262,7 @@ const ListAccordion = ({
252262
borderless
253263
>
254264
<View
255-
style={theme.isV3 ? styles.rowV3 : styles.row}
265+
style={[theme.isV3 ? styles.rowV3 : styles.row, containerStyle]}
256266
pointerEvents={pointerEvents}
257267
>
258268
{left
@@ -262,7 +272,11 @@ const ListAccordion = ({
262272
})
263273
: null}
264274
<View
265-
style={[theme.isV3 ? styles.itemV3 : styles.item, styles.content]}
275+
style={[
276+
theme.isV3 ? styles.itemV3 : styles.item,
277+
styles.content,
278+
contentStyle,
279+
]}
266280
>
267281
<Text
268282
selectable={false}

src/components/List/ListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export type Props = $RemoveChildren<typeof TouchableRipple> & {
6767
*/
6868
style?: StyleProp<ViewStyle>;
6969
/**
70-
* Style that is passed to the outermost container that wraps the entire content, including icons and text.
70+
* Style that is passed to the outermost container that wraps the entire content, including left and right items and both title and description.
7171
*/
7272
containerStyle?: StyleProp<ViewStyle>;
7373
/**

src/components/Menu/MenuItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export type Props = {
6969
*/
7070
style?: StyleProp<ViewStyle>;
7171
/**
72-
* Style that is passed to the outermost container that wraps the entire content, including icons and text.
72+
* Style that is passed to the outermost container that wraps the entire content, including leading and trailing icons and title text.
7373
*/
7474
containerStyle?: StyleProp<ViewStyle>;
7575
/**

src/components/__tests__/__snapshots__/ListAccordion.test.tsx.snap

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ exports[`renders expanded accordion 1`] = `
5858
<View
5959
pointerEvents="none"
6060
style={
61-
{
62-
"flexDirection": "row",
63-
"marginVertical": 6,
64-
}
61+
[
62+
{
63+
"flexDirection": "row",
64+
"marginVertical": 6,
65+
},
66+
undefined,
67+
]
6568
}
6669
>
6770
<View
@@ -74,6 +77,7 @@ exports[`renders expanded accordion 1`] = `
7477
"flex": 1,
7578
"justifyContent": "center",
7679
},
80+
undefined,
7781
]
7882
}
7983
>
@@ -326,10 +330,13 @@ exports[`renders list accordion with children 1`] = `
326330
<View
327331
pointerEvents="none"
328332
style={
329-
{
330-
"flexDirection": "row",
331-
"marginVertical": 6,
332-
}
333+
[
334+
{
335+
"flexDirection": "row",
336+
"marginVertical": 6,
337+
},
338+
undefined,
339+
]
333340
}
334341
>
335342
<View
@@ -396,6 +403,7 @@ exports[`renders list accordion with children 1`] = `
396403
"flex": 1,
397404
"justifyContent": "center",
398405
},
406+
undefined,
399407
]
400408
}
401409
>
@@ -543,10 +551,13 @@ exports[`renders list accordion with custom title and description styles 1`] = `
543551
<View
544552
pointerEvents="none"
545553
style={
546-
{
547-
"flexDirection": "row",
548-
"marginVertical": 6,
549-
}
554+
[
555+
{
556+
"flexDirection": "row",
557+
"marginVertical": 6,
558+
},
559+
undefined,
560+
]
550561
}
551562
>
552563
<View
@@ -559,6 +570,7 @@ exports[`renders list accordion with custom title and description styles 1`] = `
559570
"flex": 1,
560571
"justifyContent": "center",
561572
},
573+
undefined,
562574
]
563575
}
564576
>
@@ -746,10 +758,13 @@ exports[`renders list accordion with left items 1`] = `
746758
<View
747759
pointerEvents="none"
748760
style={
749-
{
750-
"flexDirection": "row",
751-
"marginVertical": 6,
752-
}
761+
[
762+
{
763+
"flexDirection": "row",
764+
"marginVertical": 6,
765+
},
766+
undefined,
767+
]
753768
}
754769
>
755770
<View
@@ -816,6 +831,7 @@ exports[`renders list accordion with left items 1`] = `
816831
"flex": 1,
817832
"justifyContent": "center",
818833
},
834+
undefined,
819835
]
820836
}
821837
>
@@ -963,10 +979,13 @@ exports[`renders multiline list accordion 1`] = `
963979
<View
964980
pointerEvents="none"
965981
style={
966-
{
967-
"flexDirection": "row",
968-
"marginVertical": 6,
969-
}
982+
[
983+
{
984+
"flexDirection": "row",
985+
"marginVertical": 6,
986+
},
987+
undefined,
988+
]
970989
}
971990
>
972991
<View
@@ -979,6 +998,7 @@ exports[`renders multiline list accordion 1`] = `
979998
"flex": 1,
980999
"justifyContent": "center",
9811000
},
1001+
undefined,
9821002
]
9831003
}
9841004
>

0 commit comments

Comments
 (0)