Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
dc2be44
refactor: align List tokens, spacing and typography with MD3
adam-sajko Aug 7, 2026
b85da86
fix: propagate theme override and add three-line padding to List
adam-sajko Aug 19, 2026
f38d80d
fix: use 16dp trailing inset to match MD3
adam-sajko Aug 19, 2026
923a1d9
fix: use container heights in List and the expand token for the chevron
adam-sajko Aug 28, 2026
2564627
test: stabilise the Tooltip pressOut timing
adam-sajko Aug 25, 2026
3fc99ea
refactor: restore the List.Accordion colors helper
adam-sajko Aug 28, 2026
d413581
fix: align List spacing and container heights with MD3
adam-sajko Sep 1, 2026
bd23951
chore: forward accessory styles in the List.Item example
adam-sajko Sep 1, 2026
85e2a1e
feat: add selected state to List.Item and List.Accordion
adam-sajko Aug 7, 2026
7737875
feat: animate List.Accordion expand and collapse
adam-sajko Aug 7, 2026
ec5685e
feat: add typed leading and trailing slots to List.Item
adam-sajko Aug 7, 2026
369f05c
Merge remote-tracking branch 'upstream/main' into feat/list-md3-token…
adam-sajko Sep 9, 2026
b1af4c7
Merge branch 'feat/list-md3-tokens-spacing' into feat/list-selected-a…
adam-sajko Sep 9, 2026
647c158
Merge branch 'feat/list-selected-and-accordion-animation' into feat/l…
adam-sajko Sep 9, 2026
0c662fa
Merge remote-tracking branch 'upstream/main' into feat/list-md3-token…
adam-sajko Sep 15, 2026
61b5678
Merge branch 'feat/list-md3-tokens-spacing' into feat/list-selected-a…
adam-sajko Sep 15, 2026
560b69d
Merge branch 'feat/list-selected-and-accordion-animation' into feat/l…
adam-sajko Sep 15, 2026
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
79 changes: 46 additions & 33 deletions example/src/Examples/ListItemExample.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
import { View, StyleSheet } from 'react-native';
import { useState } from 'react';

import { List, Divider, Checkbox, Avatar, Switch } from 'react-native-paper';

import ScreenWrapper from '../ScreenWrapper';

const CenteredCheckbox = () => (
<View style={styles.centered}>
<Checkbox status="checked" />
</View>
);
const SelectableSection = () => {
const [selected, setSelected] = useState(0);

return (
<List.Section title="Selected">
{[0, 1, 2].map((index) => (
<List.Item
key={index}
title="Headline"
description="Supporting text"
selected={index === selected}
onPress={() => setSelected(index)}
leading={<List.Icon icon="account-outline" />}
/>
))}
<Divider />
</List.Section>
);
};

const ListItemExample = () => {
return (
<ScreenWrapper>
<SelectableSection />

<List.Section title="Text-only">
<List.Item title="Headline" />
<List.Item title="Headline" description="Supporting text" />
Expand All @@ -21,16 +37,19 @@ const ListItemExample = () => {
description="Supporting text that is long enough to fill up multiple lines in the item"
/>
<Divider />
<List.Item title="Headline" right={() => <CenteredCheckbox />} />
<List.Item
title="Headline"
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text"
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text that is long enough to fill up multiple lines in the item"
right={() => <Checkbox status="checked" />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<Divider />
</List.Section>
Expand All @@ -54,19 +73,19 @@ const ListItemExample = () => {
<List.Item
title="Headline"
left={(props) => <List.Icon {...props} icon="account-outline" />}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text"
left={(props) => <List.Icon {...props} icon="account-outline" />}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text that is long enough to fill up multiple lines in the item"
left={(props) => <List.Icon {...props} icon="account-outline" />}
right={() => <Checkbox status="checked" />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<Divider />
</List.Section>
Expand Down Expand Up @@ -98,23 +117,23 @@ const ListItemExample = () => {
left={(props) => (
<Avatar.Text style={props.style} label="A" size={40} />
)}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text"
left={(props) => (
<Avatar.Text style={props.style} label="A" size={40} />
)}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text that is long enough to fill up multiple lines in the item"
left={(props) => (
<Avatar.Text style={props.style} label="A" size={40} />
)}
right={() => <Checkbox status="checked" />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<Divider />
</List.Section>
Expand Down Expand Up @@ -158,7 +177,7 @@ const ListItemExample = () => {
source={require('../../../example/assets/images/strawberries.jpg')}
/>
)}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
Expand All @@ -169,7 +188,7 @@ const ListItemExample = () => {
source={require('../../../example/assets/images/strawberries.jpg')}
/>
)}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
Expand All @@ -180,7 +199,7 @@ const ListItemExample = () => {
source={require('../../../example/assets/images/strawberries.jpg')}
/>
)}
right={() => <Checkbox status="checked" />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<Divider />
</List.Section>
Expand Down Expand Up @@ -228,7 +247,7 @@ const ListItemExample = () => {
source={require('../../../example/assets/images/strawberries.jpg')}
/>
)}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
Expand All @@ -240,7 +259,7 @@ const ListItemExample = () => {
source={require('../../../example/assets/images/strawberries.jpg')}
/>
)}
right={() => <CenteredCheckbox />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<List.Item
title="Headline"
Expand All @@ -252,56 +271,50 @@ const ListItemExample = () => {
source={require('../../../example/assets/images/strawberries.jpg')}
/>
)}
right={() => <Checkbox status="checked" />}
right={(props) => <Checkbox status="checked" style={props.style} />}
/>
<Divider />
</List.Section>

<List.Section title="With switch">
<List.Item
title="Headline"
right={() => <Switch disabled style={styles.centered} />}
right={(props) => <Switch disabled style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text"
right={() => <Switch disabled style={styles.centered} />}
right={(props) => <Switch disabled style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text that is long enough to fill up multiple lines in the item"
right={() => <Switch disabled />}
right={(props) => <Switch disabled style={props.style} />}
/>
<Divider />
<List.Item
title="Headline"
left={(props) => <List.Icon {...props} icon="account-outline" />}
right={() => <Switch disabled style={styles.centered} />}
right={(props) => <Switch disabled style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text"
left={(props) => <List.Icon {...props} icon="account-outline" />}
right={() => <Switch disabled style={styles.centered} />}
right={(props) => <Switch disabled style={props.style} />}
/>
<List.Item
title="Headline"
description="Supporting text that is long enough to fill up multiple lines in the item"
left={(props) => <List.Icon {...props} icon="account-outline" />}
right={() => <Switch disabled />}
right={(props) => <Switch disabled style={props.style} />}
/>
<Divider />
</List.Section>
</ScreenWrapper>
);
};

const styles = StyleSheet.create({
centered: {
alignSelf: 'center',
},
});

ListItemExample.title = 'List.Item';

export default ListItemExample;
Loading