FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix broken navigation examples in the docs (use_route, Stack.Screen, nav.replace) · Issue #36 · pythonnative/pythonnative · GitHub

Repository navigation

Fix broken navigation examples in the docs (use_route, Stack.Screen, nav.replace) #36

Description

Problem

Several documentation pages show navigation code that doesn't run against the real API:

  • docs/getting-started.md (~lines 48 and 56-57): the example calls route.params.get('count', 0), but use_route() returns the params dict directly (see use_route() in src/pythonnative/navigation.py, line 920). It also calls Stack.Screen("Home", HomeScreen, ...) positionally, but Screen requires the keyword-only argument component= (see src/pythonnative/navigation.py, lines 532, 670, and 840).
  • docs/guides/navigation.md (~lines 35-36, 63-64, and 178-179): the same positional Stack.Screen(...) calls.
  • docs/examples/navigation.md (~line 41): uses route['params']['user_id'], but use_route() already returns the params dict, so this should be route['user_id'] (or route.get('user_id')). Lines 58-59 also recommend nav.replace(...), which doesn't exist; navigators expose navigate, go_back, and reset only.

Suggested fix

Update the snippets to match the real API, for example:

params = pn.use_route()
count = params.get("count", 0)

Stack.Screen("Home", component=HomeScreen, options={"title": "Home"})

and replace the nav.replace(...) mention with nav.reset(...).

docs/examples/navigation.md lines 51-52 already show the correct keyword form, so it's a good reference.

Verification

Run mkdocs build --strict and, ideally, paste the corrected getting-started example into a pn init project to confirm it runs.

Suggested commit message

docs(navigation): fix use_route and Stack.Screen examples

Activity

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

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationgood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL