Skip to content

Commit 0a40a7d

Browse files
Merge branch 'main' into feat/refactor-icon-button-component
Co-authored-by: Cursor <cursoragent@cursor.com>
2 parents 5d3d043 + cbcd52f commit 0a40a7d

62 files changed

Lines changed: 228 additions & 430 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/README.md‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎.github/copilot-instructions.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
- Review new or modified public APIs for visibility, naming, defaults, customizability, and extensibility.
1313
- Ensure public APIs and exported types do not leak implementation details.
1414

15-
## Tests
15+
## Dependencies
16+
17+
- For dependencies added for individual components, evaluate bundle size and platform impact. Prefer existing capabilities when they meet the requirements.
18+
19+
## Validation
1620

1721
- Call out missing tests when the changed behavior is risky.
22+
- For visual changes, check before and after screenshots or videos for each affected platform and a nearby unaffected case.

‎.github/instructions/code.instructions.md‎

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
applyTo: "**/*.{ts,tsx,js,jsx}"
2+
applyTo: '**/*.{ts,tsx,js,jsx}'
33
---
44

5-
# TypeScript And React Review Instructions
5+
# TypeScript and React Review Instructions
66

77
## Code Quality
88

@@ -18,6 +18,7 @@ applyTo: "**/*.{ts,tsx,js,jsx}"
1818
- Only accept `@ts-expect-error` when it has a comment explaining why the error is expected and cannot be resolved.
1919
- Prefer simple types over complex conditional types, overloads, or type logic when simpler approaches work.
2020
- Prefer `type` aliases over `interface` unless there is a specific reason to use `interface`.
21+
- Reuse React Native prop and ref types where they describe the component's contract.
2122

2223
## React
2324

@@ -29,12 +30,37 @@ applyTo: "**/*.{ts,tsx,js,jsx}"
2930
- Avoid `React.Children`, `cloneElement`, and reading React elements directly unless there is a strong justification.
3031
- Treat memoization as something that needs a reason: expensive calculation, stable identity requirement, or measured performance need.
3132
- Check async effects for cancellation or race conditions when relevant.
32-
- Check accessibility: labels, roles, focus order, keyboard interactions, disabled states, and loading states.
3333

34-
## Animations And Layout
34+
## Component APIs and Styles
35+
36+
- Prefer existing native props or `style` over new props when they express the required behavior.
37+
- Verify that components forward relevant native props and events without changing their meaning.
38+
- Ensure controlled values have callbacks to update them. Support uncontrolled input when controlled rendering causes a demonstrated performance or reliability problem.
39+
- Merge consumer styles after defaults for supported overrides. Check that computed styles preserve supplied padding, colors, dimensions, and other supported values.
40+
- Expose test IDs for public interaction or content. Avoid IDs on internal wrappers solely for tests and default IDs that can collide across component instances.
41+
42+
## Design and Accessibility
43+
44+
- Compare component states, dimensions, icons, shapes, ripple effects, and disabled appearance with the Material Design specification.
45+
- Use theme defaults and named tokens for colors, spacing, sizing, and motion where available. Check spacing against the design scale.
46+
- Check labels, roles, focus order, and loading states. Verify keyboard, mouse, and touch interaction where applicable.
47+
- Ensure disabled controls expose their state to assistive technology and prevent activation. Preserve appropriate focus when a control becomes unavailable after activation.
48+
- Check that dismissing temporary UI restores focus to an appropriate element.
49+
- Ensure visual changes do not make noninteractive content pressable.
50+
51+
## Platforms
52+
53+
- Check affected behavior on iOS, Android, and web, including positioning and interaction within scrolling containers and safe areas.
54+
- Use direct `Platform.OS` checks or `Platform.select` so build tools can remove unused branches. Use `.native` files for native/web splits.
55+
- Use CSS for web behavior it already supports instead of recreating it with JavaScript or layout measurements.
56+
- Keep browser APIs and layout measurements out of server rendering. Verify that server output and the initial client render match.
57+
58+
## Animations and Layout
3559

3660
- Check for unnecessary layout shifts.
3761
- Prefer animating only `transform` and `opacity` unless another property is required.
38-
- For layout transitions, verify the approach handles rapid state changes, gestures, interruption, and cancellation.
62+
- Verify that animations handle rapid state changes, gestures, interruption, and cancellation. Stale completion callbacks must not leave rendered state, focus, or component callbacks inconsistent.
3963
- Check that duration and easing feel appropriate for the platform and interaction.
64+
- Keep continuous gesture work off the JavaScript thread when responsiveness requires it, using Gesture Handler and Reanimated where appropriate.
65+
- Measure dimensions near animation start when this provides current values and avoids extra state.
4066
- Verify text and UI elements do not overlap or overflow at supported screen sizes.
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
2-
applyTo: "**/*.{md,mdx}"
2+
applyTo: '**/*.{md,mdx}'
33
---
44

55
# Documentation Review Instructions
66

7-
- Verify examples match the actual API.
8-
- Check changed heading hierarchy for consistency.
9-
- Check changed internal links and anchors for consistency.
10-
- Check that documentation explains public behavior, not implementation details.
11-
- Check that examples are self-contained and demonstrate only the relevant behavior instead of mixing multiple behaviors.
12-
- Check that migration guide examples show diff or before/after code snippets when relevant.
7+
- Verify that examples match the actual API, are self-contained, and focus on the relevant behavior.
8+
- Check that changed headings follow the document hierarchy.
9+
- Verify that changed internal links and anchors lead to the intended content.
10+
- Ensure documentation explains public behavior.
11+
- Use diffs or before and after code snippets in migration guides when they help explain the change.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
applyTo: "**/*.{test,spec}.{ts,tsx,js,jsx}"
2+
applyTo: '**/*.{test,spec}.{ts,tsx,js,jsx}'
33
---
44

55
# Test Review Instructions
66

7-
- Check that tests verify public behavior, not implementation details.
7+
- Check that tests verify public behavior, including rendered output, interaction, callbacks, and warnings. Flag assertions about private properties, context internals, or exact internal style values.
8+
- Test internal helpers directly only when their logic is complex enough to justify separate coverage.
9+
- Prefer accessibility queries, then test IDs for public interaction or content.
810
- Check that test titles describe user-facing behavior.
911
- Check coverage of happy paths, edge cases, and error states.
1012
- Flag unnecessary mocking.

‎.github/pull_request_template.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99

1010
<!-- If this pull request addresses an existing issue, link to the issue. If an issue is not present, describe the issue here. -->
1111

12-
### Test plan
12+
### Screenshots / Videos
13+
14+
<!-- Provide screenshots or videos if the change affects UI, and Before/After comparisons if applicable. -->
1315

14-
<!-- Describe the **steps to test this change**, so that a reviewer can verify it. Provide screenshots or videos if the change affects UI. -->
16+
### Test plan
1517

16-
<!-- Keep in mind that PR changes must pass lint, typecheck and tests. -->
18+
<!-- Describe the **steps to test this change**, so that a reviewer can verify it. -->

‎AGENTS.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Project instructions
2+
3+
Read and follow the relevant project guidance before making or reviewing changes:
4+
5+
- [README.md](README.md) for the project overview and documentation links.
6+
- [CONTRIBUTING.md](CONTRIBUTING.md) for setup, development workflow, validation, component guidelines, and commit conventions.
7+
- [package.json](package.json) for the package manager version and available scripts.
8+
- [CI workflow](.github/workflows/ci.yml) for build and validation checks.
9+
- [Pull request template](.github/pull_request_template.md) when preparing a pull request.
10+
11+
For implementation and review, apply the shared review instructions:
12+
13+
- [General review standards](.github/copilot-instructions.md).
14+
- [TypeScript and React rules](.github/instructions/code.instructions.md) for JavaScript and TypeScript files.
15+
- [Documentation rules](.github/instructions/docs.instructions.md) for Markdown and MDX files.
16+
- [Test rules](.github/instructions/tests.instructions.md) for test files.

‎CLAUDE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

‎docs/6.x/docs/guides/migration.md‎

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,61 @@ You can use the component's color prop where available, or override the correspo
7171

7272
### Test IDs
7373

74-
Some hardcoded and generated test IDs have been removed for the following components:
75-
76-
- `Appbar.Header`: `${testID}-root-layer`
77-
- `Surface`: `surface` and `${testID}-outer-layer`
78-
79-
You can specify a `testID` explicitly and use that value to query the component.
74+
Hardcoded default test IDs have been removed for the components listed below. Many of these components also derive test IDs for their internal parts by appending a suffix to the `testID` prop (e.g. `${testID}-container`). Since `testID` is no longer defaulted to a hardcoded value, none of these derived test IDs are set either unless you pass a `testID` explicitly — so all queries by the IDs below will stop matching:
75+
76+
- `Appbar.Content`: `appbar-content`
77+
- `appbar-content-title-text`
78+
- `Appbar.Header`: `appbar-header`
79+
- `appbar-header-root-layer`
80+
- `BottomNavigation`: `bottom-navigation`
81+
- `bottom-navigation-bar`
82+
- `BottomNavigation.Bar`: `bottom-navigation-bar`
83+
- `bottom-navigation-bar-content`
84+
- `bottom-navigation-bar-content-wrapper`
85+
- `Button`: `button`
86+
- `button-container`
87+
- `button-icon-container`
88+
- `button-text`
89+
- `Card`: `card`
90+
- `card-container`
91+
- `card-outline`
92+
- `Chip`: `chip`
93+
- `chip-container`
94+
- `Drawer.CollapsedItem`: `drawer-collapsed-item`
95+
- `drawer-collapsed-item-outline`
96+
- `drawer-collapsed-item-container`
97+
- `FAB`: `floating-action-button`
98+
- `floating-action-button-container`
99+
- `floating-action-button-text`
100+
- `FAB.Extended`: `extended-floating-action-button`
101+
- `extended-floating-action-button-container`
102+
- `extended-floating-action-button-text`
103+
- `FAB.Menu`: `floating-action-button-menu`
104+
- `IconButton`: `icon-button`
105+
- `icon-button-container`
106+
- `icon-button-icon` (and `icon-button-icon-previous` / `icon-button-icon-current` when `animated`)
107+
- `Menu`: `menu`
108+
- `menu-view`
109+
- `menu-surface`
110+
- `Menu.Item`: `menu-item`
111+
- `menu-item-title`
112+
- `Modal`: `modal`
113+
- `modal-backdrop`
114+
- `modal-wrapper`
115+
- `modal-surface`
116+
- `ProgressBar`: `progress-bar`
117+
- `progress-bar-fill`
118+
- `Searchbar`: `search-bar`
119+
- `search-bar-container`
120+
- `search-bar-icon`
121+
- `search-bar-icon-wrapper`
122+
- `search-bar-clear-icon`
123+
- `search-bar-trailering-icon`
124+
- `search-bar-divider`
125+
- `Surface`: `surface`
126+
- `surface-outer-layer`
127+
128+
You can specify a `testID` explicitly to restore both the component's own test ID and all of its derived test IDs above, using the same suffixes.
80129

81130
## Components
82131

‎src/components/Appbar/AppbarContent.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const AppbarContent = ({
9595
titleMaxFontSizeMultiplier,
9696
mode = 'small',
9797
theme: themeOverrides,
98-
testID = 'appbar-content',
98+
testID,
9999
...rest
100100
}: Props) => {
101101
const theme = useInternalTheme(themeOverrides);
@@ -135,7 +135,7 @@ const AppbarContent = ({
135135
numberOfLines={1}
136136
accessible
137137
role={onPress ? 'none' : 'heading'}
138-
testID={`${testID}-title-text`}
138+
testID={testID ? `${testID}-title-text` : undefined}
139139
maxFontSizeMultiplier={titleMaxFontSizeMultiplier}
140140
>
141141
{title}

0 commit comments

Comments
 (0)