This page continues The Contract language with the part of Contract that draws screens: the elements inside a view, the attributes that make a column a screen or a sheet, and the built-in calls an action can make. Every example is from the app.
View elements and attributes
Kind | Real example | Source |
|---|---|---|
Loops and branches |
| |
Calling a component |
| |
Navigation root |
| |
A screen |
| |
A sheet |
| |
Native list with pull to refresh |
| |
Markdown text |
| |
Links |
| |
Fields |
| discuss.contract L182, me.contract L369, agents.contract L776 |
Confirmation |
| |
Tab bar |
| |
Symbols |
|
Built-in calls
Call | Use in the app | Source |
|---|---|---|
| all navigation, see Navigation and routes | |
| share a document, share an exported key | |
| after a posted comment, on switching identity | |
| focus the reply composer | |
| open the vault connect page in the browser | |
| copy the recovery phrase | |
| open a confirmation dialog | |
| keep the chat at its newest row | |
| milliseconds since launch, added to | |
| relative and absolute dates | |
| route queries, link building, list helpers |
Rules worth remembering
Every for needs a key. The root keys tabs by name and stack entries by e.id.
A screen is a route, not an if over state. The root view loops over nav.tabs and each tab's stack and renders one screen component per entry, see Navigation and routes.
Covered screens stay mounted, so each screen is told whether it is active and only then carries the plain testIds tests use (read.contract L4-L7), see Contract UI tests.
Leave platform controls unpainted. Colours are platform roles or Tamber tokens, see Shared components and visual design.
Built-in calls are effects, so they are allowed only inside actions.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime