Repository navigation
Rename Composable to NavDestination for clarity - #223
Merged
jonathanpeppers merged 1 commit intoJun 10, 2026
Merged
Conversation
The public sealed class `AndroidX.Compose.Composable` registers a route
with a `NavHost`. Its name is a footgun:
- "Composable" in Compose vocabulary normally means an `@Composable`
function.
- The base class for our own UI nodes is `ComposableNode` — `Composable`
sits awkwardly next to it (the two are *not* related; `Composable`
doesn't derive from `ComposableNode`).
- Kotlin spells the API `composable(route) { ... }` (lowercase builder
DSL), not a type — so naming the C# type `Composable` is the
conversion that introduced the conflict.
Rename to `NavDestination` (the actual concept). Clean break, no
`[Obsolete]` alias — all affected API lives in
`PublicAPI.Unshipped.txt` (never released), and an alias would just
defer the same churn for downstream callers.
Touches:
- Facade (4 files): `Composable.cs` → `NavDestination.cs`, plus crefs
/ collection types / doc examples in `NavHost.cs`, `NavController.cs`,
`NavBackStackEntry.cs`.
- Call sites (21 hits across 7 files): Jetchat (2), JetNews (3 + 1
string literal in `PostsRepo.cs`), Reply (5), Gallery scaffold (4),
BottomNavOptionsDemo (3), NavHostRouteArgsDemo (3).
- `PublicAPI.Unshipped.txt`: 5 `Composable.*` lines retitled to
`NavDestination.*`, plus `NavHost.Add(Composable?)` →
`NavHost.Add(NavDestination?)`.
No doc/README edits needed — remaining `Composable` mentions there refer
to Kotlin's `@Composable` annotation or our `ComposableNode` /
`ComposableLambdas` (unrelated types), not the renamed nav-destination.
Verified with generator tests (130/130 passing), facade build (0
errors), and full gallery Android build (0 warnings, 0 errors).
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
Renames the public Composable class to NavDestination to eliminate a naming collision with Kotlin's @Composable annotation and this repo's own ComposableNode base class. Since the old name only appeared in PublicAPI.Unshipped.txt (never released), no [Obsolete] shim is needed.
Changes:
- Rename
Composable→NavDestinationin the facade (NavDestination.cs), including both ctors, error messages, and internal comments; updateNavHost/NavController/NavBackStackEntrydoc crefs and field types accordingly. - Update all 21 call sites across Gallery scaffolding, demo files, and three sample apps (
Jetchat,JetNews,Reply) fromnew Composable(…)tonew NavDestination(…), including a string literal inPostsRepo.cs. - Replace the 6 old
Composable.*entries inPublicAPI.Unshipped.txtwith theirNavDestination.*equivalents and updateNavHost.Addparameter type.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Microsoft.AndroidX.Compose/NavDestination.cs |
Rename class & ctors from Composable to NavDestination; update error string and doc comments |
src/Microsoft.AndroidX.Compose/NavHost.cs |
Update List<Composable> → List<NavDestination>, Add(Composable?) → Add(NavDestination?), doc crefs |
src/Microsoft.AndroidX.Compose/NavController.cs |
Update <see cref> in XML docs |
src/Microsoft.AndroidX.Compose/NavBackStackEntry.cs |
Update <see cref> and code example in XML docs |
src/Microsoft.AndroidX.Compose/PublicAPI.Unshipped.txt |
Remove old Composable entries, add NavDestination entries, update NavHost.Add param type |
src/Microsoft.AndroidX.Compose.Gallery/GalleryScaffold.cs |
4× new Composable(…) → new NavDestination(…) |
src/Microsoft.AndroidX.Compose.Gallery/Demos/Navigation/NavHostRouteArgsDemo.cs |
3× call-site rename |
src/Microsoft.AndroidX.Compose.Gallery/Demos/Navigation/BottomNavOptionsDemo.cs |
3× call-site rename |
samples/Reply/ReplyApp.cs |
5× call-site rename |
samples/JetNews/PostsRepo.cs |
2× string-literal rename in article content |
samples/JetNews/JetnewsApp.cs |
3× call-site rename |
samples/Jetchat/JetchatApp.cs |
2× call-site rename |
jonathanpeppers
enabled auto-merge (squash)
June 10, 2026 00:50
jonathanpeppers
deleted the
jonathanpeppers/rename-composable-to-navdestination
branch
June 10, 2026 00:53
jonathanpeppers
added a commit
that referenced
this pull request
Jun 10, 2026
After [#221](../pull/221) (implicit `long → Color` conversion) and [#222](../pull/222) (theme reads off composer), the `*Argb` suffix on color properties is vestigial — callers can pass `scheme.OnSurface` (a `long`) straight to a `Color?` property and the implicit conversion does the rest. The five hand-written facades that still exposed `long? *Argb` are renamed here to match the shape the source-generated `Text` facade already uses (`public Color? Color`). ### Renames | File | Before | After | |------|--------|-------| | `Icon.cs` | `long? TintArgb` | `Color? Tint` | | `HorizontalDivider.cs` | `long? ColorArgb` | `Color? Color` | | `VerticalDivider.cs` | `long? ColorArgb` | `Color? Color` | | `CircularProgressIndicator.cs` | `long? ColorArgb`, `long? TrackColorArgb` | `Color? Color`, `Color? TrackColor` | | `LinearProgressIndicator.cs` | `long? ColorArgb`, `long? TrackColorArgb` | `Color? Color`, `Color? TrackColor` | The render bodies still call the bound `DividerKt` / `ProgressIndicatorKt` / `IconKt` bindings (and the `IconPainter` bridge) with a `long` color slot; the new properties are converted via `Color is { } c ? c : 0L`. ### No `[Obsolete]` aliases Same rationale as [#221](../pull/221), [#223](../pull/223), [#225](../pull/225), [#226](../pull/226), [#229](../pull/229): every removed entry was in `PublicAPI.Unshipped.txt`, never `Shipped.txt`, so a clean break is acceptable pre-1.0. Verified — only `Color.FromArgb(...)` factories remain (intentional, those aren't being renamed). ### Sweep 19 callsite renames across two samples; JetNews and the Gallery had no references. | Sample | File | Hits | |--------|------|------| | Jetchat | `Conversation.cs` | 5 | | Jetchat | `Profile.cs` | 4 | | Jetchat | `RecordButton.cs` | 2 | | Jetchat | `JetchatIcon.cs` | 2 | | Jetchat | `JetchatDrawer.cs` | 1 | | Reply | `EmailDetailAppBar.cs` | 1 | | Reply | `ReplyEmailListItem.cs` | 1 | | Reply | `ReplyEmailThreadItem.cs` | 1 | | Reply | `ReplyProfileImage.cs` | 1 | | Reply | `ReplySearchBar.cs` | 1 | ### Verified - ✅ `dotnet test src/Microsoft.AndroidX.Compose.SourceGenerators.Tests` — 132/132 - ✅ `dotnet build src/Microsoft.AndroidX.Compose` — clean (no RS0016/RS0017) - ✅ `dotnet build src/Microsoft.AndroidX.Compose.Gallery` - ✅ `dotnet build samples/Jetchat` - ✅ `dotnet build samples/JetNews` - ✅ `dotnet build samples/Reply` Not deployed to a device — leaving smoke-test for the user. ### Coordination Round-2 #2. Disjoint file set from sibling round-2 PRs except for `PublicAPI.Unshipped.txt` — expect a mechanical sort conflict on merge with round-2 #1 (`Modifier.Padding` defaults) and round-2 #3 (`Func<IComposer, ComposableNode>` implicit). Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The public sealed class
AndroidX.Compose.Composableregisters a route with aNavHost. The name was a footgun:@Composablefunction.ComposableNode—Composablesat awkwardly next to it (the two are not related;Composabledoesn't derive fromComposableNode, it's a route registration).composable(route) { ... }(lowercase builder DSL), not a type. Translating it as a C# class calledComposableis what introduced the conflict.Rename to
NavDestination(the actual concept). Reads naturally next toNavHost/NavController.Before:
After:
Clean break — no
[Obsolete]aliasAll affected API lines live in
PublicAPI.Unshipped.txt(never released in a stable build). Shipping an[Obsolete]Composable : NavDestinationwould just defer the same churn for downstream callers and clutter the public surface with two names for one concept.Changes
src/Microsoft.AndroidX.Compose/Composable.cs→NavDestination.cs<summary>+ error string + internal Render commentNavHost.cs,NavController.cs,NavBackStackEntry.csList<Composable>field,Add(Composable?)paramPostsRepo.cs), Reply (5), Gallery scaffold (4),BottomNavOptionsDemo(3),NavHostRouteArgsDemo(3)new Composable(...)→new NavDestination(...)PublicAPI.Unshipped.txtComposable.*lines →NavDestination.*;NavHost.Add(Composable?)→NavHost.Add(NavDestination?)No doc/README edits needed — remaining
Composablementions inREADME.md,docs/*, and sample READMEs refer to Kotlin's@Composableannotation or our unrelatedComposableNode/ComposableLambdas, not the renamed type.The internal helpers
ComposableLambdas.InstantiateNavComposableandComposeBridges.NavGraphBuilderComposablekeep their names — they're named after the Kotlin runtime they wrap (composableLambdaInstance,composable()) and aren't the renamed public type.Verification
dotnet test src/Microsoft.AndroidX.Compose.SourceGenerators.Tests— 130/130 passing.dotnet build src/Microsoft.AndroidX.Compose— clean (BG8605/BG8606 pre-existing binding warnings unchanged; no new RS0016/RS0017).dotnet build src/Microsoft.AndroidX.Compose.Gallery— 0 warnings, 0 errors.Co-authored-by: Copilot [email protected]