Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
555b23e
refactor(drawer): align with latest MD3 navigation drawer spec
Aug 11, 2026
b746c65
docs(drawer): showcase the modernized Drawer and refresh docs
Aug 11, 2026
ad5c200
docs: record Drawer modernization decisions and MD3 glossary
Aug 11, 2026
b845692
docs: correct theme color roles in component tables
Aug 11, 2026
d85720f
Merge branch 'claude/wonderful-ptolemy-6f0db6' into feat/modernize-dr…
Aug 11, 2026
de1a5c0
fix(drawer): dim disabled destinations
Aug 11, 2026
ddb2b9c
fix(jest): exclude .claude worktrees from test discovery
Aug 11, 2026
cb43d83
Revert "docs: record Drawer modernization decisions and MD3 glossary"
Aug 14, 2026
f6e0a26
chore: remove some comments
Aug 16, 2026
ce6db57
refactor(drawer): apply review feedback
Aug 16, 2026
0ee42bc
chore: remove some comments
Aug 16, 2026
d71d652
fix: drawer width
Aug 16, 2026
09fe61b
docs(drawer): recapture screenshots to match the original views
Aug 16, 2026
c665c63
fix(drawer): use onSurface for focused inactive items
Aug 17, 2026
bb6126e
Merge upstream/main into feat/modernize-drawer
Nov 18, 2026
347a463
fix(drawer): address review feedback
Nov 18, 2026
6e91d4a
Merge remote-tracking branch 'upstream/main' into feat/modernize-drawer
Nov 18, 2026
6d96304
Merge remote-tracking branch 'upstream/main' into feat/modernize-drawer
Nov 23, 2026
13aafdc
fix(drawer): valid destination semantics and MD3 hover/pressed colours
Nov 23, 2026
7af7bba
Update migration guide for Drawer API changes
Doberjohn Nov 24, 2026
16ba961
Fix section title wording in DrawerExample
Doberjohn Nov 24, 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
13 changes: 13 additions & 0 deletions docs/6.x/docs/guides/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,19 @@ The close button (`onClose`) now fills the trailing 34dp column reserved for it,

`TouchableRipple` draws the keyboard focus ring and takes a new `focusRing` prop. See [Focus indicator](#focus-indicator).

### Drawer

The `Drawer` API is unchanged in Paper 6.x. No props were renamed, removed, or given new defaults. `Drawer.Item`, `Drawer.CollapsedItem` and `Drawer.Section` were realigned with the current Material Design 3 navigation drawer spec, so their appearance changes:

- **Trailing padding.** `Drawer.Item` reserved 36dp between the drawer edge and its content on the trailing side, and 28dp on the leading side. Both are now 28dp, as the spec requires. The active indicator keeps its size. The label and the `right` content get 8dp more room.
- **Active label weight.** The label of an active `Drawer.Item` now uses the prominent `labelLargeEmphasized` weight (700). Inactive labels are unchanged at 500.
- **Section divider colour.** `Drawer.Section` drew its divider in a fixed grey that ignored the theme and was wrong in dark mode. It now uses `theme.colors.outlineVariant`, like every other `Divider`.
- **Focus indicator.** `Drawer.Item` and `Drawer.CollapsedItem` gain a keyboard focus ring in `theme.colors.secondary`. It appears only on keyboard focus, not on press.
- **Disabled state.** Disabled `Drawer.Item` and `Drawer.CollapsedItem` destinations are now dimmed to 38% opacity. In 5.x they looked the same as enabled ones.
- **Active destination on web.** On web, the active `Drawer.Item` or `Drawer.CollapsedItem` is marked with `aria-current="page"` instead of `aria-selected`, which isn't valid on a button. iOS and Android still use `aria-selected`.

If you were pixel-matching a drawer against Paper 5.x, the first two points are the ones that will shift your layout.

### TextInput

The Paper 6.x `TextInput` is a complete rewrite with a new API. Import the component the same way, but note that the props and behavior have changed significantly.
Expand Down
Binary file modified docs/public/screenshots/drawer-item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/public/screenshots/drawer-section.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/src/data/themeColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,15 @@ export const themeColors = {
inactive: {
'iconColor/textColor': 'theme.colors.onSurfaceVariant',
},
focused: {
focusIndicatorColor: 'theme.colors.secondary',
'iconColor/textColor (inactive)': 'theme.colors.onSurface',
},
},
'Drawer.Section': {
'-': {
titleColor: 'theme.colors.onSurfaceVariant',
dividerColor: 'theme.colors.outlineVariant',
},
},
FAB: {
Expand Down
25 changes: 12 additions & 13 deletions example/src/DrawerItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function DrawerItems() {

const _setDrawerItem = (index: number) => setDrawerItemIndex(index);

const { colors } = useTheme();
const { colors, shapes } = useTheme();
const expoGoExecution =
Constants.executionEnvironment === ExecutionEnvironment.StoreClient;

Expand Down Expand Up @@ -133,11 +133,14 @@ function DrawerItems() {

return (
<DrawerContentScrollView
alwaysBounceVertical={false}
style={[
styles.drawerContent,
{
backgroundColor: colors.surface,
backgroundColor: colors.surfaceContainerLow,
Comment thread
Stoneski93 marked this conversation as resolved.
Resolved
// This view paints over the navigator's container, so it repeats
// the MD3 container's rounded ending edge.
borderTopEndRadius: shapes.corner.large,
borderBottomEndRadius: shapes.corner.large,
},
]}
>
Expand Down Expand Up @@ -177,7 +180,7 @@ function DrawerItems() {
role="switch"
aria-checked={shouldUseDynamicTheme}
>
<View style={[styles.preference, styles.v3Preference]}>
<View style={styles.preference}>
<Text variant="labelLarge">Use Dynamic Theme</Text>
<View pointerEvents="none">
<Switch
Expand All @@ -194,7 +197,7 @@ function DrawerItems() {
role="switch"
aria-checked={isDarkTheme}
>
<View style={[styles.preference, styles.v3Preference]}>
<View style={styles.preference}>
<Text variant="labelLarge">Dark Theme</Text>
<View pointerEvents="none">
<Switch value={isDarkTheme} readOnly aria-hidden />
Expand All @@ -207,7 +210,7 @@ function DrawerItems() {
role="switch"
aria-checked={isRTL}
>
<View style={[styles.preference, styles.v3Preference]}>
<View style={styles.preference}>
<Text variant="labelLarge">RTL</Text>
<View pointerEvents="none">
<Switch value={isRTL} readOnly aria-hidden />
Expand All @@ -220,7 +223,7 @@ function DrawerItems() {
role="switch"
aria-checked={collapsed}
>
<View style={[styles.preference, styles.v3Preference]}>
<View style={styles.preference}>
<Text variant="labelLarge">Collapsed drawer *</Text>
<View pointerEvents="none">
<Switch value={collapsed} readOnly aria-hidden />
Expand All @@ -233,7 +236,7 @@ function DrawerItems() {
role="switch"
aria-checked={customFontLoaded}
>
<View style={[styles.preference, styles.v3Preference]}>
<View style={styles.preference}>
<Text variant="labelLarge">Custom font *</Text>
<View pointerEvents="none">
<Switch value={customFontLoaded} readOnly aria-hidden />
Expand All @@ -246,7 +249,7 @@ function DrawerItems() {
role="switch"
aria-checked={rippleEffectEnabled}
>
<View style={[styles.preference, styles.v3Preference]}>
<View style={styles.preference}>
<Text variant="labelLarge">
{Platform.OS === 'ios' ? 'Highlight' : 'Ripple'} effect *
</Text>
Expand Down Expand Up @@ -299,10 +302,6 @@ const styles = StyleSheet.create({
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingVertical: 12,
paddingHorizontal: 16,
},
v3Preference: {
height: 56,
paddingHorizontal: 28,
},
Expand Down
2 changes: 2 additions & 0 deletions example/src/ExampleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import ChipExample from './Examples/ChipExample';
import DataTableExample from './Examples/DataTableExample';
import DialogExample from './Examples/DialogExample';
import DividerExample from './Examples/DividerExample';
import DrawerExample from './Examples/DrawerExample';
import FABExample from './Examples/FABExample';
import IconButtonExample from './Examples/IconButtonExample';
import IconExample from './Examples/IconExample';
Expand Down Expand Up @@ -63,6 +64,7 @@ export const mainExamples = {
DataTable: DataTableExample,
Dialog: DialogExample,
Divider: DividerExample,
Drawer: DrawerExample,
FAB: FABExample,
IconButton: IconButtonExample,
Icon: IconExample,
Expand Down
211 changes: 211 additions & 0 deletions example/src/Examples/DrawerExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import type { ColorValue } from 'react-native';

import { Badge, Drawer, Text, useTheme } from 'react-native-paper';

import ScreenWrapper from '../ScreenWrapper';

const DRAWER_WIDTH = 360;

const Section = ({
title,
children,
}: {
title: string;
children: React.ReactNode;
}) => {
const theme = useTheme();

return (
<View style={styles.section}>
<Text
variant="labelSmall"
style={[styles.caption, { color: theme.colors.onSurfaceVariant }]}
>
{title}
</Text>
<View
style={[
styles.drawer,
{ backgroundColor: theme.colors.surfaceContainerLow },
]}
>
{children}
</View>
</View>
);
};

const Destinations = () => {
const [active, setActive] = React.useState('inbox');

return (
<Drawer.Section title="Mail" showDivider={false}>
<Drawer.Item
icon="inbox"
label="Inbox"
active={active === 'inbox'}
onPress={() => setActive('inbox')}
right={() => <Text variant="labelLarge">24</Text>}
/>
<Drawer.Item
icon="star"
label="Starred"
active={active === 'starred'}
onPress={() => setActive('starred')}
/>
<Drawer.Item
icon="send"
label="Sent"
active={active === 'sent'}
onPress={() => setActive('sent')}
/>
</Drawer.Section>
);
};

const DrawerExample = () => {
const [collapsed, setCollapsed] = React.useState('inbox');
// The destinations in the sections below share one active destination, so
// each of them can be pressed and focused like a real one.
const [selected, setSelected] = React.useState<string>();
const destination = (key: string) => ({
active: selected === key,
onPress: () => setSelected(key),
});

return (
<ScreenWrapper contentContainerStyle={styles.content}>
<Section title="Destinations: tap to change the active one">
<Destinations />
</Section>

<Section title="Without an icon, and with a truncated label">
<Drawer.Section showDivider={false}>
<Drawer.Item label="No icon" {...destination('no-icon')} />
<Drawer.Item
icon="delete"
label="A very long destination label that will be truncated"
{...destination('truncated')}
/>
</Drawer.Section>
</Section>

<Section title="Disabled">
<Drawer.Section showDivider={false}>
<Drawer.Item icon="archive" label="Archive" disabled />
<Drawer.Item
icon="star"
label="Active and disabled"
active
disabled
right={() => <Text variant="labelLarge">24</Text>}
/>
</Drawer.Section>
</Section>

<Section title="Trailing slot">
<Drawer.Section showDivider={false}>
<Drawer.Item
icon="alert"
label="Badge"
right={() => <Badge visible style={styles.badge} />}
{...destination('badge')}
/>
<Drawer.Item
icon="palette"
label="Coloured dot"
{...destination('dot')}
right={({ color }: { color: ColorValue }) => (
<Badge
visible
style={[styles.badge, { backgroundColor: color }]}
/>
)}
/>
</Drawer.Section>
</Section>

<Section title="Sections separated by a divider">
<Drawer.Section title="Mailboxes">
<Drawer.Item
icon="inbox"
label="Inbox"
{...destination('mailboxes-inbox')}
/>
</Drawer.Section>
<Drawer.Section title="Labels" showDivider={false}>
<Drawer.Item icon="tag" label="Work" {...destination('work')} />
</Drawer.Section>
</Section>

<Section title="Collapsed destinations">
<View style={styles.collapsed}>
<Drawer.CollapsedItem
focusedIcon="inbox"
unfocusedIcon="inbox-outline"
label="Inbox"
badge={24}
active={collapsed === 'inbox'}
onPress={() => setCollapsed('inbox')}
/>
<Drawer.CollapsedItem
focusedIcon="star"
unfocusedIcon="star-outline"
label="Starred"
active={collapsed === 'starred'}
onPress={() => setCollapsed('starred')}
/>
<Drawer.CollapsedItem
focusedIcon="bell"
unfocusedIcon="bell-outline"
badge
aria-label="Alerts"
active={collapsed === 'alerts'}
onPress={() => setCollapsed('alerts')}
/>
Comment thread
Doberjohn marked this conversation as resolved.
Resolved
<Drawer.CollapsedItem
focusedIcon="archive"
unfocusedIcon="archive-outline"
label="Disabled"
disabled
/>
</View>
</Section>
</ScreenWrapper>
);
};

DrawerExample.title = 'Drawer';

const styles = StyleSheet.create({
content: {
paddingVertical: 16,
},
section: {
marginBottom: 24,
},
caption: {
marginBottom: 8,
marginHorizontal: 16,
},
drawer: {
width: DRAWER_WIDTH,
maxWidth: '100%',
alignSelf: 'center',
paddingVertical: 8,
borderTopEndRadius: 16,
borderBottomEndRadius: 16,
},
badge: {
alignSelf: 'center',
},
collapsed: {
flexDirection: 'row',
justifyContent: 'center',
paddingVertical: 8,
},
});

export default DrawerExample;
Loading
Loading