Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 17 additions & 3 deletions src/components/List/ListAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,17 @@ export type Props = {
*/
background?: PressableAndroidRippleConfig;
/**
* Style that is passed to the wrapping TouchableRipple element.
* Style that is passed to the root TouchableRipple container.
*/
style?: StyleProp<ViewStyle>;
/**
* Style that is passed to the outermost container that wraps the entire content, including left and right items and both title and description.
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* Style that is passed to the content container, which wraps the title and description.
*/
contentStyle?: StyleProp<ViewStyle>;
/**
* Style that is passed to Title element.
*/
Expand Down Expand Up @@ -173,6 +181,8 @@ const ListAccordion = ({
descriptionNumberOfLines = 2,
rippleColor: customRippleColor,
style,
containerStyle,
contentStyle,
id,
testID,
background,
Expand Down Expand Up @@ -252,7 +262,7 @@ const ListAccordion = ({
borderless
>
<View
style={theme.isV3 ? styles.rowV3 : styles.row}
style={[theme.isV3 ? styles.rowV3 : styles.row, containerStyle]}
pointerEvents={pointerEvents}
>
{left
Expand All @@ -262,7 +272,11 @@ const ListAccordion = ({
})
: null}
<View
style={[theme.isV3 ? styles.itemV3 : styles.item, styles.content]}
style={[
theme.isV3 ? styles.itemV3 : styles.item,
styles.content,
contentStyle,
]}
>
<Text
selectable={false}
Expand Down
11 changes: 8 additions & 3 deletions src/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ export type Props = $RemoveChildren<typeof TouchableRipple> & {
*/
theme?: ThemeProp;
/**
* Style that is passed to the wrapping TouchableRipple element.
* Style that is passed to the root TouchableRipple container.
*/
style?: StyleProp<ViewStyle>;
/**
* Style that is passed to the container wrapping title and descripton.
* Style that is passed to the outermost container that wraps the entire content, including left and right items and both title and description.
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* Style that is passed to the content container, which wraps the title and description.
*/
contentStyle?: StyleProp<ViewStyle>;
/**
Expand Down Expand Up @@ -144,6 +148,7 @@ const ListItem = (
onPress,
theme: themeOverrides,
style,
containerStyle,
contentStyle,
titleStyle,
titleNumberOfLines = 1,
Expand Down Expand Up @@ -238,7 +243,7 @@ const ListItem = (
theme={theme}
testID={testID}
>
<View style={theme.isV3 ? styles.rowV3 : styles.row}>
<View style={[theme.isV3 ? styles.rowV3 : styles.row, containerStyle]}>
{left
? left({
color: descriptionColor,
Expand Down
14 changes: 13 additions & 1 deletion src/components/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,21 @@ export type Props = {
*/
titleMaxFontSizeMultiplier?: number;
/**
* Style that is passed to the root TouchableRipple container.
* @optional
*/
style?: StyleProp<ViewStyle>;
/**
* Style that is passed to the outermost container that wraps the entire content, including leading and trailing icons and title text.
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* Style that is passed to the content container, which wraps the title text.
*/
contentStyle?: StyleProp<ViewStyle>;
/**
* Style that is passed to the Title element.
*/
titleStyle?: StyleProp<TextStyle>;
/**
* Color of the ripple effect.
Expand Down Expand Up @@ -122,6 +133,7 @@ const MenuItem = ({
background,
onPress,
style,
containerStyle,
contentStyle,
titleStyle,
rippleColor: customRippleColor,
Expand Down Expand Up @@ -176,7 +188,7 @@ const MenuItem = ({
accessibilityState={newAccessibilityState}
rippleColor={rippleColor}
>
<View style={styles.row}>
<View style={[styles.row, containerStyle]}>
{leadingIcon ? (
<View
style={[!isV3 && styles.item, { width: iconWidth }]}
Expand Down
73 changes: 48 additions & 25 deletions src/components/__tests__/__snapshots__/ListAccordion.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ exports[`renders expanded accordion 1`] = `
<View
pointerEvents="none"
style={
{
"flexDirection": "row",
"marginVertical": 6,
}
[
{
"flexDirection": "row",
"marginVertical": 6,
},
undefined,
]
}
>
<View
Expand All @@ -74,6 +77,7 @@ exports[`renders expanded accordion 1`] = `
"flex": 1,
"justifyContent": "center",
},
undefined,
]
}
>
Expand Down Expand Up @@ -205,11 +209,14 @@ exports[`renders expanded accordion 1`] = `
>
<View
style={
{
"flexDirection": "row",
"marginVertical": 6,
"width": "100%",
}
[
{
"flexDirection": "row",
"marginVertical": 6,
"width": "100%",
},
undefined,
]
}
>
<View
Expand Down Expand Up @@ -323,10 +330,13 @@ exports[`renders list accordion with children 1`] = `
<View
pointerEvents="none"
style={
{
"flexDirection": "row",
"marginVertical": 6,
}
[
{
"flexDirection": "row",
"marginVertical": 6,
},
undefined,
]
}
>
<View
Expand Down Expand Up @@ -393,6 +403,7 @@ exports[`renders list accordion with children 1`] = `
"flex": 1,
"justifyContent": "center",
},
undefined,
]
}
>
Expand Down Expand Up @@ -540,10 +551,13 @@ exports[`renders list accordion with custom title and description styles 1`] = `
<View
pointerEvents="none"
style={
{
"flexDirection": "row",
"marginVertical": 6,
}
[
{
"flexDirection": "row",
"marginVertical": 6,
},
undefined,
]
}
>
<View
Expand All @@ -556,6 +570,7 @@ exports[`renders list accordion with custom title and description styles 1`] = `
"flex": 1,
"justifyContent": "center",
},
undefined,
]
}
>
Expand Down Expand Up @@ -743,10 +758,13 @@ exports[`renders list accordion with left items 1`] = `
<View
pointerEvents="none"
style={
{
"flexDirection": "row",
"marginVertical": 6,
}
[
{
"flexDirection": "row",
"marginVertical": 6,
},
undefined,
]
}
>
<View
Expand Down Expand Up @@ -813,6 +831,7 @@ exports[`renders list accordion with left items 1`] = `
"flex": 1,
"justifyContent": "center",
},
undefined,
]
}
>
Expand Down Expand Up @@ -960,10 +979,13 @@ exports[`renders multiline list accordion 1`] = `
<View
pointerEvents="none"
style={
{
"flexDirection": "row",
"marginVertical": 6,
}
[
{
"flexDirection": "row",
"marginVertical": 6,
},
undefined,
]
}
>
<View
Expand All @@ -976,6 +998,7 @@ exports[`renders multiline list accordion 1`] = `
"flex": 1,
"justifyContent": "center",
},
undefined,
]
}
>
Expand Down
Loading
Loading