Skip to content

Fix TypeError crash from expo-router Sitemap on unmatched routes#127

Open
gumclaw wants to merge 1 commit intomainfrom
fix/not-found-crash-sitemap
Open

Fix TypeError crash from expo-router Sitemap on unmatched routes#127
gumclaw wants to merge 1 commit intomainfrom
fix/not-found-crash-sitemap

Conversation

@gumclaw
Copy link
Copy Markdown

@gumclaw gumclaw commented Mar 30, 2026

Summary

  • Adds app/+not-found.tsx screen to handle unmatched routes, preventing expo-router from falling back to its built-in Sitemap view
  • The Sitemap view accesses window.location.origin which is undefined on native iOS, causing a TypeError: Cannot read property 'origin' of undefined crash
  • The not-found screen shows a "Page not found" message with a "Go back" button, using existing UI components and styling

Test plan

  • Added tests/components/not-found-screen.test.tsx with tests for rendering and navigation
  • All 91 existing tests continue to pass
  • Manually navigate to a non-existent route and verify the not-found screen is shown instead of a crash

🤖 Generated with Claude Code

The app was missing a +not-found.tsx file, causing expo-router to fall
back to its built-in Sitemap view on unmatched routes. The Sitemap
accesses window.location.origin which is undefined on native iOS,
resulting in a TypeError crash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants