StaffCoder
React Native
React NativeReact Native 0.81
12 modules · 47 challengesSign up
Modules12 modules · 47 challenges
The virtualisation layer of a React Native app. Long, scrollable content renders through FlatList or SectionList with getItemLayout derived from a known row height so the list can position rows without measuring — enabling initialScrollIndex, scrollToIndex, and scrollToLocation to land exactly. Rows are React.memo'd and renderItem is useCallback-memoised so an unrelated re-render does not rebuild any row, and sections and derived data are useMemo'd so their identity is stable. onViewableItemsChanged is held in a useRef so its identity never changes (RN throws otherwise) and drives sticky-header and in-view derivations from the reported viewable items. Screens navigate through prop-injected navigation and keep the list mounted behind an overlay so returning does not remount a single row.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

3 challenges

Medication Adherence Calendar

Sign up to unlock
—No data yetmedium
About this challenge

A chronic-care adherence calendar. A full year of dosing days scrolls through a virtualised FlatList opened on today via initialScrollIndex, getItemLayout is derived from a fixed row height so scrollToIndex lands exactly on any date, and a sticky month header follows the topmost viewable day via onViewableItemsChanged held in a useRef. Rows are React.memo'd; tapping a day opens a detail sheet listing that day's doses due, taken and missed — without re-rendering any other row in the list.

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

Trade Show Session Schedule

Sign up to unlock
—No data yetmedium
About this challenge

A conference schedule screen for a trade-show app. Sessions are grouped by hall in a SectionList with sticky section headers via a memoised sections array built from buildSections, jump-to-hall chips call scrollToLocation with the section index looked up from sectionIndexForHall, and an in-session banner names the first viewable session via firstViewableSession. The onViewableItemsChanged callback is held in a useRef so its identity never changes across unrelated re-renders — React Native throws otherwise.

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

Dealer Stock Directory

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

A used-vehicle stock directory for a dealership app. The catalogue loads via fetch from a configurable apiUrl into a virtualised FlatList with getItemLayout and React.memo'd rows; renderItem is useCallback-memoised so an unrelated re-render leaves its identity unchanged. Make / price / mileage filters compose to narrow the visible set, and a row that stays visible after a filter change does not remount. Tapping a vehicle calls prop-injected navigation.navigate('Detail', { id }) — the detail overlay renders only when route.name === 'Detail' and the list stays mounted behind it so returning does not remount a single row.

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.