Munchable reads ingredients lists. When a barcode is one we have never seen, the app opens a camera and the user photographs the panel on the back of the packet, which is six point type, printed on a curve, under supermarket lighting, held by someone who is also holding a trolley.

I assumed that was a resolution problem. It is a focus problem. The phone in your pocket has plenty of pixels and no interest whatsoever in focusing on something eight centimetres from the lens unless you tell it to, and expo-camera gives you almost none of the controls you need to tell it.

Here is the comment that sits at the top of apps/mobile/app/capture.tsx today:

 * SHARPNESS has three levers. Continuous autofocus (see the `autofocus` prop * below, whose values read backwards). On iOS, WHICH camera: the bare wide * lens never hands over to the ultra wide's macro mode, so up close it simply * cannot focus, while the virtual multi-lens devices switch lenses with * distance the way the stock Camera app does; `pickLens` asks for one of * those. And tap to focus, which expo-camera does not ship: `focusAtAsync` * comes from the repo's patch to it (patches/expo-camera@57.0.5.patch) and * points focus and exposure at the touched spot for a few seconds before * handing back to continuous focus. There is no zoom control on purpose: * digital zoom gives the reader nothing a crop does not. 

Three levers. Each one took a different kind of wrong turn to find.

Lever one: the prop whose values read backwards

autofocus={Platform.OS === 'web' ? 'on' : 'off'} 

That line is the whole of lever one, and it looks exactly like a bug. It took a careful read of the native source to accept that it is not. The comment above it in our code says:

 * FOCUS MODE. DO NOT "FIX" THIS TO 'on'. expo-camera's FocusMode * reads backwards from its name, on both platforms: 'on' means * focus ONCE and then lock, 'off' means keep focusing as the * scene moves. Reading small print off a pack the user is still * steadying needs the continuous one, so native gets 'off'. Web * keeps 'on' because the browser implementation has nothing * continuous to ask for. 

The first sentence of that comment is addressed to me, six months from now.

The prop is named for a mode, and the mode it names is autofocus-once. 'off' is not "do not focus", it is "do not do the one-shot thing", and what the camera falls back to is the continuous tracking mode you actually wanted. If you write the line that reads correctly, your preview snaps into focus on whatever was in frame when the camera opened and then holds that forever while the user raises the packet into view.

This is the lever with the worst failure mode, because a locked focus still looks like a camera working. You only catch it by noticing that the preview never improves no matter how long you hold still.

Lever two: asking iOS for a camera that can see something close up

On iOS, expo-camera opens the plain wide lens. The minimum focus distance of that lens is roughly the width of your hand, and on its own it never hands over to the ultra wide, which on every iPhone since the 13 Pro is the lens that does macro. So a label held where people naturally hold a label is simply inside the near limit of the camera you were given, and no amount of tapping or waiting will fix it.

What Apple's own Camera app opens is not a lens at all, it is a virtual device: one logical camera that switches between physical lenses as the subject gets closer, macro included. You have to ask for it by name, and the names are strings:

/** * The back camera that focuses like the stock Camera app, from the names iOS * reports. * ... * Matched by substring, case insensitively, because the names are localised * strings and an exact match would silently stop working in another language. * A miss is harmless: the camera keeps its default lens. */ function pickLens(lenses: string[]): string | undefined { const lower = lenses.map((name) => [name, name.toLowerCase()] as const); const find = (needle: string) => lower.find(([, l]) => l.includes(needle))?.[0]; return find('triple') ?? find('dual wide') ?? find('dual'); } 

Three words, in preference order. "Back Triple Camera" first, then "Back Dual Wide Camera", then the plain dual, which has no macro but still hands between lenses sensibly. Anything else means a single-lens phone, where the default is already the only option.

I want to flag the substring match as a deliberate compromise rather than laziness. These names come back from the OS and they are localised, so an exact comparison against "Back Triple Camera" is a line of code that works on my phone and quietly stops working in German. A substring match on one word is weaker but it degrades into "keep the default lens", which is the behaviour we had anyway. The rule I now apply to any string that crosses out of the platform: match it loosely, and make a miss cost nothing.

Android gets a different call in the same place, because the same idea does not transfer:

// More sensor pixels under the crop is the point of shooting the // whole panel, so ask for the largest still. Android only: on iOS // `pictureSize` selects a session preset, and leaving it alone means // the full sensor `.photo` preset already 

And the parser for that is defensive on purpose, because the picture-size strings are platform-shaped:

const match = /^(\d+)\s*[x×]\s*(\d+)$/.exec(size.trim()); if (!match) continue; 

Some devices report named presets rather than dimensions, and one odd string in the list must not cost us the whole list. The multiplication sign in that character class is not decoration.

Lever three: tap to focus, which does not exist

The third lever is the one you cannot get from JavaScript, because expo-camera has no API for it. Both platforms have had focus-point-of-interest for a decade; the module simply does not expose it.

So the repo carries patches/expo-camera@57.0.5.patch: 221 lines of diff, 103 added lines of actual code, across ten files and two native languages, deleting nothing. On Android it is CameraX:

fun focusAt(x: Float, y: Float) { val cam = camera ?: return val point = previewView.meteringPointFactory.createPoint(x, y) val action = FocusMeteringAction.Builder(point, FocusMeteringAction.FLAG_AF or FocusMeteringAction.FLAG_AE) .setAutoCancelDuration(4, java.util.concurrent.TimeUnit.SECONDS) .build() cam.cameraControl.startFocusAndMetering(action) } 

On iOS it is two pieces, because the coordinate conversion and the device configuration live in different classes. The view converts:

func focusAt(x: Double, y: Double) { let devicePoint = previewLayer.captureDevicePointConverted(fromLayerPoint: CGPoint(x: x, y: y)) sessionManager.focus(at: devicePoint, resetAfter: 4) } 

and the session manager configures, then undoes itself four seconds later:

device.focusPointOfInterest = point device.focusMode = .autoFocus ... DispatchQueue.main.asyncAfter(deadline: .now() + resetAfter) { [weak self] in guard let self, let current = self.captureDeviceInput?.device, current == device else { return } self.setFocusMode() ... } 

Two details in there that I would not have thought of before writing it.

The first is the coordinate conversion, and it is the entire reason this cannot be done from JS. A finger lands at a point in the preview's coordinate space. The preview is aspect-fill, so it is showing you a crop of the sensor, and the part it cropped away is invisible to your touch handler. captureDevicePointConverted(fromLayerPoint:) on iOS and meteringPointFactory on Android both exist to map through exactly that crop. Do the arithmetic yourself in React Native and you will focus on a point near, but not at, the word the user was pointing at. Which looks like an unreliable feature rather than a wrong number.

The second is the reset. Both platforms use a timeout (setAutoCancelDuration on Android, a dispatched block on iOS) to return the camera to continuous focus after four seconds. Without it, tap to focus is a trap: you tap once, the camera locks there, the user moves the packet, and now nothing focuses ever again and they have no idea why. A focus control that does not expire is worse than no focus control, because it breaks lever one.

The React side of it is small, as it should be:

/** Tap to focus: point the lens where the finger landed, and show a ring there. */ function focusAt(x: number, y: number) { if (!isNative) return; setFocusRing({ x, y, at: Date.now() }); void camRef.current?.focusAtAsync?.(x, y).catch(() => {}); } 

Three things worth copying in five lines. The ring state is keyed by Date.now(), so tapping the same spot twice still draws a fresh ring rather than reusing a React element that never changed. The optional call (?.) means an unpatched module degrades to a no-op instead of a crash, which matters because a patch applies at install time and install time is where patches go missing. And the swallowed rejection is deliberate: this is a hint to hardware, and a hint that failed does not deserve an error.

What the browser gets

The same screen runs in our Expo web build, where two of the three levers are nothing:

// The torch and tap to focus are native-only. expo-camera's web // implementation is a getUserMedia preview with a canvas grab behind it, and // neither is wired to it, so the browser gets a plain shutter rather than // controls that do nothing. const isNative = Platform.OS !== 'web'; 

One boolean, used to not render two buttons. The choice there was between shipping a torch button that silently does nothing and shipping a camera with fewer controls, and a dead control is worse than an absent one every time: a user who taps a torch and gets no light concludes the app is broken, where a user with no torch button concludes their phone has no torch.

There is no zoom control, on any platform, and that is the one omission I am most confident about. The reader works from a crop of the full-resolution still. Digital zoom throws away sensor pixels before the crop is taken, so it makes the picture look closer on screen and gives the thing that matters strictly less to work with.

The shape of the lesson

Three levers, and not one of them was a React problem. One was a prop whose name describes a mode rather than a behaviour. One was a platform opening the wrong physical hardware by default. One was a capability both operating systems have had for years that the cross-platform wrapper never surfaced, so it cost a patch file in the repo and two native languages in the diff.

If you are building anything that reads text off a real object with a phone camera, assume the defaults are tuned for photographing a person two metres away, because they are. Check what focus mode you are actually in, check which lens you were handed, and expect the control you need most to be the one missing.

The native apps are not in the stores yet, so there is nothing to download while you read this. The web build is live, and you can get to it from munchable.app if you want to see the screen the camera sits on. What the app does with a label once it has read one is visible without signing in at all: munchable.app/answers is the same verdicts, one ingredient at a time, and /fodmap-food-list is one condition's worth of them on a single page.