Nothing on this page matches that. Check the list under the search box for matches on other pages.
Navigation
NV1MUST keep navigation typed end to end: typed routes in Expo Router, static configuration (the setup the React Navigation docs recommend) with inferred types, or a param list when screens are dynamic. NEVER cast params with as any.
NV2MUST, in Expo Router projects, import navigation APIs from expo-router. From SDK 56, importing @react-navigation/* packages directly in app code is not supported.
NV3MUST pass only IDs and primitives as params (ST5) and validate them at screen entry. Params can arrive from a deep link, so they are user input.
NV4MUST make every deep-linkable screen handle a missing or invalid param by redirecting, never by crashing.
NV5MUST decide signed-in vs signed-out in one place (root layout or root navigator, using the router’s protected or conditional screens). NEVER redirect per screen from a useEffect.
NV6NEVER call navigation from API or store code. Change state (for example, clear the session) and let NV5 route.
NV7SHOULD keep navigator nesting shallow: one stack per tab, modals at the root, at most 3 levels.
TypeScript
TS1MUST run with strict: true. New projects also turn on noUncheckedIndexedAccess.
TS2NEVER silence the compiler with any, @ts-ignore or a non-null !. Use unknown and narrow it. @ts-expect-error with a reason counts as a guardrail exception.
TS3MUST derive types from one source: an API type comes from its schema (z.infer<typeof Transfer>), never a hand-written copy beside it.
TS4SHOULD use string-literal unions or as const objects instead of enum.
TS5NEVER import another feature’s types except through its index.ts (S3).
API layer
AP1MUST have one API client in shared/lib/api (base URL, auth header, timeout, error shape). Features call it only through fetchers in their api/ folder. NEVER fetch inside a component.
AP2MUST use fetch unless the repo already uses another client (A2). NEVER add axios to a new project just for interceptors.
AP3MUST validate responses with a schema at the boundary for every endpoint that touches money, auth or navigation; SHOULD for the rest. Use the repo’s schema library, or Zod in a new project. A failed parse is reported (EB6) and shown as the error state.
AP4MUST turn every failure into one typed error shape ({ status, code, message }). UI branches on code, never on message text.
AP5MUST set a timeout on every request and leave retries to the query library. NEVER auto-retry a non-idempotent mutation (payment, transfer); send an idempotency key if the backend supports one.
AP6MUST refresh tokens in the client only, single-flight: concurrent 401s wait for one refresh. If the refresh fails, clear the session and let NV5 route.
AP7NEVER put secrets in the app. Anything bundled, including EXPO_PUBLIC_* variables, is readable by users. Secret keys live on the server.
AP8NEVER log request or response bodies containing tokens or personal data, including in internal test builds.
AP9NEVER add a DTO-to-model mapper layer by default. Map in the fetcher only when the API shape and the app’s needs truly differ.
// features/transfer/api/transfer.ts: schema → type → fetcher → query optionsexport const Transfer = z.object({ id: z.string(), amount: z.number().int(), status: z.enum(['pending', 'done', 'failed']) });export type Transfer = z.infer<typeof Transfer>;const getTransfer = (id: string) => api.get(`/transfers/${id}`, Transfer); // client parses with the schemaexport const transferQueries = { detail: (id: string) => queryOptions({ queryKey: ['transfer', id], queryFn: () => getTransfer(id) }),};