Skip to content
tecminds

React Native Loading States: Shape-Matched Skeletons, a Delayed Progress Line, and Why We Dropped the Full-Page Spinner

A mobile app that shows a full-page spinner on every page change is a mobile app that keeps throwing the user's context away. For the 3.0.1 release of our ZSOPilot companion app we broke 'loading' into three states: shape-matched placeholder rows on the empty first render, a 2 pt progress line that only appears after 400 ms when visible content is refetching, and nothing at all when the load finishes within human-reaction time. This is the writeup of the state machine behind it, the one-line bug that taught us empty is not loaded, and the accessibility rules we picked up along the way.

TTobias LüscherCo‑Founder · TecMinds2026-11-09 · 12 min read

React Native Loading States: Shape-Matched Skeletons, a Delayed Progress Line, and Why We Dropped the Full-Page Spinner

A mobile app that shows a full-page spinner on every page change is a mobile app that keeps throwing the user's context away. Tap a tab, lose the screen you were just on. Pull to refresh, lose it again. The spinner is doing an honest job — it tells you something is happening — but the price it charges for that honesty is the layout, the data already on screen, and the sense of being in a place. For the 3.0.1 release of ZSOPilot, the mobile companion app we build for Swiss civil-defence (Zivilschutz) organizations on top of Expo SDK 57 and React Native, we tore the spinner out and replaced it with a state machine that distinguishes three different flavours of "loading" and renders a different thing — sometimes nothing — for each.

This is the writeup of that state machine, the accessibility rules we picked up along the way, and the one-line bug we shipped on the way to shipping the fix: an empty list that resolves before its parent block does will fool a naive "loaded" check every time.

The Three States We Actually Have

The first thing that broke our thinking was admitting that the component tree does not have a loading state. It has at least three, and each one wants a different pixel budget.

State one is the empty first render. No data at all, no layout to anchor to, the user has just navigated into a screen for the first time this session. The right thing to show is the shape of what is about to appear — because the user is going to look at this exact rectangle in a moment and the less the layout jumps when real data lands, the better. A spinner here is actively hostile: it centres a dot in a space that is about to become a list.

State two is a refetch of content already on screen. The user tapped the tab they were just on, or pulled to refresh, or the app came back from the background and a stale-while-revalidate query kicked in. The right thing to show is a tiny, quiet signal that something is happening — no layout change, no occluding overlay, no reason to lose the row the user was reading. A spinner here is worse than hostile: it erases context that was correct a second ago.

State three is a load that finishes within human-reaction time — somewhere under 150 ms. The right thing to show is nothing. A loading indicator that flashes for 80 ms is pure visual noise; the user sees a flicker and has no idea what it meant. Skipping it costs the user nothing and saves everyone the "did I just see something?" micro-confusion.

The spinner we inherited collapsed all three into one state. Every navigation, every refetch, every sub-100 ms query got the same centred ActivityIndicator. The design we shipped in 3.0.1 gives each of the three its own component and treats transitions between them as explicit, not accidental.

State One: Placeholder Rows in the Shape of the List

For the empty-first-render case, the component we render is a Placeholder whose geometry is deliberately close to the real list underneath. The ZSOPilot schedule, lessons, and material screens are all list-shaped: a time column on the left, a title and a caption stacked on the right, a 1 px hairline rule between rows. The placeholder draws the same shape — a 46 pt time column with two little stub bars, a flex-grow text column with a longer bar and a shorter bar beneath it, the same borderBottomColor as the real separator — and animates a single opacity pulse from 1.0 down to 0.45 and back over 1.4 seconds, in sync across every bar on the page.

Two decisions inside that are worth naming explicitly.

The widths vary. We rotate through six widths (72%, 54%, 81%, 63%, 47%, 69%) so the stack reads as a list, not as a barcode. Equal-width placeholders are the single most common skeleton bug: they read as a visual error, not as content, because real list items are never equal-width. Varying widths with no visible pattern — but not random, because random on remount flickers — is a cheap way to make the placeholder feel like it is standing in for something.

The placeholder itself is delayed. The component uses a small hook, useDelayed, which flips its boolean on only after the loading state has held for 150 ms:

export function useDelayed(active: boolean, delay: number) {
  const [shown, setShown] = useState(false);
  useEffect(() => {
    if (!active) return;
    const timer = setTimeout(() => setShown(true), delay);
    return () => {
      clearTimeout(timer);
      setShown(false);
    };
  }, [active, delay]);
  return active && shown;
}

For the first 150 ms the placeholder reserves vertical space equal to rows * 61 pt but draws nothing in it. If the real data arrives inside that window — and on a warm cache it usually does — the user never sees the skeleton, only the final list. If it does not arrive, the placeholder fades in and the user sees something that at least looks like the thing they asked for. The reserved space prevents a layout jump either way.

State Two: A Thin Line That Appears Only When Needed

For the refetch-of-visible-content case, the component we render is a two-pixel ink stroke under the header, called ProgressLine. It occupies zero layout space (height: 0, overflow: visible) so its appearance does not shift anything down, and it uses the same delayed-boolean trick with a longer threshold:

const visible = useDelayed(active, 400);

Four hundred milliseconds is the number that stopped us seeing it on cached refetches. Most pull-to-refresh calls on a healthy network finish in 200-350 ms; the progress line never appears for them. On a slow connection, after 400 ms it fades in and animates a short segment — 28% of the track width — sliding across under the header on a 1.1 s loop. The animation is a translateX interpolation on an Animated.Value driven through useNativeDriver: true, so it runs on the UI thread and does not interact with any list rendering happening below it.

The visual effect is that a user who is used to the app and knows the data is fresh never sees the indicator at all, and a user who is waiting notices only a thin ink line under the title bar — no modal, no overlay, no spinner in the middle of a page whose content they were already reading. The list below stays live and scrollable; stale data stays on screen until the refetch resolves, at which point it is replaced in place.

Both of these — the placeholder and the progress line — honour one accessibility rule and one piece of accessibility metadata.

The rule: AccessibilityInfo.isReduceMotionEnabled(). If the device has Reduce Motion on, the ProgressLine draws a static, dimmed bar at full width instead of sliding, and the placeholder stops pulsing. The hook we use subscribes to the reduceMotionChanged event so toggling the system setting changes the live app without a reload. The MDN primer on prefers-reduced-motion is the same idea; React Native exposes it through AccessibilityInfo.

The metadata: accessibilityRole="progressbar", with a localized accessibilityLabel ("Daten werden geladen" in German, "Wird aktualisiert" for the refetch line). Screen readers announce the right thing; VoiceOver no longer reads out "image" where a decorative animation lives.

State Three: Nothing At All

The third state is the one that is easiest to forget because it is defined by its absence. If the load finishes within 150 ms the placeholder never renders, and if the refetch finishes within 400 ms the progress line never appears. The user sees the final data and nothing before it. We did not need to write a component for this state — we needed to write a hook that prevents a component from rendering before it has earned the pixels.

This is where we spent the most time arguing with ourselves. The instinct is to show something on any non-zero load time because "then the user knows we are doing something". The reality is that a flash of a spinner at 80 ms is worse for perceived performance than a clean jump to the final content: the eye catches the change, the brain spends a moment deciding whether something broke, and only then settles on the real result. Delayed-render hooks are the same intuition as the serverless cold-start warmup ping on the backend — suppress the signal the user cannot act on, and only commit pixels when they will survive long enough to be read. The same logic cleans up the dashboard-fetch patterns we described in useQuery vs useEffect for Next.js dashboards.

The One-Line Bug: Empty Isn't Loaded

The state machine shipped, and on the first build we handed to our pilot users the lessons screen was still showing only the thin progress line on cold open, never the placeholder — even when the data visibly took three or four seconds to arrive on a bad connection. The log the user sent us said the fetch completed fast; the screen stayed empty afterwards for seconds more.

The cause was a boundary mistake in how we decided which state we were in. The lessons page composes two queries: one for the course blocks (the big containers) and one for the lessons inside them. The naive "we are loaded" check we had written was lessons.length >= 0 && !lessons.isFetching — which is true the moment the lessons query returns its initial empty array, before the course-blocks query has resolved. The page saw isFetching flip to false, concluded it was no longer in state one, and fell through to state two: an empty screen with a thin progress line, which is the right rendering for "we are refetching content that is already on screen" and the wrong rendering for "we haven't got the parent container yet".

The one-line fix was to key the state-one check off whether the parent block was ready, not whether the leaf list had resolved. The code change was two characters in a conditional; the lesson was that empty and loaded are different states that happen to render identically at the data layer, and a loading-state machine has to know which one it is in before it can pick the right UI. We have hit the same shape in other parts of the codebase since — the default React Query behaviour of returning data: undefined on first fetch and data: [] on empty success is the right primitive, but it is easy to collapse both into a single truthy check and lose the distinction.

This is the sort of tiny category error that is hard to catch in tests because the rendered output of "still loading" and "loaded but empty" are often indistinguishable until the next tick, and the time window where they diverge is exactly the window the user notices. It is also the sort of thing that is much easier to spot once the loading-state machine is an explicit object with named states rather than an ad-hoc isLoading || !data ternary deep in JSX. We now treat loading | refetching | empty | ready as a four-value union in the parts of the code that render differently per state, and the compiler catches when a branch forgets one.

The Rule We Walked Out With

Three loading states, not one. Shape-matched skeletons on the empty first render, a thin delayed line on refetch of visible content, and nothing at all when the load beats human reaction time. A useDelayed hook on every loading indicator so the fastest 80% of loads never show an indicator at all. A reduce-motion fallback for every animation. A screen-reader label for every progress affordance. And — this is the part that is easy to miss — an explicit named state in the component for "the parent container is still resolving", separate from both "we are loading from scratch" and "we are refetching data we already have".

A full-page spinner is cheap to add and expensive to live with. The payoff for breaking it into three states is that the app stops feeling like it is reloading itself on every tap, and starts feeling like a surface that stays put while fresh data lands on it — which is, ultimately, what a mobile list view is for. The same instinct underlies the stale-data tradeoff we wrote about in the Next.js revalidateTag stale-data cache piece: the correct default is to keep showing what the user has until there is a reason to change it, not to blank the screen every time a query runs.

If you are building a mobile app on React Native or Expo and the first-time users keep telling you it feels slow even though your P95 is fine, the answer is often not to make the queries faster — it is to stop showing them that queries happened. Book a free 30-minute call and we will walk through the loading surface of your app with you.

Sources: React Native — Animated · React Native — AccessibilityInfo · MDN — prefers-reduced-motion · Expo documentation

zsopilot · Training control for civil protection — built for the field.

Mobile‑first platform with NFC check‑in, live dashboards and role‑based control. Built for use in the field.

NEXT STEPWas this useful?