Core Principles
- •File-based Routing: The filesystem defines the routes.
- •Type Safety: Strictly typed route parameters.
- •Deep Linking: URLs should be meaningful.
CRITICAL RULES
1. Structure
- •
app/_layout.tsx: Root layout (Providers, Theme, Stack). - •
app/(tabs)/: file group for tab navigation. - •
app/product/[id].tsx: Dynamic route for product details.
2. Linking
- •ALWAYS use
<Link href="...">orrouter.push(...). - •NEVER use
React Navigationprops directly unless necessary (useuseRouterhook).
3. Typing
- •ALWAYS define search parameters interfaces for complex routes.
- •USE
useLocalSearchParams<Params>()to retrieve typed params.
4. Modals
- •USE
presentation: 'modal'in_layout.tsxfor creation flows (e.g., "Add Product").