StaffCoder
React Native
React NativeReact Native 0.81
12 modules · 47 challengesSign up
Modules12 modules · 47 challenges
The virtualisation and scheduling layer of a Hard-level React Native app. Long lists render through FlatList with a fixed row height and a getItemLayout derived from that so scrollToIndex lands exactly and no measurement pass is needed. Rows are wrapped in React.memo with a custom comparator that inspects only the fields the row actually renders — a change to any other field on the item never re-renders the row. Sort and filter results are memoised so scrolling never recomputes them. Heavy aggregation waits for the navigation transition via InteractionManager.runAfterInteractions, runs in chunks that yield to the event loop, reports progress after every slice, and cancels cleanly via AbortController when parameters change or the screen leaves — no post-unmount state update ever fires. Image-heavy grids use numColumns + removeClippedSubviews and hold viewabilityConfig frozen at module scope with a useRef-backed onViewableItemsChanged whose identity never changes. Where connectivity is intermittent, outcomes are queued to AsyncStorage and drained in order with idempotency (an already-synced entry is never posted twice).
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Card Settlement Ledger

Sign up to unlock
—No data yethard
About this challenge

The settlement ledger in a merchant payments app holding a quarter of transactions that stays smooth while the merchant scrolls, sorts and adjusts. FlatList virtualises with getItemLayout and a fixed row height; memoised rows use a custom comparator examining only the fields they render (id, merchant, brand, last4, net, status, onOpen); sort and filter results are memoised so scrolling never recomputes them. Adjusting a line replaces only that row's reference. Data comes from the platform's hosted read-only JSON API over fetch reading orders, with the base URL injected through configuration.

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

Claims Loss Ratio Report

Sign up to unlock
—No data yethard
About this challenge

The loss ratio report in an insurance portfolio app aggregating a large claims dataset without blocking the screen transition or the touch response. Aggregation is deferred until after the navigation transition with InteractionManager.runAfterInteractions, chunked so each slice yields to the event loop, and rendered as a progressive skeleton that fills in as portions complete. Outstanding chunks cancel via AbortController when the parameters change or the screen is left; leaving cancels the remainder and produces no post-unmount state update. The final ratios equal a direct computation over the fixture.

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

Product Imagery Library

Sign up to unlock
—No data yethard
About this challenge

The imagery library a merchandiser browses, rendering hundreds of bundled product shots without exhausting memory. A FlatList grid uses numColumns and removeClippedSubviews, showing a placeholder that swaps to the image only once the item becomes viewable via onViewableItemsChanged held in a useRef so its identity never changes across re-renders. viewabilityConfig is frozen at module scope; rows are memoised so a scroll direction change does not remount them; images use fixed dimensions and an explicit resizeMode. Once revealed, a tile stays revealed even after scrolling out.

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

Delivery Round Board

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

The round board where a courier records hundreds of drops with no connection and the outcomes sync on return to depot. A virtualised drop list with memoised rows and stable callbacks records outcomes to local state and appends to a queue in AsyncStorage. A drain routine posts queued outcomes in order when an injectable connectivity stub reports a connection, marking each synced. A mid-drain failure leaves the remainder queued and retryable; an already-synced outcome is never posted twice; leaving the screen cancels the in-flight drain cleanly. Star problem — accumulates the FlatList virtualisation + custom-comparator memoisation of 10333, the cancellation + no-post-unmount-state-update contract of 10334, and the stable viewability / callback-identity discipline of 10336, and lands them on an offline queue backed by AsyncStorage.

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.