---
title: "Recipe: an edit sheet a row opens"
description: "A row that opens its item's sheet is a link: a tap, a deep link and Back all arrive at follow."
modificationDate: "2026-11-25"
---

> ## 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.

# Recipe: an edit sheet a row opens

<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/recipes/edit-sheet: <what was wrong or missing>"`

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

</AgentInstructions>

A row that opens its item's sheet is a `link`: a tap, a deep link and Back reach
`follow`, which runs none of the row's, so an action filling a draft (`openEdit`)
never runs and the sheet shows the last draft. Make the form a child whose states start
from the item when its route shows it; its `key` makes it anew for each item.
The child's root is the route (`navigationKey` is the entry's id, passed in), so its
`header` is the route's first child: iOS draws it as the sheet's bar.

```prompt Add an edit sheet
Let a person edit an item in the Exact app in this folder, in a sheet. Use https://github.com/expo/exact/blob/main/docs/recipes/edit-sheet.md as the source for each step. The Exact checkout has the same page at docs/recipes/edit-sheet.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which item and which fields to edit, propose them from the app's data and ask me before you write code.
3. In app.contract, add an edit route with the item's id (`"/edit/:id"`), under the route or tab that holds the list, drawn with `navigationPresentation="modal"`. Open it with a `link href=path("edit", id)`: from the row, or, if the row already opens another screen, from an Edit link on that screen.
4. Make the form a child component that takes the item, a save action and a cancel action as props, with a `state` per field that starts from the item. Draw it inside a `for` over the matching item with `key` set to the item's id. Do not fill a draft from an action: a link, a deep link and Back never run it.
5. Give the sheet Cancel (`id="back"`, the root's `navigationBack`) and Save, which is disabled while the form is not valid. Save writes the item and goes back. If the items live in app.ts, Save sends a mutation that updates the item there, and the list's resource refreshes.
6. Add a test in app.test.contract that opens the first item's sheet, expects its values, changes one, saves, and expects the new value; then opens a second item's sheet and expects that item's values, not the first's.
7. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 8) and report it; do not keep trying.
8. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
9. Tell me what can be edited and from where, what the tests and verify reported, and the launch command for each target platform.
```

```contract
routes nav
  lifts "/"
    edit "/edit/:id"

shape Lift
  id: string
  name: string
  reps: number

component App
  state lifts = [Lift(id="1", name="Squat", reps=10), Lift(id="2", name="Row", reps=8)]
  action follow(url: string)
    nav = go(nav, url)
  action back
    nav = back(nav)
  action save(id: string, reps: number)
    lifts = lifts.map(l => l.id == id ? Lift(l, reps=reps) : l)
    nav = back(nav)
  view
    main navigationKey=`${top(nav).id}` navigationBack="back" navigate=follow width="100%" height="100%"
      for e in stack(nav) key=e.id
        if e.name == "lifts"
          column navigationKey=`${e.id}` navigationSplit="none" position="absolute" inset=0
            list appearance="auto" listStyle="inset-grouped" flex=1 min-height=0
              section
                for l in lifts key=l.id
                  link href=path("edit", l.id) testId=`lift-${l.id}`
                    text `${l.name} × ${l.reps}`
        if e.name == "edit"
          for l in lifts.filter(x => x.id == e.params.id) key=l.id
            EditLift(route=e.id, lift=l, save=save, cancel=back)

component EditLift
  props
    route: number
    lift: Lift
    save: action
    cancel: action
  state reps = `${lift.reps}`
  derive n = match parseNumber(reps) { case some(v) => v, case none => 0 }
  action edit(v: string)
    reps = v
  view
    column navigationKey=`${route}` navigationPresentation="modal" position="absolute" inset=0
      header display="flex" align-items="center" justify-content="space-between" padding="8px 16px"
        button id="back" press=cancel aria-label="Cancel"
          image "symbol:close"
        text lift.name role="heading"
        button press=save(lift.id, n) disabled=(n < 1) buttonStyle="bordered-prominent" aria-label="Save" testId="save"
          image "symbol:checkmark"
      list appearance="auto" listStyle="inset-grouped" flex=1 min-height=0
        section
          row
            text "Reps"
            input value=reps input=edit inputmode="numeric" aria-label="Reps" text-align="end" flex=1 min-width=0 testId="reps"
```

```contract-test
test "each row's sheet opens with that row's values"
  tap "lift-1"
  clock settle
  expect text "reps" == "10"
  type "reps" "12"
  tap "save"
  clock settle
  expect state lifts.0 .reps == 12
  tap "lift-2"
  clock settle
  expect text "reps" == "8"
```

- Items `app.ts` keeps work the same way: the child is made once its item has loaded.
- Test a second row: a sheet showing the last draft passes a test whose row matches it.
