---
title: "Porting a React Native app"
description: "What a port writes from habit, what the compiler says, and what to write (the euxy port, 2026-10-17: 19 of 50 compiles refused, most of them these)."
modificationDate: "2026-12-01"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Porting a React Native app

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/reference/pitfalls/porting-a-react-native-app: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

What a port writes from habit, what the compiler says, and what to write (the euxy port,
2026-10-17: 19 of 50 compiles refused, most of them these). A warning builds; fix it anyway.

| React Native writes | Exact says | Write |
|---|---|---|
| `line-height=20` | `lower-line-height-multiplier` (warning) | `line-height="20px"`: a bare number is a multiplier, as in CSS |
| `color="rgba(0,0,0,0.5)"`, `"#00000080"` | `lower-colour-one-scheme` (warning) | a role (`-exact-secondary-label`, `-exact-fill`), `light-dark(<light>, <dark>)`, or nothing |
| `` text `${n} cards` `` | `lower-count-plural` (warning) | `` `${n} ${n == 1 ? "card" : "cards"}` `` |
| `0% rotate=-2deg` in `keyframes` | `syntax-unquoted-length` | `0% rotate="-2deg"`, each keyframe on one line |
| `tags.find(t => …)` | `syntax-method-call` | `first(tags.filter(t => …))`; in each row of a list, `lower-row-lookup` (warning): join it in the data module |
| a helper action reading state its caller just set | `analyze-read-after-assign` (warning) | `let next = …` in the caller, `n = next`, pass `next` |
| `width=120` on a box of text | `lower-text-px-width` (warning) | let the content size it, or, where the width should grow with the text, `` width=`${120 / 17}rem` ``: 120 pt at iOS's default text size, where `7.5rem` is 127.5 pt |
| `numberOfLines`, `ellipsizeMode`, `resizeMode`, `textTransform`, `fontVariant` | `lower-unknown-attr` | `line-clamp`, `text-overflow`, `object-fit`, `text-transform`, `font-variant-numeric` |
| `backgroundColor`, `flexDirection`, `onPress`, `activeOpacity` | `lower-unknown-attr` | `background-color`, `flex-direction`, `press`, `-exact-press-opacity` |
| `paddingHorizontal=16` | `lower-unknown-attr` | `padding-left=16 padding-right=16`, or `padding="0px 16px"` |
| `marginVertical=8` | `lower-unknown-attr` | `margin-top=8 margin-bottom=8`, or `margin="8px 0px"` |
| `useWindowDimensions().width` used as a pane's width | nothing: the window and pane can differ | `exactViewport().width` is the window's; use `resize=<action>` on the pane for its content-box width. A sidebar, sheet or split view can make it narrower ([viewport units](https://exact.expo.dev/learn/contract-for-agents/css-layout-and-painting.md#viewport-and-container-units)) |
| `shadowColor`, `shadowOpacity`, `shadowRadius`, `shadowOffset`, `elevation` | `lower-unknown-attr`, `lower-attr-tag` | one `box-shadow="<x>px <y>px <2 × radius>px <colour>"` (below); nothing when the same style has `overflow: "hidden"`, which iOS draws without its shadow |
| `` line-height=`${28 / 17}` ``, `` width=`${n}` `` for numeric `n` | `lower-attr-value` | `line-height=(28 / 17)` for a multiplier, `width=n` for pixels or `` width=`${n}px` `` |
| `font-weight="bold"`, `"600"` | `lower-attr-value` | `font-weight=700`, `font-weight=600` |
| `fontSize: 16` | nothing; `verify` lists it as a fixed size | `` font-size=`${16 / 17}rem` ``, or a text style (`font="-exact-body"`) where the platform's body is meant: React Native's `fontSize` follows Dynamic Type by default (`allowFontScaling`), and a bare number here is points that do not (LLP 1115.000 D12). `1rem` is the root font size: 17 pt at iOS's default text size, 13 pt on the Mac (`NSFont.systemFontSize`, which the Mac's text size does not change) and normally 16 px on the web; an authored root font size changes it on every host, and the user's text size on iOS and the web. `font-size=16` is a fixed 16 pt |
| `Text` with no `fontSize` of its own or inherited | nothing | `font-size=14` for a fixed size, or `` font-size=`${14 / 17}rem` `` to scale from it: React Native's default is 14 pt, and unstyled text here is the platform's body, 17 pt at iOS's default text size |
| `withTiming(x)`, `withSpring(x)` with no configuration | nothing: neither function has a counterpart | a `transition` on the property that changes ([motion](https://exact.expo.dev/recipes/motion.md)). Read the defaults in the installed Reanimated: in 4.7.1 timing is 300 ms with `Easing.inOut(Easing.quad)`, and the spring has stiffness 900, damping 120, mass 4. `transition="translate 300ms ease-in-out"` keeps the duration with a different curve; `transition="translate -exact-spring(900, 120, 4)"` takes the spring's numbers. Whether either ends when Reanimated's does, or follows Reduce Motion as it does, is not established |
| `Gesture.Pan().activeOffsetX(…).failOffsetY(…).minPointers(2)` | nothing: no attribute sets a threshold or a pointer count | `pan` with `touch-action` is the drag the platform recognizes, without these thresholds, and its iOS recognizer takes one touch. Where the gesture needs two fingers or thresholds of its own, add a recognizer through an [access hatch](https://exact.expo.dev/reference/developer/access-hatches.md) |
| `ScreenOrientation.lockAsync(OrientationLock.LANDSCAPE_LEFT)` | nothing: both landscape words compile | on iPhone `orientationlock="landscape-secondary"` is UIKit's landscape left, and `LANDSCAPE_RIGHT` is `"landscape-primary"`. The lock holds while its element is displayed, with no unlock call: when the element goes, another displayed lock or the platform decides ([the reference](https://exact.expo.dev/reference/developer/generate-typescript-data-source-types.md#lock-the-screen-orientation) has the manifest's limit and iPad's) |
| `transform="rotate(-2deg)"` | `lower-attr-tag` | `rotate="-2deg"`, `translate="0px 25px"`, `scale=0.8` |
| Expo's `NativeTabs.Trigger role="search"`, SwiftUI's `Tab(role: .search)` | `lower-attr-value` on `role="search"` | `rel="search"` on the root tab, written last; `autofocus` on its root's header search field sets it apart on iOS 26 (`contract vocab search`) |
| a `ScrollView` in a `flex: 1` `View`: `column flex=1` › `scroll flex=1` | `lower-scroll-grows` (warning) | `min-height=0` on the column; the scroller alone needs none |
| `borderWidth` and `borderColor` without a style (solid in RN) | `lower-border-unstyled` (warning) | `border="1px solid" border-color="…"`, or add `border-style="solid"` to the written width; for one edge use `border-top-style="solid"` so the other sides stay absent |
| `alignItems`, `justifyContent`, `gap` on a `View` (a flex column in RN) | `lower-flex-on-block` (warning) | `column` or `row`: a `view` is `display: block`, as a `<div>` is |
| `flexDirection="row"` on a `Pressable` with content | `lower-flex-on-block` (warning) | `button display="flex"`, and `text-align="left"` where its text is not centred: a `button` is a block with centred text, as `<button>` is |
| `<SFSymbol name="x" size={N}>`, expo-symbols `SymbolView` | nothing; hand-drawn as an `svg`, or as `font-size=N`, the glyph comes out smaller | `image "symbol:sf/x" width=N height=N object-fit="contain"`, its tint as `color` ("Values beside an SF Symbol", below) |

Dividing by 17 keeps an iOS measurement at the default text size and follows the root
font from there. It does not reproduce React Native's `allowFontScaling` curve, and a
fixed length that holds no text needs no conversion.

What the original's style objects say is not always what its iOS screen shows. Port
what the screenshot shows. (euxy port against its Expo original, judged screen by
screen, 2026-10-16.)

- **Skia and Reanimated drawings port to Contract, not Swift.** Step strips, LED glows, rings
  and animated capsules are boxes, SVG, `box-shadow`, keyframes and transitions, which run on
  every platform and the agent can drive and compare. A native view is per-platform code to
  write and debug, and one added at launch slows it: keep it for platform APIs (video, maps).

- **A costly answer one screen shows is asked for at launch and on every edit.** euxy's
  share card, `resource share = shareInfo(pattern)`, encoded a QR code in the data module
  when the app launched and again each time a step changed, though only the share screen
  reads it. Cause: a root `resource` is asked for at launch and again whenever an argument
  changes, as a React component's `useMemo` would recompute on render. Fix: give it state
  the screen sets when it opens, `state sharing: option<Pattern> = none` and
  `resource share = shareInfo(sharing) as shape ShareInfo`, with the source answering empty
  for `none` (`null` in app.ts); the screen shows its card only when not `pending(share)`,
  since the last pattern's answer stays until the new one lands.

- **Compare each screen with its reference, not by eye:** `"screenshot .exact/x.png compare
  ref/x.png"` names each differing region's node and source line, a box's size measured in
  both pictures, and a wrong colour ([iOS driving](https://exact.expo.dev/recipes/ios-driving.md)).

- **A scrolled sheet or screen ends 34 points higher than the original.** euxy's Edit
  Lane sheet, scrolled to its end, left 58 points under Delete lane where the original
  left 24. Cause: a React Native `ScrollView` does not inset its content on iOS
  (`contentInsetAdjustmentBehavior` is `never`), so its `paddingBottom: 24` was the whole
  gap and the last row sat over the home indicator. A route's last scroller in Exact is
  inset by UIKit as a hand-built one is (`automatic`: the home indicator's 34 points, and
  the tab bar's height on a tab; a dialog sheet's outer scroller is `always`), and the
  ported padding adds to that. That inset is the platform's, as a hand-built table view in
  a sheet has it (LLP 1116 D2). Its size depends on how the screen is presented and which
  scroller is last, so measure it in your port rather than copy a number: two euxy ports
  of the same sheet needed `margin-bottom=-10` and nothing. `layout` (no target) gives
  the scroller's line, `#465 [lane-form] ScrollView 0,214 402×660 … port 0,214 402×626`:
  the inset is its frame's bottom less its `port`'s, 874 − 840 = 34 here (the
  scrollport ends where UIKit's inset begins; the content still shows through the inset
  down to the frame's bottom, as a hand-built scroll view's does). The original's gap is
  its padding, which `screenshot … compare ref/x.png` measures as the last row's offset. Write `padding-bottom` = that
  gap less the inset; where that is negative, write `padding-bottom=0` and the rest as a
  negative `margin-bottom` on the scroller itself, which lowers its end into the inset:
  padding cannot go below zero, and a negative margin on the last child does not move
  it. Do not add `env(safe-area-inset-bottom)`.

- **Rows with a `minHeight`, or boxes with a `height` and padding, come out taller.**
  `padding="13px 16px" min-height=24` made
  every settings row 50 points where the original's were about 46, and the sections drifted
  down; `height=40 padding-top=4 padding-bottom=4` made euxy's note pads 48. Cause: React
  Native's boxes are all `border-box`, so its `minHeight: 24` counted
  the padding and did nothing; a Contract box is `content-box`, as CSS's is. Fix: drop a
  `minHeight` or `height` that the padding already passes, or write
  `box-sizing="border-box"` on that box. A web app under Tailwind ports the same way:
  its preflight sets `box-sizing: border-box` on every element, so a `width`,
  `max-width` or `min-height` written beside padding or a border was a border-box size
  there (a 388 px box with 34 px of padding and border is 422 px wide here).
- **Rows with text in them drift up the list.** Each Patterns row (a 16/20 name over a
  13/16 subtitle) was 67 points where the original's was 67⅔, so the eighth row ended 5⅓
  points high. Cause: on iOS, React Native (0.88's `TextMeasurementRounding.h`,
  facebook/react-native#53450) adds 0.001 pt to a `Text`'s measured height and width before
  rounding them up to the device pixel, so a `Text` whose measured height is already on the
  pixel grid (a whole `lineHeight`, at 1x, 2x or 3x) is one device pixel taller: one per
  `Text` box, not per line, so a wrapped `Text` gains one in all, and one without
  `lineHeight` or off the grid usually gains nothing. A UILabel, a hand-built UIKit port and
  Exact all give the line box its `lineHeight`. Fix, when a native port must match the
  original to the pixel: add the pixels as `-exact-hairline` of `padding-bottom`. In euxy
  at 3x the original's glyphs sat where Exact draws them without the extra pixels, so they
  go below the stack: under the name and subtitle, `padding-bottom="-exact-hairline"` on
  the subtitle and on the column that holds both; under a settings row's one text, on it.
  That put all eight Patterns rows on the original's separators to the pixel and the glyphs
  within a hundredth of a pixel (a hairline on each text kept the pitch but set the
  subtitle a device pixel low). Compare glyph positions against the reference before
  placing them elsewhere. `-exact-hairline` is a device pixel natively; on the web below
  1.5 dppx (a 1.25 display) it is 1 CSS px (`host/web/index.html`), so this is advice for
  the native targets.
- **A pressed style from `pointerdown`/`pointerup` state lags the finger.** React
  Native's `style={({ pressed }) => [styles.row, pressed && styles.dim]}` (or
  `TouchableOpacity`'s `activeOpacity`) ported as a `pressed` state the two handlers
  set waits on the runner at each touch, and replaces the platform's own press with
  nothing until it answers. Fix: `pressed && styles.dim` ports to
  `-exact-press-opacity=0.5` (its opacity), a pressed `backgroundColor` to
  `background-color` in `:active`, and a pressed text colour to `color` in that
  block. The host shows them while held (LLP 1061 D7). Drop the state and both handlers.
- **A floating button's shadow is heavier than the original's.** Cause: on iOS React
  Native drops the shadow of a view with `overflow: "hidden"` (its layer masks to its
  bounds), so the shadow its style declares was never drawn; CSS draws a `box-shadow`
  outside `overflow: hidden`. Fix: port only a shadow the original draws. One it does
  draw converts as `box-shadow="<x> <y> <2 × shadowRadius>px <color at shadowOpacity>"`:
  a CSS blur radius is twice the Gaussian's deviation, and Core Animation's
  `shadowRadius` is about the deviation. Mind a scale transform over the view (euxy's
  capsule was laid out at twice its size and scaled by ½), which scales its shadow too.
- **A capsule with a rim is a few points larger than the original's, and grows when the
  rim thickens.** euxy's was 184 × 68 points where the original's was 180 × 64, its keys
  2 points further in. Cause: the original drew the rim as `borderWidth` on a fixed-size
  shell and gave the keys' padding to a child row as wide as the shell, so the rim lay
  over the padding; its thicker armed rim was an overlay. A box with `padding=8` and
  `border="2px solid …"` puts its content 10 points in, as CSS does, and a border whose
  width changes with state moves the content. Fix: a rim that takes no room,
  `box-shadow="inset 0 0 0 2px <colour>"`, with the original's padding.
- **A glow on a tiny LED is barely there.** Cause: a blur spreads a small source thin, so
  `box-shadow="0 0 7px …"` on a 5-pt dot is at most an eighth of its colour beside the
  dot, in Chrome and on every host alike; the original's halo was a larger disc blurred
  under the dot. A radial gradient instead draws a halo that is too big. Fix: Skia's
  `<Circle r={R} opacity={a}><BlurMask blur={σ} /></Circle>` under a dot of radius `r` is
  `box-shadow="0 0 <2σ>px <R − r>px <colour at a>"` on the dot: the spread grows the dot
  to the halo's disc. euxy's `R=4.5, σ=4, a=0.55` under a 5-pt LED is
  `box-shadow="0 0 8px 2px eu.glow"`, which matched the original's halo to within a
  few levels.
- **A bar's shadow casts a band over the strip below it.** Cause: the original cast the
  shadow from a dock that ran to the screen's bottom edge, under the tab bar, so its
  downward spill fell off screen; a route's content ends above the tab bar, so the same
  `box-shadow` spills onto the strip there. Fix: keep the shadow and clip its spill with
  `clip-path` past the box's top only (`clip-path="path('M 0 -40 L 2000 -40 L 2000 77 L 0
  77 Z')"` on a 77-pt bar).
- **A sheet sits a few points low, or ends short of the screen with its bottom corners
  showing.** Cause: a computed `navigationDetent` (`(screen height − 100) × 0.45`)
  guesses UIKit's maximum; and the original's `sheetCornerRadius` set the sheet's corner
  radius, which also seats a large sheet flat on the bottom edge, where an iOS 26 sheet
  left to the platform floats inset with the display's corners. Fix:
  `sheetAllowedDetents: [0.45]` is `navigationDetent="45%"`, `[1.0]` is `"large"`; and
  `sheetCornerRadius: 40` is `border-radius=40` on the route.
- **A sheet's content measures 0.96 of its authored size.** Not a bug: on iOS 26 a sheet
  resting below `large` floats, and UIKit draws its whole content scaled (402 pt laid out,
  386 drawn), the original's too. `layout` and `compare` say so (`route 3 is a sheet the
  platform draws at 0.96 …`); leave it, and never `scale` to undo it.
- **Slider rows are shorter than the original's.** Cause: React Native's `height: 28` on
  an `@expo/ui` slider did not bound the SwiftUI slider it hosts, which took about 32
  points; `height=28` on a ported `input type="range"` is 28. Fix: write the height the
  original's screenshot shows (UIKit's own slider, left unsaid, is taller than either).
- **A bar pinned above the tab bar casts its shadow onto the tab bar's strip.** Cause: an
  Expo `NativeTabs` screen draws under the tab bar, and the original's dock sat at the
  screen's bottom edge with the bottom inset (which includes the bar) as its padding: its
  background ran under the bar and the downward half of its shadow fell off-screen. An
  Exact tab's content ends at the bar's top (LLP 1123 C11), so that half shows. Fix: clip
  the shadow below the box, whose height you know:
  `clip-path="path('M -100 -60 L 4000 -60 L 4000 77 L -100 77 Z')"` on a 77-point dock.
- **Values beside an SF Symbol sit a few points further out.** Cause: expo-symbols'
  `SymbolView` with `size: 16` is a 16 × 16 box with the glyph fitted inside, so a narrow
  `chevron.right` had room on each side; `image "symbol:sf/…" font-size=16` is the glyph's
  own width. Fix: `width=16 height=16 object-fit="contain"` on the image.
- **The space between two texts in a row is gone.** `text "F2 · 53"` then
  `text " · usually kick"` showed `53· usually`. Cause: each text is a flex item, and CSS
  removes white space at the start and end of a line; React Native's `Text` keeps it.
  Fix: a `margin-left` on the second text the width of a space, or `gap` on the row.
- **An alert's caret takes the tab bar's colour.** euxy's rename prompt drew a black caret
  where the original's is blue. Cause: `tintColor` on `NativeTabs` tints the tab bar and
  the tab controller's view (react-native-screens sets both), so what is inside the tabs
  takes it and an alert, presented outside them, keeps the app's blue; the port put that
  black in the theme's `AccentColor`, which is the app's tint as an `AccentColor` asset
  is, so alerts took it too. Fix: match the original's scope: `accent-color` on the
  `tablist` and on each tab screen's root, not on the document's root (a root's
  `accent-color` is the window's tint, which alerts take), and `color` on a header's
  buttons. (`hintTextColor` on `Stack.SearchBar` is Android's only; react-native-screens'
  iOS search bar ignores it.)
- **A glyph sits at the left of its round button.** euxy's clear and dice glyphs and its
  BPM − and + sat 10 points left of centre in buttons with `align-items="center"
  justify-content="center"`. Cause: every React Native `View` is a flex container; a
  `button` and a `view` are blocks, so those two do nothing there (a button centres its
  content vertically on its own, as browsers do).
  Fix: `display="flex"` on the button or view.
- **`display="flex" align-items="center"` centres up and down, not across.** A ported
  `alignItems: 'center'` on a `view` left its icon and label at the left edge, centred
  vertically, and a `justifyContent` meant to space them down the screen spread them
  across it. Cause: an unwritten `flex-direction` is CSS's `row`; React Native's is
  `column`, so its `alignItems` is the cross axis across the screen. Fix: write
  `flex-direction="column"` where the original relied on its default, or use `column`,
  whose direction already is; keep `row` (or the bare `display="flex"`) where the
  original wrote `flexDirection: 'row'`.
- **A control sits at the top of its row.** euxy's Metronome segments, in a 52-point row
  with `align-items="center"`. Cause: the original's `Segmented` carried `alignSelf:
  'flex-start'`, and it centred only because the original wrapped it in a plain `View`,
  which the port dropped as noise. Fix: keep the wrapper (`view`), or drop the
  `align-self`.

**Shape data in the source, not at the top of `app.ts`.** A React Native app often
maps its whole catalog when the bundle loads. In `app.ts` that top level runs after
first pixel, and every answer waits for it: Brooks' `catalog.products.map(product)`
over a 2 MB JSON catalog took 314 ms in Hermes on an iPhone 17 Pro Max, where Bun
takes 60 ms. 220 ms of that was a derived list built for every product at load (`completeTheLook`, about
250,000 regex matches), where the original computes it for one product when its page opens.
Shape what a source answers in that source, or once on its first call, and check the first
answer's cost too, so the work is not just moved there. The journal (`agent.mjs ios logs`
after launch) names a top level slower than 50 ms. Where the top level cannot be made cheap,
`"typescript": {"placement": "worker"}` in `app.json` evaluates it on its own thread, at a
price: answers arrive `Later`, outside the action's transaction (LLP 1027.002 D1).
