Today I learned

Small, dated things I didn't already know.

A mock that deletes the tested behaviour is worse than no test

A dropdown froze on-device: the UI was dead but JS kept running. Three bugs were stacked on top of each other. The modal's dismiss was gated on a Reanimated withTiming completion callback that silently never fires if the animation gets interrupted. A stuck keyboard-dismiss overlay sat on top of that. And two modals raced to present and dismiss at once, something iOS refuses mid-dismissal.

None of it showed up in Jest, because the default Reanimated mock replaces withTiming with an identity function and drops the completion callback entirely:

// jest.setup.js, the default Reanimated mock
withTiming: (toValue) => toValue, // onComplete is never called

The exact code path under test never ran, in either direction. A passing test here isn't weak evidence, it's no evidence at all. If a mock removes the behaviour you're actually checking, the fix is to delete that test and write an integration one instead.

React state and native UI state don't sync on their own

Toggling dark mode in a Zustand store updated React components immediately, but the native tabs and a form-sheet modal stayed light. Both read the system appearance directly from iOS, not from any JS state, so a store update never reached them.

Two separate worlds, each needing its own explicit bridge:

function setAppearance(scheme: "light" | "dark") {
  Appearance.setColorScheme(scheme); // bridges native UIKit consumers
  themeStore.setScheme(scheme); // bridges React Navigation's own ThemeProvider
}

The lesson generalises past dark mode. Any state a native module reads on its own, independently of React, needs a bridge written for it. A store update alone only ever reaches the half of the screen that's actually listening.

"Looks like a bug" is often a device setting

Liquid Glass components were rendering dark instead of translucent, and the instinct was to dig through GitHub issues about opacity animation and Expo Go limitations. The actual cause took one look at the phone: it was in dark mode, and UIBlurEffect intentionally samples darker backgrounds there. Correct, expected behaviour, not a bug.

console.log(Appearance.getColorScheme()); // check this before opening a GitHub issue

Four things are worth checking before chasing a code bug, in this order: dark mode, reduced motion, text size, and low power mode. Each one changes rendering in a way that looks exactly like a real bug from inside the code, and costs nothing to rule out first.

Determinism can be an emotional feature

A view that places each friend as a star derives its position from hashing their id, never from Math.random():

const angle = hashToFloat(friendId, "angle") * Math.PI * 2;
const radius = hashToFloat(friendId, "radius") * MAX_RADIUS;

This is about familiarity more than performance. A user's sky keeps the same shape every time they open the app, and two screenshots taken a month apart are pixel-identical unless something real actually changed.

Random looks alive for about one session, then it starts reading as a screensaver, something that happens to the screen rather than something that belongs to the user. Stable layouts are the feature here, not an implementation detail.

A rejection can be a signal to cut a feature, not fix its copy

App Review rejected a contacts-permission screen reading "Allow & Choose a Friend," since Apple requires a neutral pre-permission button rather than one that pre-commits the user to allowing.

The easy fix is a copy change. The actual fix was deleting contacts access entirely: it only ever saved typing a name, and the permission screen cost more onboarding friction than that was worth.

When a feature survives only because of the permission prompt wrapped around it, that's worth asking directly: is the permission worth the feature, or is the feature just an excuse to ask for it.

An "impossible" disabled state will eventually get hit

A second App Review rejection came from a paywall with no visible purchase button. The root cause was an empty StoreKit product list, common on a first submission while products are still propagating, rendering as a disabled button with no explanation instead of a visible error with a retry.

if (products.length === 0) {
  return <ErrorState message="Can't load plans right now" onRetry={refetch} />;
}

Nobody had written that branch, because an empty product list felt impossible in testing. It happened on the first real run, with the first real reviewer. Every state assumed unreachable still needs a visible way out, because something out there will reach it.

A platform crop is a different edit, not a resize

A 1080×1920 TikTok carousel slide loses everything below y=1635 and above y=285 when it's naively cropped to Instagram's 4:5 feed ratio. On these carousels, that band is exactly the card title and the logo signature, the two things the slide exists to show.

TikTok source:   1080 × 1920
Instagram crop:  y ∈ [285, 1635] → 1080 × 1350 (4:5)

Treating a different aspect ratio as "the same image, cropped" quietly deletes content on every platform the image wasn't designed for. Each ratio needs its own remontage from the source layers, not a crop applied after the fact.

A shared aggregate only reflects the surfaces that read it

A recurring bug shape: a value computed once and cached, a collection's total value, a count, reads correctly on the one screen that happens to call the function that recomputes it, and shows a stale default everywhere else, because every other surface just reads the cached aggregate directly.

// looks fresh here, because this call writes the cache as a side effect
const total = recomputeTotal(cards);

// every other screen just reads the stale value
const total = cache.total;

The screen that triggers the write looks correct by accident, and because it's usually the main screen, it's also the majority of what gets tested, which is exactly why the bug hides. Anything that writes a shared value needs one obvious writer, not an incidental one.

Two Metro servers on one machine blame the wrong files

Several local Expo projects sit on adjacent ports, 8081 and up. Leave a stray second Metro running and the simulator can silently load the wrong project's bundle, producing crashes and red boxes that name your own files while actually describing a different app's code.

xcrun simctl launch <udid> <bundle> -RCT_jsLocation 127.0.0.1:<port>

Pinning the port explicitly at launch removes the ambiguity. The fix is never to debug the error as if it were real, it's to check which Metro is actually attached first.

gray-400 vs gray-500 is the whole contrast problem

text-gray-400 on white reads fine in a diff, looks appropriately quiet in a screenshot, and measures 2.54:1 contrast, below every accessibility threshold there is. One digit later, text-gray-500 measures 4.83:1 and passes cleanly.

gray-400 on #fff → 2.54:1  (fails)
gray-500 on #fff → 4.83:1  (passes)

Picking a token by its name gives no signal either way. "400 looks a touch lighter than 500" carries zero information about whether either one is actually legible. The only way to know is to run the real colour pair through a contrast checker, every time, not to eyeball it on a bright monitor.