From da6eed7b5bfa666f5d2824ed318b9f787dc1c346 Mon Sep 17 00:00:00 2001 From: Bao Nguyen Date: Sun, 23 Aug 2026 11:09:16 +0700 Subject: [PATCH 1/6] fix(appbar): make back icon respect the icon from Provider settings --- src/components/Appbar/AppbarBackIcon.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/Appbar/AppbarBackIcon.tsx b/src/components/Appbar/AppbarBackIcon.tsx index ff827b3f5f..3383909603 100644 --- a/src/components/Appbar/AppbarBackIcon.tsx +++ b/src/components/Appbar/AppbarBackIcon.tsx @@ -2,7 +2,7 @@ import { Image, Platform, StyleSheet, View } from 'react-native'; import type { ColorValue } from 'react-native'; import { useLocale } from '../../core/locale'; -import MaterialCommunityIcon from '../MaterialCommunityIcon'; +import Icon from '../Icon'; const AppbarBackIcon = ({ size, @@ -34,11 +34,10 @@ const AppbarBackIcon = ({ /> ) : ( - ); }; From 34ecfd789e03f9120a855c2788a938d1597fe8b1 Mon Sep 17 00:00:00 2001 From: Bao Nguyen Date: Tue, 25 Aug 2026 09:04:54 +0700 Subject: [PATCH 2/6] fix(appbar): respect the configured icon renderer on iOS Keep the bundled chevron only while the default renderer is in place, so an icon renderer passed through PaperProvider settings is also used for the back icon on iOS. --- src/components/Appbar/AppbarBackIcon.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Appbar/AppbarBackIcon.tsx b/src/components/Appbar/AppbarBackIcon.tsx index 3383909603..41a85a4a81 100644 --- a/src/components/Appbar/AppbarBackIcon.tsx +++ b/src/components/Appbar/AppbarBackIcon.tsx @@ -1,8 +1,12 @@ +import * as React from 'react'; import { Image, Platform, StyleSheet, View } from 'react-native'; import type { ColorValue } from 'react-native'; import { useLocale } from '../../core/locale'; +import { SettingsContext } from '../../core/settings'; +import type { Settings } from '../../core/settings'; import Icon from '../Icon'; +import MaterialCommunityIcon from '../MaterialCommunityIcon'; const AppbarBackIcon = ({ size, @@ -12,10 +16,16 @@ const AppbarBackIcon = ({ color: ColorValue; }) => { const { direction } = useLocale(); + const { icon } = React.useContext(SettingsContext); const isRTL = direction === 'rtl'; const iosIconSize = size - 3; - return Platform.OS === 'ios' ? ( + // The bundled chevron is only kept while the default icon renderer is in + // place, so a renderer configured through `PaperProvider` wins on iOS too. + const shouldUseIOSAsset = + Platform.OS === 'ios' && (!icon || icon === MaterialCommunityIcon); + + return shouldUseIOSAsset ? ( Date: Wed, 25 Nov 2026 12:49:27 +0200 Subject: [PATCH 3/6] fix(appbar): treat a missing icon renderer the same on every platform With settings={{ icon: undefined }} iOS kept the bundled chevron while Android and web rendered nothing. Only the default renderer keeps the chevron now, so every platform behaves like any other Icon without a renderer. Co-Authored-By: Claude Sonnet 5.5 --- src/components/Appbar/AppbarBackIcon.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Appbar/AppbarBackIcon.tsx b/src/components/Appbar/AppbarBackIcon.tsx index 41a85a4a81..d97ab74fd9 100644 --- a/src/components/Appbar/AppbarBackIcon.tsx +++ b/src/components/Appbar/AppbarBackIcon.tsx @@ -23,7 +23,7 @@ const AppbarBackIcon = ({ // The bundled chevron is only kept while the default icon renderer is in // place, so a renderer configured through `PaperProvider` wins on iOS too. const shouldUseIOSAsset = - Platform.OS === 'ios' && (!icon || icon === MaterialCommunityIcon); + Platform.OS === 'ios' && icon === MaterialCommunityIcon; return shouldUseIOSAsset ? ( Date: Wed, 25 Nov 2026 12:49:46 +0200 Subject: [PATCH 4/6] test(appbar): cover the settings icon for Appbar.BackAction Co-Authored-By: Claude Sonnet 5.5 --- .../__tests__/Appbar/Appbar.test.tsx | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/components/__tests__/Appbar/Appbar.test.tsx b/src/components/__tests__/Appbar/Appbar.test.tsx index 28c927d95a..a128fa6d71 100644 --- a/src/components/__tests__/Appbar/Appbar.test.tsx +++ b/src/components/__tests__/Appbar/Appbar.test.tsx @@ -1,4 +1,4 @@ -import { I18nManager, Text as NativeText, View } from 'react-native'; +import { I18nManager, Platform, Text as NativeText, View } from 'react-native'; import type { ColorValue } from 'react-native'; import { @@ -16,6 +16,8 @@ import { } from 'react-native-reanimated'; import { SafeAreaProvider } from 'react-native-safe-area-context'; +import PaperProvider from '../../../core/PaperProvider'; +import type { Settings } from '../../../core/settings'; import { fireEvent, render, screen, userEvent } from '../../../test-utils'; import { DarkTheme, LightTheme } from '../../../theme/schemes'; import { tokens } from '../../../theme/tokens'; @@ -1055,3 +1057,31 @@ describe('getAppbarColors', () => { ); }); }); + +describe('Appbar.BackAction icon', () => { + describe.each(['ios', 'android', 'web'] as const)('on %s', (os) => { + beforeEach(() => { + jest.replaceProperty(Platform, 'OS', os); + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + it.each(['ltr', 'rtl'] as const)( + 'draws the icon from the settings in a %s layout', + async (direction) => { + const icon = jest.fn>(() => null); + await render( + + {}} /> + + ); + + expect(icon).toHaveBeenCalledWith( + expect.objectContaining({ name: 'arrow-left', direction }) + ); + } + ); + }); +}); From b33e344477a2abdb9b87655a03e1c63669728124 Mon Sep 17 00:00:00 2001 From: Nikolay Arefyev Date: Wed, 25 Nov 2026 12:50:05 +0200 Subject: [PATCH 5/6] docs: note that Appbar.BackAction uses the settings icon Co-Authored-By: Claude Sonnet 5.5 --- docs/6.x/docs/guides/getting-started.mdx | 2 +- docs/6.x/docs/guides/icons.mdx | 2 ++ docs/6.x/docs/guides/migration.md | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/6.x/docs/guides/getting-started.mdx b/docs/6.x/docs/guides/getting-started.mdx index 8777daff41..304093d3ad 100644 --- a/docs/6.x/docs/guides/getting-started.mdx +++ b/docs/6.x/docs/guides/getting-started.mdx @@ -78,7 +78,7 @@ Follow the [React Native Reanimated installation guide](https://docs.swmansion.c If you're on a vanilla React Native project, you also need to install [@react-native-vector-icons/material-design-icons](https://github.com/oblador/react-native-vector-icons/tree/master/packages/material-design-icons). -Specifically, the `MaterialDesignIcons` icon pack needs to be included in the project because some components use those icons internally, such as `AppBar.BackAction` on Android. +Specifically, the `MaterialDesignIcons` icon pack needs to be included in the project when you use the default icon renderer, because some components use those icons internally, such as `Appbar.BackAction`. ```bash npm2yarn npm install @react-native-vector-icons/material-design-icons diff --git a/docs/6.x/docs/guides/icons.mdx b/docs/6.x/docs/guides/icons.mdx index e871db1407..fae73a371a 100644 --- a/docs/6.x/docs/guides/icons.mdx +++ b/docs/6.x/docs/guides/icons.mdx @@ -97,6 +97,8 @@ Example: If you want to use icons other than `MaterialDesignIcons` you need to import the icons and pass it to the `settings` prop within `PaperProvider`. +Paper's own components, such as `Appbar.BackAction`, pass Material Design icon names like `arrow-left` to this renderer, so use an icon set that has them or map those names yourself. + Example: ```js diff --git a/docs/6.x/docs/guides/migration.md b/docs/6.x/docs/guides/migration.md index 83cead4660..29de042cd9 100644 --- a/docs/6.x/docs/guides/migration.md +++ b/docs/6.x/docs/guides/migration.md @@ -575,6 +575,10 @@ A `theme` set on a part is merged over the `theme` of the `Appbar`, so it takes ``` +#### Back icon + +`Appbar.BackAction` now renders its icon through the `icon` in `PaperProvider`'s `settings`. On Android and web it always does, and on iOS only when you set a custom `icon`, otherwise the bundled chevron is kept. A custom renderer now receives `name: 'arrow-left'` for it, so make sure your icon set handles that name. + #### Bottom bar Using `Appbar` as a bottom bar is deprecated. Material Design 3 moves the bottom bar to toolbars. It continues to work in 6.x, and will be replaced by the `Toolbar` component once it is available. From 10ffa209c0e0f07b6708ad7a36fb1904670f3cc5 Mon Sep 17 00:00:00 2001 From: Nikolay Arefyev Date: Fri, 27 Nov 2026 16:07:23 +0200 Subject: [PATCH 6/6] docs(appbar): note that the iOS chevron check compares renderer identity Co-Authored-By: Claude Opus 5.5 --- src/components/Appbar/AppbarBackIcon.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Appbar/AppbarBackIcon.tsx b/src/components/Appbar/AppbarBackIcon.tsx index d97ab74fd9..0df967b567 100644 --- a/src/components/Appbar/AppbarBackIcon.tsx +++ b/src/components/Appbar/AppbarBackIcon.tsx @@ -22,6 +22,8 @@ const AppbarBackIcon = ({ // The bundled chevron is only kept while the default icon renderer is in // place, so a renderer configured through `PaperProvider` wins on iOS too. + // This is a reference check: any wrapper, even around the default renderer + // (e.g. `React.memo(MaterialCommunityIcon)`), counts as a custom renderer. const shouldUseIOSAsset = Platform.OS === 'ios' && icon === MaterialCommunityIcon;