Skip to content

refactor: example app - #5053

Open
michalfedyna wants to merge 17 commits into
callstack:mainfrom
michalfedyna:refactor/example-app
Open

michalfedyna wants to merge 17 commits into
callstack:mainfrom
michalfedyna:refactor/example-app

Conversation

@michalfedyna

@michalfedyna michalfedyna commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

PR improves example app. It adds:

  • Samples screen
  • 8 small and focused samples
  • Improved UI for preferences
  • Search for example usage list
Screen iOS Android
Samples list ios-01 android-01
Preferences ios-02 android-02
Examples list ios-03 android-03
Search ios-04 android-04
Sign up sample ios-05 android-05
Contacts sample ios-06 android-06
Article sample ios-07 android-07
Settings sample ios-08 android-08
Player sample ios-09 android-09
Orders sample ios-10 android-10
Help center sample ios-11 android-11
Workspace sample ios-12 android-12

Related issue

#4992

Test plan

yarn lint, yarn typecheck, yarn test and a visual check of provided screenshots

@MikitasK MikitasK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks awesome! good job 👍
just a few points to address before merge:

Comment thread example/src/SamplesList.tsx Resolved

@MikitasK MikitasK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment thread example/src/SamplesList.tsx Resolved
Comment thread example/src/RootNavigator.tsx Resolved
Comment thread example/src/RootNavigator.tsx Resolved
Comment thread example/src/Samples/WorkspaceSample.tsx Resolved
Comment thread example/src/RootNavigator.tsx Resolved
Comment thread example/src/RootNavigator.tsx Resolved
Comment thread example/src/Samples/PlayerSample.tsx Resolved

@JKobrynski JKobrynski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @satya164 all yours

@JKobrynski

Copy link
Copy Markdown
Collaborator

@michalfedyna the workflows are running, please resolve those comments that you've addressed to clean this PR up 🙏

@michalfedyna

Copy link
Copy Markdown
Contributor Author

@JKobrynski Thank you!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical navigation-state persistence issue and additional preference, layout, and accessibility issues.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Refactors the example app into a samples-first experience with searchable examples, stack navigation, and modal preferences.

Changes:

  • Adds eight focused sample screens and a samples catalog.
  • Replaces drawer navigation and preferences with stack navigation and a modal.
  • Adds example search, preference state management, and typed object utilities.

Review findings:

  • Critical (3 votes): Version or validate persisted navigation state after the navigator migration.
  • Moderate (3 votes): Reset must restore the initial RTL setting.
  • Moderate (2 votes): Keep the preferences action available while searching.
  • Moderate (1 vote): Move Dialog.Actions outside Dialog.Content.
  • Moderate (1 vote): Add accessible, row-specific labels to order checkboxes.
File summaries
File Description
example/utils/typedObject.ts Adds typed object helpers.
example/utils/index.ts Removes the obsolete web helper.
example/src/SamplesList.tsx Adds the samples catalog.
example/src/Samples/WorkspaceSample.tsx Adds the workspace sample.
example/src/Samples/types.ts Defines sample metadata.
example/src/Samples/SignUpSample.tsx Adds the sign-up sample.
example/src/Samples/SettingsSample.tsx Adds the settings sample.
example/src/Samples/PlayerSample.tsx Adds the player sample.
example/src/Samples/OrdersSample.tsx Adds the orders sample; checkbox labels require accessibility updates.
example/src/Samples/HelpCenterSample.tsx Adds the help center sample.
example/src/Samples/ContactsSample.tsx Adds the contacts sample.
example/src/Samples/ArticleSample.tsx Adds the article sample.
example/src/RootNavigator.tsx Configures sample and example routes.
example/src/Preferences/useSetupPreferences.ts Centralizes preference persistence; navigation-state migration and RTL reset require fixes.
example/src/Preferences/usePreferences.tsx Adds the preferences hook.
example/src/Preferences/PreferencesModal.tsx Adds the preferences modal; dialog actions need to be moved outside content.
example/src/Preferences/PreferencesContext.tsx Updates the preferences context type.
example/src/index.tsx Integrates navigation and preferences setup.
example/src/Examples/TooltipExample.tsx Updates platform detection.
example/src/Examples/SnackbarExample.tsx Uses the preferences hook.
example/src/Examples/SearchbarExample.tsx Replaces drawer access with preferences access.
example/src/Examples/CardExample.tsx Uses the preferences hook and platform API.
example/src/ExampleListHeader.tsx Adds searchable example controls; the preferences action must remain persistent.
example/src/ExampleList.tsx Adds example filtering and empty-state handling.
example/src/DrawerItems.tsx Removes the legacy drawer implementation.
Review details

Suppressed comments (2)

example/src/Preferences/PreferencesModal.tsx:164

  • Dialog.Actions is nested inside Dialog.Content, but Paper's dialog API expects these to be sibling children. This applies the content padding around the actions and the actions container padding again, producing incorrect spacing. Move the </Dialog.Content> before <Dialog.Actions>.
            <Dialog.Actions>
              <Button onPress={_handleDismissRTLDialog}>Ok</Button>
            </Dialog.Actions>
          </Dialog.Content>

example/src/Samples/OrdersSample.tsx:122

  • Each row renders a bare checkbox without an accessible label, so assistive technology exposes multiple indistinguishable checkbox controls and users cannot tell which order they are selecting. Add a row-specific label such as Select order ${order.id}.
              <Checkbox
                status={selected.includes(order.id) ? 'checked' : 'unchecked'}
                onPress={() => toggleSelected(order.id)}
              />
  • Files reviewed: 25/25 changed files
  • Comments generated: 3
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread example/src/ExampleListHeader.tsx Resolved
@satya164

Copy link
Copy Markdown
Contributor

Review by Claude

Web

  1. The "New contact" FAB in the Contacts sample stays on the right in RTL. Steps: open Preferences, turn on RTL, open Samples > Contacts. The rest of the screen flips, but the FAB keeps right: 16. On iOS and Android the native layout swaps it to the left, so web is the only platform where it stays on the right. Expected: the FAB sits at the end edge, so on the left in RTL. (via Claude, verify if it makes sense)

    Web, RTL, Contacts sample: the FAB stays on the right

  2. The Preferences modal fills the full window width on desktop web. Steps: open the web example in a 1280px wide window, press the cog. Each label sits on the far left and its switch on the far right, more than 1000px apart, so it is hard to see which switch goes with which label. Expected: a modal with a capped width, close to the old drawer width. (via Claude, verify if it makes sense)

    Web, 1280px wide: the Preferences modal spans the full width

@satya164 satya164 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Claude

  • This branch conflicts with main, and some APIs it uses changed there. After the rebase: Searchbar renamed traileringIcon, traileringIconAccessibilityLabel and onTraileringIconPress to trailingIcon, trailingIconAccessibilityLabel and onTrailingIconPress (#5117, used in ExampleListHeader.tsx). Modal renamed overlayAccessibilityLabel to dismissAccessibilityLabel and now needs an aria-label (#5125, used in PreferencesModal.tsx and HelpCenterSample.tsx). Dialog renders its own Portal now, so the Portal wrappers in PreferencesModal.tsx and SettingsSample.tsx can go.
  • @react-navigation/drawer is still in example/package.json, but nothing in the example imports it after this change. Remove it.

See the inline comments for the rest. (via Claude, verify if it makes sense)

Comment on lines +62 to +66
{item.components.map((component) => (
<Chip key={component} compact>
{component}
</Chip>
))}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tags are Chips without onPress, so each one is still a button for screen readers. On Android TalkBack announces every tag as a disabled button (6 to 8 per card), and iOS and web also expose them as buttons. The card itself, which is the real control, has no button role on any platform. Render the tags as plain Text (or another non-pressable element) so only the card is interactive. Giving the card a button role may need a change in Card, because Card passes role to its outer Surface and not to the inner Pressable. (via Claude, verify if it makes sense)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tags are now plain Text with a border, so screen readers no longer announce them as buttons; only the card is interactive. The card’s own button role is covered by callstack/react-native-paper#5116: it routes role and the accessibility props to the actionable target and defaults to button when the Card has a press handler, so I’ll pick that up here once it lands rather than duplicating it.

Comment thread example/src/Samples/ArticleSample.tsx Resolved
Comment thread example/src/Samples/ArticleSample.tsx Resolved
Comment thread example/src/Samples/WorkspaceSample.tsx Resolved
Comment thread example/src/Samples/ContactsSample.tsx Resolved
Comment thread example/src/Samples/PlayerSample.tsx Resolved
Comment thread example/src/index.tsx Resolved
@Doberjohn Doberjohn added this to the 6.0.0 milestone Oct 30, 2026
@Doberjohn

Copy link
Copy Markdown
Collaborator

/review

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on a0ec761. The verdict and the full list are in the summary comment.

Comment thread example/src/ExampleListHeader.tsx Resolved
@lukewalczak

Copy link
Copy Markdown
Member

/review

@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of c535297

Since the review of a0ec761: 0 new · 1 still open · 1 no longer raised

1 finding(s): 1 nit.

🔵 Nit (1)
Where Finding
example/src/Preferences/useSetupPreferences.ts:110 Reset leaves RTL mode on and re-persists the preferences it just cleared
Not in the reviewers' prompt (1 file)
  • yarn.lock: generated or a lockfile, so its lines were left out

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (b354fa9b5977).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 finding moved to a new line on c535297. The verdict and the full list are in the summary comment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants