StaffCoder
React Native
React NativeReact Native 0.81
12 modules · 47 challengesSign up
Modules12 modules · 47 challenges
The layer of a React Native app that adapts to platform and screen. Platform-branching visual properties (header height, alignment, iOS shadow vs Android elevation, keyboard type) live inside StyleSheet.create + Platform.select rather than as branches in the JSX tree, so the returned elements are the same on both platforms. Layout adapts to useWindowDimensions — column counts derived against a minimum tile width with leftover width in the gutters, compact-vs-full variants at a documented height threshold, and orientation-driven conditional rendering — without remounting on a resize. Cards hold their shape through aspectRatio rather than a fixed height, and a flexible spacer absorbs remaining vertical space so fixed-shape content cannot grow past its intent. FlatList carries a key that changes on column-count change and a getItemLayout derived from the same row height so scrollToIndex lands exactly.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Network Status Header

Sign up to unlock
—No data yeteasy
About this challenge

A telecoms operator's service status header. A list of open incidents collapses to one headline state by severity precedence (any outage wins over any degradation, both win over all-clear); only the winning severity's count is shown, and an empty array renders the all-clear state. The header's height, title alignment and iOS-shadow-vs-Android-elevation live inside a single StyleSheet.create block using Platform.select — the JSX tree is identical on both platforms. A last-checked label reads relative below a documented age threshold and switches to an absolute clock time above it, derived from a passed _now_ so tests can exercise the switch without mocking the clock.

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

Delivery Slot Grid

Sign up to unlock
—No data yeteasy
About this challenge

A grocery delivery slot picker where whole tiles fit the width without ever being stretched past their maximum. Column count is derived from useWindowDimensions().width against a minimum tile width; leftover width lands in the gutters rather than in the tiles, and the derived tile width is capped at a documented maximum. The grid renders through FlatList's numColumns with a key that changes when the column count changes so React re-creates the list cleanly on reflow — no tile is dropped or duplicated. Per-slot state (full / scarce / ok) derives from capacity against a scarcity threshold; a surcharge chip renders only when non-zero; a price column renders only in landscape.

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

Digital Boarding Pass

Sign up to unlock
—No data yeteasy
About this challenge

A digital boarding pass a passenger holds up at the gate — readable on a small phone or a large one. The pass card holds a fixed aspectRatio (never a fixed height) so its shape is the same at every screen size; a boarding-group strip highlights the passenger's own group and dims groups already called; a flexible spacer between the card and the footer keeps the footer pinned above the safe-area inset without ever letting the card grow. useWindowDimensions switches to a compact layout below a documented height threshold — the card shrinks but keeps the aspect ratio, and the group strip collapses to a single line.

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

Hotel Rate Calendar

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

A nightly rate calendar in a hotel booking app where rates and availability depend on the stay length. Every night in the season renders through a single FlatList whose numColumns and rowHeight are derived from useWindowDimensions, and getItemLayout is derived from the same rowHeight so scrollToIndex lands exactly on the requested night without measuring. Each night shows the rate for the currently selected stayLength looked up from a length-of-stay rate table (with a documented fallback to the largest key at or below the current stayLength); a night whose minimum-stay requirement exceeds the selection renders disabled with the required nights shown in place of the rate. Platform.select supplies the header treatment inside a single StyleSheet.create block. renderItem is memoised so unrelated re-renders don't rebuild the row layout — only a stayLength or dimension change does.

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.