StaffCoder
React Native
React NativeReact Native 0.81
12 modules · 47 challengesSign up
Modules12 modules · 47 challenges
The navigation layer of a React Native app built on @react-navigation. Native stacks with route params carrying the id, dynamic header options set through navigation.setOptions (title and headerRight) from screen state, and repeated push calls that stack fresh screen entries instead of collapsing to one via navigate. Bottom tabs wrap per-tab nested stacks whose position is preserved across tab switches (never opting out with unmountOnBlur), and a custom tab bar reads badge counts from a shared Context and handles the tabPress event so pressing the focused tab pops that stack to its root. Auth vs service stacks are chosen conditionally from a session held in Context — never navigated to imperatively — and role-gated screens are absent from the navigator entirely for roles that do not have them. Async work inside a screen is focus-scoped via useFocusEffect with an AbortController that cancels the in-flight request cleanly on blur / unmount, and every focus re-fetches.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Property Viewing Flow

Sign up to unlock
—No data yetmedium
About this challenge

An estate-agent property viewing flow. Native Stack.Navigator with Listings → Property → RoomNote screens, route params carrying the listing reference, a dynamic header title set via navigation.setOptions once findPropertyByRef resolves, a header-right publish control disabled until the property loads, repeated navigation.push calls that stack a fresh RoomNote for every room the agent walks into (nextRoomNumber increments the counter), and a one-shot navigation.popToTop back to the listings queue.

Solved in a browser IDE and graded by tests. Sign up to solve

Restaurant Manager Access

Sign up to unlock
—No data yetmedium
About this challenge

A restaurant service app where floor staff and managers see different screens depending on session and role. RootNavigator reads a session from SessionContext and picks a stack via pickStackFor — auth stack when null, server stack for role 'server', manager stack for role 'manager'. Manager-only routes are registered only in the manager stack — hasRoute reflects the same lookup — so a server never has the Voids & Discounts route at all. Sign-in dispatches signIn({ role }); sign-out clears the session and by conditional render unmounts the service stack entirely, leaving no back entry.

Solved in a browser IDE and graded by tests. Sign up to solve

Travel Companion Hub

Sign up to unlock
—No data yetmedium
About this challenge

A travel companion hub screen. Bottom Tab.Navigator with Itinerary, Bookings and Expenses, each wrapping its own nested native Stack.Navigator, a custom HubTabBar that reads badge counts from CountsContext via computeBadges (and hides zero counts), and press behaviour that emits a tabPress event before navigating — pressing a non-focused tab navigates to it, pressing the focused tab pops that tab's nested stack to root. Inactive tabs preserve their nested stack state across switches — Tab.Navigator's default behaviour, never opted out of with unmountOnBlur.

Solved in a browser IDE and graded by tests. Sign up to solve

Courier Stop Detail

STAR
Solving it completes the module
—No data yetmedium
About this challenge

The stop screen in a courier delivery app. Native stack with Route → Stop; on focus StopScreen fires fetchImpl(buildStopUrl(stopId), { signal }) via useFocusEffect and passes the AbortController's signal, aborting the in-flight request cleanly on blur / unmount. Returning to the screen refetches — no caching. A stopReducer holds loading / loaded / error states, error state shows a Try again button that re-issues exactly one further request, and the injectable createApiClient factory serves fixtures with configurable failuresBeforeSuccess so tests never touch the network. Star problem — accumulates the route-params + push topics of 10231, the tab-preserving-position topic of 10232 and the declarative-context-driven navigation topic of 10233, and lands them on the focus-scoped async pattern that every real navigation-driven data fetch needs.

Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.