@aurea-uds/native 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +457 -496
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,81 +1,52 @@
|
|
|
1
1
|
# @aurea-uds/native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The **React Native** target of Aurea UDS.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
`View`/`Text`/`Pressable`,
|
|
7
|
-
18/07/2026, registrada no `ROADMAP.md` Fase 7.
|
|
5
|
+
A **sibling** package of `@aurea-uds/react`, not a wrapper around it: its own components on top of
|
|
6
|
+
`View`/`Text`/`Pressable`, consuming `@aurea-uds/tokens`. Only the tokens are shared between the two.
|
|
8
7
|
|
|
9
|
-
> **
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
>
|
|
13
|
-
> Ver a seção **Buscar, número e mídia** abaixo, e o `NATIVE.md` §8.
|
|
8
|
+
> ⚠ **The `Combobox` differs from the web one on purpose**: it accepts REMOTE search with single selection,
|
|
9
|
+
> which does not exist on the web.
|
|
10
|
+
> ⚠ **`Combobox`, `SearchField`, `NumberField`, `Image` and `Gallery` have not run on a device yet** — only
|
|
11
|
+
> in tests.
|
|
14
12
|
>
|
|
15
|
-
> ⚠
|
|
16
|
-
>
|
|
17
|
-
>
|
|
13
|
+
> ⚠ **`Chart` is the only component in this package whose GEOMETRY is ours.** On the web it is 79 lines
|
|
14
|
+
> of skin over `recharts`; here there is no engine, so scale, axis and path are code in this
|
|
15
|
+
> repository. **No new dependency.** See the **Chart** section below.
|
|
18
16
|
>
|
|
19
|
-
> **
|
|
20
|
-
>
|
|
21
|
-
>
|
|
17
|
+
> ⚠ **The native `Table` is NOT a table**: each row becomes a card, and each cell carries the column
|
|
18
|
+
> name with it. **The API is different** — `columns` + `rows`, because there is no `<thead>` to write.
|
|
19
|
+
> See the **Data** section below, which has the full measurement.
|
|
22
20
|
>
|
|
23
|
-
> ⚠ **
|
|
24
|
-
>
|
|
25
|
-
>
|
|
21
|
+
> ⚠ **One accessibility finding applies to the whole package:** React Native
|
|
22
|
+
> **accepts** `role="dialog"` and `role="alertdialog"` — it compiles, passes `tsc`, goes through Fabric —
|
|
23
|
+
> and **maps them on neither platform.** See the **Confirm and notify** section below.
|
|
26
24
|
>
|
|
27
|
-
>
|
|
28
|
-
>
|
|
29
|
-
> Ver a seção **Dados** abaixo, que tem a medição inteira.
|
|
25
|
+
> **`DatePicker` and `PhotoInput`** need extra dependencies. They **are not exported from the main entry
|
|
26
|
+
> point**: they live in `@aurea-uds/native/system` — see the **Date and camera** section below.
|
|
30
27
|
>
|
|
31
|
-
> **
|
|
32
|
-
>
|
|
28
|
+
> ⚠ **Aurea does not provide routing:** `expo-router`/`react-navigation` is the app's choice; this package
|
|
29
|
+
> provides the skin. Pull-to-refresh is `onRefresh`/`refreshing` on the `Screen`.
|
|
33
30
|
>
|
|
34
|
-
>
|
|
35
|
-
>
|
|
36
|
-
> e **não os mapeia em nenhuma das duas plataformas.** Ver a seção **Confirmar e avisar** abaixo.
|
|
37
|
-
>
|
|
38
|
-
> **Lote 4 COMPLETO.** Os formulários entraram em 08/09/2026:
|
|
39
|
-
> `Field`, `Label`, `Input`, `Textarea`, `Select`, `Switch`, `Checkbox`, `Radio`,
|
|
40
|
-
> `SegmentedControl`, `Form`, `KeyboardAvoiding`. Os dois últimos — **`DatePicker` e
|
|
41
|
-
> `PhotoInput`** — exigiram dependência nova, pararam o lote e voltaram para o Victor
|
|
42
|
-
> (`BUILDING.md` §3); ele autorizou os dois. Eles **não saem pelo barril**: moram em
|
|
43
|
-
> `@aurea-uds/native/system` — ver a seção **Data e câmera** abaixo.
|
|
44
|
-
>
|
|
45
|
-
> **Lote 3 COMPLETO — a moldura.** A moldura entrou em 08/09/2026:
|
|
46
|
-
> `BottomNav`, `Topbar`, `NavList`, `Stepper` — e o **puxar-para-atualizar**, que virou
|
|
47
|
-
> `onRefresh`/`refreshing` no `Screen`. ⚠ **A Aurea não entrega roteamento:**
|
|
48
|
-
> `expo-router`/`react-navigation` é escolha do app; daqui sai a pele.
|
|
49
|
-
>
|
|
50
|
-
> **Lote 2 COMPLETO — o painel de leitura.** O painel de leitura entrou em 08/09/2026: `KPI`,
|
|
51
|
-
> `Progress`, `Status`, `Badge`, `Alert`, `Skeleton`, `Spinner`, `EmptyState`, `DataState` e
|
|
52
|
-
> `Avatar`. Com ele vieram duas coisas que valem saber antes de usar: a tabela de **frases**
|
|
53
|
-
> (`<AureaProvider strings>`) e o hook **`useReduceMotion`** — ver as seções abaixo.
|
|
54
|
-
>
|
|
55
|
-
> **Lote 1 COMPLETO — os dez.** O chão (Lote 0) foi provado num Android em 03/09/2026 —
|
|
56
|
-
> as quatro perguntas do `NATIVE.md` §7 passaram — e sobre ele entraram `Text`, `Screen`, `Stack`,
|
|
57
|
-
> `Cluster`, `Grid`, `Card`, `Icon`, `Button` e `IconButton`.
|
|
58
|
-
>
|
|
59
|
-
> O `Screen` chegou por último e sozinho: ele foi o único que precisou de dependência nova, então
|
|
60
|
-
> parou o lote e voltou para o Victor (`BUILDING.md` §3). Ele autorizou o peer —
|
|
61
|
-
> [ADR-0040](../../decisions/0040-o-screen-adota-o-safe-area-context-como-peer.md).
|
|
31
|
+
> Two things worth knowing before use: the **strings** table (`<AureaProvider strings>`) and the
|
|
32
|
+
> **`useReduceMotion`** hook — see the sections below.
|
|
62
33
|
|
|
63
|
-
##
|
|
34
|
+
## Installation
|
|
64
35
|
|
|
65
36
|
```sh
|
|
66
37
|
pnpm add @aurea-uds/native react-native-svg react-native-safe-area-context
|
|
67
38
|
```
|
|
68
39
|
|
|
69
|
-
|
|
70
|
-
`react-native-svg` (≥15,
|
|
71
|
-
|
|
40
|
+
Four **required peers**: `react` (≥19), `react-native` (≥0.76, for the New Architecture),
|
|
41
|
+
`react-native-svg` (≥15, for the icons) and `react-native-safe-area-context` (≥5, for `Screen`).
|
|
42
|
+
For text to render in the Aurea fonts (Inter, Sora for headings and IBM Plex Mono for code), add
|
|
72
43
|
`@aurea-uds/fonts`.
|
|
73
44
|
|
|
74
|
-
|
|
75
|
-
|
|
45
|
+
The last one is usually **already installed**: `react-navigation` and `expo-router` pull it in. Declaring
|
|
46
|
+
it as a peer adds no weight to the app — it only states what was going to be there anyway.
|
|
76
47
|
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
And **three OPTIONAL peers**, marked as such in `peerDependenciesMeta` — if you do not use date,
|
|
49
|
+
camera or file, you install nothing and see no warning. Install only the one for the component you use:
|
|
79
50
|
|
|
80
51
|
```sh
|
|
81
52
|
pnpm add @react-native-community/datetimepicker expo-image-picker
|
|
@@ -84,17 +55,16 @@ pnpm add expo-document-picker
|
|
|
84
55
|
|
|
85
56
|
| | | |
|
|
86
57
|
|---|---|---|
|
|
87
|
-
| `@react-native-community/datetimepicker` | ≥8 | MIT ·
|
|
88
|
-
| `expo-image-picker` | ≥16 | MIT ·
|
|
89
|
-
| `expo-document-picker` | ≥12 | MIT ·
|
|
58
|
+
| `@react-native-community/datetimepicker` | ≥8 | MIT · only for `DatePicker` |
|
|
59
|
+
| `expo-image-picker` | ≥16 | MIT · only for `PhotoInput` |
|
|
60
|
+
| `expo-document-picker` | ≥12 | MIT · only for `FileInput`, which comes from `@aurea-uds/native/system/file` |
|
|
90
61
|
|
|
91
|
-
##
|
|
62
|
+
## Theme × density
|
|
92
63
|
|
|
93
|
-
|
|
94
|
-
(`compact`/`comfortable`/`spacious`).
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`StyleSheet` puro e a camada de tema é nossa).
|
|
64
|
+
Two axes, as on the web: theme (`dark`/`light`) × density
|
|
65
|
+
(`compact`/`comfortable`/`spacious`). In React Native **there is no cascade**, so something has to
|
|
66
|
+
resolve both into one value — that is what the provider does, and why it exists (the engine is plain
|
|
67
|
+
`StyleSheet` and the theme layer is ours).
|
|
98
68
|
|
|
99
69
|
```tsx
|
|
100
70
|
import {AureaProvider, Button, Card, Cluster, Screen, Stack, Text} from "@aurea-uds/native";
|
|
@@ -116,10 +86,10 @@ function Cartao() {
|
|
|
116
86
|
<Card variant="raised">
|
|
117
87
|
<Stack>
|
|
118
88
|
<Text size="lg" weight={600}>Aurea</Text>
|
|
119
|
-
<Text tone="muted">
|
|
89
|
+
<Text tone="muted">The `Card` already brings the theme's radius, surface and shadow.</Text>
|
|
120
90
|
<Cluster>
|
|
121
|
-
<Button tone="brand" leadingIcon="plus">
|
|
122
|
-
<Button appearance="outline">
|
|
91
|
+
<Button tone="brand" leadingIcon="plus">New</Button>
|
|
92
|
+
<Button appearance="outline">Cancel</Button>
|
|
123
93
|
</Cluster>
|
|
124
94
|
</Stack>
|
|
125
95
|
</Card>
|
|
@@ -127,10 +97,10 @@ function Cartao() {
|
|
|
127
97
|
}
|
|
128
98
|
```
|
|
129
99
|
|
|
130
|
-
###
|
|
100
|
+
### Writing your own styles
|
|
131
101
|
|
|
132
|
-
Use `criarFolha`,
|
|
133
|
-
|
|
102
|
+
Use `criarFolha`, not `StyleSheet.create` directly — it memoizes per (theme, density) pair, so
|
|
103
|
+
twenty instances of the same component produce **one** stylesheet, not twenty:
|
|
134
104
|
|
|
135
105
|
```tsx
|
|
136
106
|
import {criarFolha, useAureaTokens} from "@aurea-uds/native";
|
|
@@ -145,82 +115,84 @@ function Meu() {
|
|
|
145
115
|
}
|
|
146
116
|
```
|
|
147
117
|
|
|
148
|
-
|
|
149
|
-
|
|
118
|
+
This is not fussiness: the Android smoke test measured **182 ms** for a theme switch with the app
|
|
119
|
+
recreating the stylesheet on every render on purpose, to measure the worst case.
|
|
150
120
|
|
|
151
|
-
###
|
|
121
|
+
### The shell of a screen
|
|
152
122
|
|
|
153
123
|
```tsx
|
|
154
124
|
<Screen scroll>
|
|
155
|
-
<Text size="xl" weight={600}>
|
|
125
|
+
<Text size="xl" weight={600}>Dashboard</Text>
|
|
156
126
|
<Card>…</Card>
|
|
157
127
|
</Screen>
|
|
158
128
|
```
|
|
159
129
|
|
|
160
|
-
|
|
161
|
-
|
|
130
|
+
It fills the screen, paints the theme background and keeps clear of the notch and the gesture bar. **All
|
|
131
|
+
four edges by default** — in landscape the notch is on the side, and a screen with only `top` breaks on
|
|
132
|
+
rotation.
|
|
162
133
|
|
|
163
|
-
`padded={false}`
|
|
164
|
-
|
|
165
|
-
|
|
134
|
+
`padded={false}` for an edge-to-edge list. `scroll` wraps it in a `ScrollView` and **changes where the
|
|
135
|
+
padding goes**: it moves to `contentContainerStyle`, because padding on the `ScrollView` itself
|
|
136
|
+
clips the scrollable area.
|
|
166
137
|
|
|
167
|
-
|
|
168
|
-
|
|
138
|
+
No `SafeAreaProvider` is needed above it: the library's `SafeAreaView` is a native view and reads the
|
|
139
|
+
inset on its own. The **hooks** are what require the provider — and if you use `react-navigation` you
|
|
140
|
+
already have it.
|
|
169
141
|
|
|
170
|
-
###
|
|
142
|
+
### Touch target
|
|
171
143
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
144
|
+
Three of the five control heights (26, 30, 36 dp) are smaller than `--target-min` (44). The `Button`
|
|
145
|
+
solves this **without changing the drawing**: the `Pressable` has `minHeight: 44` and the painted box keeps
|
|
146
|
+
the token's height.
|
|
175
147
|
|
|
176
|
-
|
|
177
|
-
|
|
148
|
+
It is not `hitSlop`, on purpose — `hitSlop` **is not read by TalkBack**, and would leave the target small
|
|
149
|
+
exactly for people who use a screen reader.
|
|
178
150
|
|
|
179
|
-
`useAureaTheme()`
|
|
180
|
-
hook
|
|
181
|
-
|
|
151
|
+
`useAureaTheme()` returns `{theme, density, setTheme, setDensity, toggleTheme}` — the same shape as the
|
|
152
|
+
hook of the same name in `@aurea-uds/react`. `useAureaTokens()` returns the resolved values, and **has
|
|
153
|
+
no web counterpart** because there the CSS resolves them where they are used.
|
|
182
154
|
|
|
183
|
-
|
|
184
|
-
|
|
155
|
+
Without an `<AureaProvider>` above, both hooks **throw**. This is deliberate: a silent default
|
|
156
|
+
would draw the whole app in the wrong theme without anything reporting it.
|
|
185
157
|
|
|
186
|
-
##
|
|
158
|
+
## Forms
|
|
187
159
|
|
|
188
160
|
```tsx
|
|
189
161
|
<Form>
|
|
190
|
-
<Field label="
|
|
162
|
+
<Field label="Mileage" hint="Numbers only" error={erros.km}>
|
|
191
163
|
<Input keyboardType="numeric" value={km} onChangeText={setKm} />
|
|
192
164
|
</Field>
|
|
193
|
-
<Field label="
|
|
194
|
-
<Select items={[{value: "g", label: "
|
|
165
|
+
<Field label="Fuel">
|
|
166
|
+
<Select items={[{value: "g", label: "Gasoline"}, {value: "e", label: "Ethanol"}]}
|
|
195
167
|
value={comb} onChange={setComb} />
|
|
196
168
|
</Field>
|
|
197
|
-
<Switch label="
|
|
169
|
+
<Switch label="Remember this vehicle" checked={lembrar} onChange={setLembrar} />
|
|
198
170
|
</Form>
|
|
199
171
|
```
|
|
200
172
|
|
|
201
|
-
⚠ **
|
|
202
|
-
web.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
173
|
+
⚠ **The `Field` is what gives the control its NAME**, and this is the most important difference from
|
|
174
|
+
the web. There, `<label for>` points to an `id`; **in React Native there is no `id` and no `htmlFor`** — the
|
|
175
|
+
name is a string on the control itself. The `Field` passes `label`, `hint` and the invalid state down
|
|
176
|
+
through context, which is why an `Input` on its own, outside a `Field`, **has no name** for people
|
|
177
|
+
who use a screen reader.
|
|
206
178
|
|
|
207
|
-
⚠ **`error`
|
|
208
|
-
|
|
179
|
+
⚠ **`error` is not just red text:** it marks the control as invalid and becomes the hint the
|
|
180
|
+
screen reader announces.
|
|
209
181
|
|
|
210
|
-
⚠ **`keyboardType="numeric"`**
|
|
182
|
+
⚠ **`keyboardType="numeric"`** is what makes typing `12,4` cost two taps instead of eight.
|
|
211
183
|
|
|
212
|
-
###
|
|
184
|
+
### What is different from the web, and why
|
|
213
185
|
|
|
214
186
|
| | |
|
|
215
187
|
|---|---|
|
|
216
|
-
| `Switch` | **
|
|
217
|
-
| `Select` |
|
|
218
|
-
| `Form` |
|
|
219
|
-
| `Field` |
|
|
220
|
-
| `Radio` |
|
|
221
|
-
| `:hover` |
|
|
188
|
+
| `Switch` | **is not React Native's** — that one brings each system's own switch. Measurements from the CSS |
|
|
189
|
+
| `Select` | there is no `<select>` in RN: it is a `Modal` + a sheet that slides up. The role is `button`, not `combobox` — `combobox` promises a field you type in |
|
|
190
|
+
| `Form` | is only the spacing. There is no `<form>`, no `submit` and no platform validation; each field's error goes on its `Field` |
|
|
191
|
+
| `Field` | no `orientation="horizontal"` — on a 360dp screen the `12rem` grid leaves the control with less than half the width |
|
|
192
|
+
| `Radio` | no `name` — grouping belongs to the app state, not to the DOM |
|
|
193
|
+
| `:hover` | there is no pointer. Focus remains, and it is the only cue to which field the keyboard is filling |
|
|
222
194
|
|
|
223
|
-
###
|
|
195
|
+
### Keyboard
|
|
224
196
|
|
|
225
197
|
```tsx
|
|
226
198
|
<KeyboardAvoiding offset={alturaDaTopbar}>
|
|
@@ -228,522 +200,515 @@ leitor anuncia.
|
|
|
228
200
|
</KeyboardAvoiding>
|
|
229
201
|
```
|
|
230
202
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
## Buscar, número e mídia
|
|
203
|
+
The `behavior` changes with the platform — `padding` on iOS, `height` on Android — and Aurea picks it
|
|
204
|
+
for you. A single one on both sides leaves half the devices with the save button under the keyboard.
|
|
235
205
|
|
|
236
|
-
|
|
206
|
+
## Search, numbers and media
|
|
237
207
|
|
|
238
|
-
### `Combobox` —
|
|
208
|
+
### `Combobox` — type to find an item
|
|
239
209
|
|
|
240
|
-
⚠ **
|
|
241
|
-
|
|
242
|
-
**
|
|
210
|
+
⚠ **Do not confuse it with `Select`.** The choice between the two is about LIST SIZE, and the line is
|
|
211
|
+
firm: `Select` mounts every item in a `ScrollView` — it is for units, states and types.
|
|
212
|
+
**A catalog of thousands of rows freezes there.** `Combobox` uses `FlatList` and accepts remote search.
|
|
243
213
|
|
|
244
214
|
```tsx
|
|
245
215
|
import {Combobox, Field} from "@aurea-uds/native";
|
|
246
216
|
|
|
247
|
-
// ①
|
|
217
|
+
// ① REMOTE catalog — Aurea does not filter, the app searches
|
|
248
218
|
<Field label="Item">
|
|
249
219
|
<Combobox
|
|
250
|
-
items={resultados} //
|
|
251
|
-
value={escolhido} //
|
|
220
|
+
items={resultados} // the list ALREADY FETCHED
|
|
221
|
+
value={escolhido} // the WHOLE item, not the id
|
|
252
222
|
onValueChange={setEscolhido}
|
|
253
|
-
onSearchChange={buscar} // ←
|
|
223
|
+
onSearchChange={buscar} // ← the presence of this prop TURNS OFF Aurea's filter
|
|
254
224
|
loading={buscando}
|
|
255
225
|
onEndReached={proximaPagina}
|
|
256
226
|
/>
|
|
257
227
|
</Field>
|
|
258
228
|
|
|
259
|
-
// ②
|
|
229
|
+
// ② LOCAL list — Aurea filters, ignoring accents and case
|
|
260
230
|
<Combobox items={unidades} value={unidade} onValueChange={setUnidade} />
|
|
261
231
|
```
|
|
262
232
|
|
|
263
|
-
**
|
|
264
|
-
|
|
233
|
+
**The rule in one line: `onSearchChange` present = Aurea does not filter.** It is the presence of a prop,
|
|
234
|
+
not a setting — and it exists because filtering again what the server returned hides results.
|
|
265
235
|
|
|
266
236
|
| | |
|
|
267
237
|
|---|---|
|
|
268
|
-
|
|
|
269
|
-
|
|
|
270
|
-
| `value` |
|
|
271
|
-
|
|
|
238
|
+
| wait before calling `onSearchChange` | **250 ms**. `searchDelay={0}` turns it off |
|
|
239
|
+
| where you type | **inside the sheet**, not in the trigger — the keyboard takes half the screen |
|
|
240
|
+
| `value` | the **whole item**: in a remote search the list disappears under the selection |
|
|
241
|
+
| icons to register | `caret-down`, `search`, `close` |
|
|
272
242
|
|
|
273
|
-
### `SearchField` —
|
|
243
|
+
### `SearchField` — filter what is already on screen
|
|
274
244
|
|
|
275
|
-
|
|
276
|
-
|
|
245
|
+
A different role: `Combobox` **picks** from a catalog and returns the choice; this one **filters** and
|
|
246
|
+
returns text.
|
|
277
247
|
|
|
278
248
|
```tsx
|
|
279
|
-
<SearchField placeholder="
|
|
249
|
+
<SearchField placeholder="Filter" onSearchChange={setFiltro} />
|
|
280
250
|
```
|
|
281
251
|
|
|
282
|
-
### `NumberField` —
|
|
252
|
+
### `NumberField` — currency, measurement and counter
|
|
283
253
|
|
|
284
254
|
```tsx
|
|
285
|
-
<Field label="
|
|
255
|
+
<Field label="Amount">
|
|
286
256
|
<NumberField value={valor} onValueChange={setValor}
|
|
287
257
|
format={{style: "currency", currency: "BRL"}} locale="pt-BR" />
|
|
288
258
|
</Field>
|
|
289
259
|
|
|
290
|
-
<Field label="
|
|
260
|
+
<Field label="Liters">
|
|
291
261
|
<NumberField value={litros} onValueChange={setLitros}
|
|
292
262
|
format={{maximumFractionDigits: 1}} locale="pt-BR" min={0} />
|
|
293
263
|
</Field>
|
|
294
264
|
|
|
295
|
-
<Field label="
|
|
265
|
+
<Field label="Quantity">
|
|
296
266
|
<NumberField value={qtd} onValueChange={setQtd} min={0} step={1} />
|
|
297
267
|
</Field>
|
|
298
268
|
```
|
|
299
269
|
|
|
300
|
-
⚠ **
|
|
270
|
+
⚠ **What comes out of `onValueChange` is always a `number`** — `1234.5`, never `"R$ 1.234,50"`.
|
|
301
271
|
|
|
302
|
-
⚠ **
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
outro design system publicou com reprovação WCAG registrada e que uma das bibliotecas de referência abandonou.
|
|
272
|
+
⚠ **It formats on BLUR, and only on blur.** While the field has focus, it shows exactly what was typed.
|
|
273
|
+
Live masking is a known defect: it has shipped elsewhere with a recorded WCAG failure, and libraries that
|
|
274
|
+
tried it abandoned it.
|
|
306
275
|
|
|
307
|
-
⚠ **`notation: "compact"`
|
|
308
|
-
`__DEV__`
|
|
276
|
+
⚠ **`notation: "compact"` is rejected** — it is broken in RN's JS engine on both systems. A warning is
|
|
277
|
+
logged in `__DEV__` and the option is ignored; the rest of the format survives.
|
|
309
278
|
|
|
310
|
-
|
|
279
|
+
The three helpers are public, because the app has the same problem outside the field:
|
|
311
280
|
|
|
312
281
|
```tsx
|
|
313
282
|
import {formatarNumero, lerNumero, separadoresDoLocale} from "@aurea-uds/native";
|
|
314
283
|
|
|
315
284
|
formatarNumero(1234.5, "pt-BR", {style: "currency", currency: "BRL"}); // "R$ 1.234,50"
|
|
316
285
|
lerNumero("R$ 1.234,50", "pt-BR"); // 1234.5
|
|
317
|
-
lerNumero("", "pt-BR"); // null ←
|
|
286
|
+
lerNumero("", "pt-BR"); // null ← not 0
|
|
318
287
|
```
|
|
319
288
|
|
|
320
|
-
|
|
289
|
+
For **text** (licence plate, ID document, phone number) the moment is the same and the format is yours:
|
|
321
290
|
|
|
322
291
|
```tsx
|
|
323
292
|
<Input value={placa} onChangeText={setPlaca} formatOnBlur={(v) => v.toUpperCase()} />
|
|
324
293
|
```
|
|
325
294
|
|
|
326
|
-
⚠ `formatOnBlur`
|
|
295
|
+
⚠ `formatOnBlur` requires a **controlled** field — the formatted value comes out through `onChangeText`.
|
|
327
296
|
|
|
328
|
-
### `Image`
|
|
297
|
+
### `Image` and `Gallery` — showing photos
|
|
329
298
|
|
|
330
|
-
⚠ **`Image`
|
|
331
|
-
|
|
332
|
-
|
|
299
|
+
⚠ **`Image` is NOT React Native's `Image` with another skin.** It does the two things the raw
|
|
300
|
+
primitive does not: it **reserves the box** before the bytes arrive (without that the layout jumps) and it
|
|
301
|
+
**falls back to a placeholder** when they do not arrive (without that a broken URL leaves a hole).
|
|
333
302
|
|
|
334
303
|
```tsx
|
|
335
|
-
<Image source={foto.uri} alt="
|
|
304
|
+
<Image source={foto.uri} alt="Front of the item" ratio="4/3" />
|
|
336
305
|
|
|
337
306
|
<Gallery items={fotos} zoom selected={atual} onSelect={setAtual} />
|
|
338
307
|
```
|
|
339
308
|
|
|
340
309
|
| | |
|
|
341
310
|
|---|---|
|
|
342
|
-
| `ratio` |
|
|
343
|
-
| `alt` | **
|
|
344
|
-
|
|
|
345
|
-
|
|
|
346
|
-
|
|
|
311
|
+
| `ratio` | accepts `4/3`, `"4/3"`, `"16:9"` or the number. The web uses a string; RN wants a number |
|
|
312
|
+
| `alt` | **required**. A truly decorative image is written `alt=""`, explicitly |
|
|
313
|
+
| zoom | it is the existing **`Dialog`**, not a new surface |
|
|
314
|
+
| caption | with a caption, the name goes to the TILE and the image leaves the accessibility tree |
|
|
315
|
+
| icon to register | `image` (the placeholder) |
|
|
347
316
|
|
|
348
|
-
|
|
317
|
+
If you already use `expo-image` for its disk cache, swap the element without losing the skin:
|
|
349
318
|
|
|
350
319
|
```tsx
|
|
351
320
|
<Image render={<ExpoImage contentFit="cover" transition={150} />} source={u} alt="…" />
|
|
352
321
|
```
|
|
353
322
|
|
|
354
|
-
⚠ `fit` **
|
|
355
|
-
`expo-image`
|
|
323
|
+
⚠ `fit` is **not** translated for the element you pass — `resizeMode` belongs to RN's `Image`, and
|
|
324
|
+
`expo-image` calls the same thing `contentFit`. If you pass the element, write its own prop.
|
|
356
325
|
|
|
357
|
-
##
|
|
326
|
+
## Date and camera
|
|
358
327
|
|
|
359
|
-
|
|
328
|
+
These two **are not exported from the main entry point** — they are the only part of the package with its
|
|
329
|
+
own import path:
|
|
360
330
|
|
|
361
331
|
```tsx
|
|
362
332
|
import {DatePicker, PhotoInput} from "@aurea-uds/native/system";
|
|
363
333
|
```
|
|
364
334
|
|
|
365
|
-
⚠ **
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
poda.
|
|
335
|
+
⚠ **And the deep path is the documented form, for the same reason as the icons:** a module
|
|
336
|
+
nobody imports **does not enter the Metro graph**. If they came from `@aurea-uds/native`, every
|
|
337
|
+
app that imported a `Button` would drag the date picker and the camera into the bundle — and would fail
|
|
338
|
+
to resolve if the optional peers were not installed. Lazy by construction, not by
|
|
339
|
+
tree-shaking.
|
|
371
340
|
|
|
372
341
|
```tsx
|
|
373
|
-
<Field label="
|
|
342
|
+
<Field label="Entry date">
|
|
374
343
|
<DatePicker value={data} onChange={setData} maximumDate={new Date()} />
|
|
375
344
|
</Field>
|
|
376
345
|
|
|
377
|
-
<Field label="
|
|
346
|
+
<Field label="Receipt">
|
|
378
347
|
<PhotoInput value={fotos} onChange={setFotos} max={3} />
|
|
379
348
|
</Field>
|
|
380
349
|
```
|
|
381
350
|
|
|
382
|
-
### `DatePicker` —
|
|
351
|
+
### `DatePicker` — our skin, their calendar
|
|
383
352
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
353
|
+
Aurea draws the **trigger** (same height, same border and same radius as `Input`); what opens is
|
|
354
|
+
the **system dialog**. Date is a control that Android and iOS do better and that people already
|
|
355
|
+
know how to use — reimplementing it would give a calendar in our colour with the wrong behaviour in nine
|
|
356
|
+
edge cases (time zone, non-Gregorian calendar, keyboard input, TalkBack).
|
|
388
357
|
|
|
389
|
-
⚠ **
|
|
358
|
+
⚠ **The two platforms have different APIs, and that is what the component hides:**
|
|
390
359
|
|
|
391
360
|
| | |
|
|
392
361
|
|---|---|
|
|
393
|
-
| Android | `DateTimePickerAndroid.open({…})` — **
|
|
394
|
-
| iOS | `<RNDateTimePicker>` — **
|
|
362
|
+
| Android | `DateTimePickerAndroid.open({…})` — **imperative**, the dialog belongs to the system |
|
|
363
|
+
| iOS | `<RNDateTimePicker>` — **declarative**, it becomes a node in the tree |
|
|
395
364
|
|
|
396
|
-
|
|
365
|
+
An app that did not know this would write the Android path and see **nothing happen** on the
|
|
397
366
|
iPhone.
|
|
398
367
|
|
|
399
|
-
⚠ **
|
|
400
|
-
`type === "set"`
|
|
401
|
-
|
|
368
|
+
⚠ **Cancelling does not write a date.** On Android the event comes back with `type: "dismissed"`, and only
|
|
369
|
+
`type === "set"` calls `onChange`. It is the easiest edge case to get wrong, and there is a test whose
|
|
370
|
+
only job is to fail on it.
|
|
402
371
|
|
|
403
|
-
### `PhotoInput` —
|
|
372
|
+
### `PhotoInput` — the flow decisions, stated
|
|
404
373
|
|
|
405
|
-
⚠ **
|
|
406
|
-
|
|
374
|
+
⚠ **The camera is not a component, it is a flow** — permission, intent, preview, and what to do when the
|
|
375
|
+
person denies. Each question got a default, and **each default has a way out**:
|
|
407
376
|
|
|
408
|
-
|
|
|
377
|
+
| the question | the default | how to change it |
|
|
409
378
|
|---|---|---|
|
|
410
|
-
|
|
|
411
|
-
|
|
|
412
|
-
|
|
|
413
|
-
|
|
|
414
|
-
|
|
|
415
|
-
|
|
|
416
|
-
|
|
|
379
|
+
| what to show **without** permission? | the trigger appears as usual; tapping it is what asks | — |
|
|
380
|
+
| what if the person **denies**? | it asks again next time, as long as the system allows | `onPermissionDenied` |
|
|
381
|
+
| what if they deny **for good** (`canAskAgain: false`)? | a warning `Alert` + a button to the settings | `offerSettings={false}` |
|
|
382
|
+
| camera or library? | **camera** | `source="library"` |
|
|
383
|
+
| how to remove? | an X with a background, **fully outside** the photo, at the top right corner | `removeIcon` |
|
|
384
|
+
| how many fit? | **one** | `max` |
|
|
385
|
+
| how to **view** the photo? | tapping the thumbnail opens the large photo, with the same zoom as `Gallery` | — |
|
|
417
386
|
|
|
418
|
-
**
|
|
419
|
-
|
|
420
|
-
|
|
387
|
+
**Since `0.15.0`**, the thumbnail is a 64 square, the size of the add-photo button. The screen reader
|
|
388
|
+
hears *"Photo 2 of 3"* and *"Opens the photo"*; the X, *"Remove photo 2"*. With the field disabled, the
|
|
389
|
+
photo still opens and the X does not remove.
|
|
421
390
|
|
|
422
|
-
⚠ **
|
|
423
|
-
|
|
391
|
+
⚠ **The trigger disappears when the limit is reached**, instead of staying enabled and doing nothing — a
|
|
392
|
+
button that exists and does not respond is the defect, not the protection.
|
|
424
393
|
|
|
425
|
-
⚠ **`source="library"`
|
|
426
|
-
|
|
394
|
+
⚠ **`source="library"` does NOT request the camera permission.** They are different permissions, and asking
|
|
395
|
+
for the wrong one is a scary dialog the app did not need to show.
|
|
427
396
|
|
|
428
|
-
|
|
429
|
-
**
|
|
397
|
+
The strings (`cameraDenied`, `openSettings`, `photoRemove`, `datePlaceholder`) come from the
|
|
398
|
+
**Strings** table — see the section below.
|
|
430
399
|
|
|
431
|
-
### `FileInput` —
|
|
400
|
+
### `FileInput` — choosing a file (since `0.15.0`)
|
|
432
401
|
|
|
433
|
-
|
|
402
|
+
It lives on a path **of its own**, not in `/system`:
|
|
434
403
|
|
|
435
404
|
```tsx
|
|
436
405
|
import {FileInput} from "@aurea-uds/native/system/file";
|
|
437
406
|
|
|
438
|
-
<Field label="
|
|
407
|
+
<Field label="Document">
|
|
439
408
|
<FileInput value={arquivos} onChange={setArquivos} accept="application/pdf"
|
|
440
409
|
maxSize={10 * 1024 * 1024} />
|
|
441
410
|
</Field>
|
|
442
411
|
```
|
|
443
412
|
|
|
444
|
-
⚠ **
|
|
445
|
-
|
|
446
|
-
|
|
413
|
+
⚠ **The separate path is what makes "optional" true.** If it lived in `/system`, every app
|
|
414
|
+
that uses `DatePicker` would have to install `expo-document-picker`, or the build would fail. Only those
|
|
415
|
+
who import `/system/file` need it.
|
|
447
416
|
|
|
448
|
-
|
|
|
417
|
+
| the question | the default | how to change it |
|
|
449
418
|
|---|---|---|
|
|
450
|
-
|
|
|
451
|
-
|
|
|
452
|
-
|
|
|
453
|
-
| **
|
|
454
|
-
|
|
|
455
|
-
| **
|
|
456
|
-
| **
|
|
419
|
+
| what comes back? | `{uri, name, size, mimeType}` — the local address, **not the content** | — |
|
|
420
|
+
| the person **cancelled**? | nothing changes | — |
|
|
421
|
+
| over the **size** limit? | rejected, with *"File larger than the limit: name"* in red below | `maxSize` |
|
|
422
|
+
| wrong **type**? | the picker filters; the component checks again and rejects | `accept` |
|
|
423
|
+
| the size **did not come**? | accepted: there is nothing to measure, and the server checks | — |
|
|
424
|
+
| **how many** fit? | one; at the limit the trigger disappears, as in `PhotoInput` | `max` |
|
|
425
|
+
| **long name**? | cut in the middle (`relat…2026.pdf`): the extension stays visible | — |
|
|
457
426
|
|
|
458
|
-
|
|
459
|
-
|
|
427
|
+
For the screen reader: the trigger is a button with the `Field` name and the text *"Choose file"*;
|
|
428
|
+
each file reads *"name, size"*; the X reads *"Remove name"*; the rejection is announced.
|
|
460
429
|
|
|
461
|
-
|
|
462
|
-
|
|
430
|
+
The strings `fileChoose`, `fileRemove`, `fileTooLarge` and `fileWrongType` come from the **Strings** table;
|
|
431
|
+
the last three are the same as on the web.
|
|
463
432
|
|
|
464
|
-
##
|
|
433
|
+
## Chart
|
|
465
434
|
|
|
466
435
|
```tsx
|
|
467
436
|
import {Chart} from "@aurea-uds/native";
|
|
468
437
|
|
|
469
438
|
<Chart
|
|
470
|
-
label="
|
|
471
|
-
labels={["jan", "
|
|
472
|
-
series={[{name: "
|
|
439
|
+
label="Cost per month"
|
|
440
|
+
labels={["jan", "feb", "mar", "apr"]}
|
|
441
|
+
series={[{name: "Cost", data: [210, 198, 240, 187]}]}
|
|
473
442
|
mark="area"
|
|
474
443
|
formatValue={(v) => `R$ ${v}`} />
|
|
475
444
|
```
|
|
476
445
|
|
|
477
|
-
### ⚠
|
|
446
|
+
### ⚠ It is the only one whose geometry is ours
|
|
478
447
|
|
|
479
|
-
|
|
480
|
-
draws, this component holds"*,
|
|
481
|
-
|
|
448
|
+
On the web, `Chart` **does not draw**: its documentation says *"Aurea does not wrap the chart types: the
|
|
449
|
+
engine draws, this component holds"*, and the file is 79 lines of skin over `recharts`. **Here there is no
|
|
450
|
+
engine.** Scale, ruler, path and axis are code in this repository.
|
|
482
451
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
relação em que a Aurea segura e o motor desenha com as props dela.
|
|
452
|
+
The React Native chart libraries available on the registry were evaluated and rejected. The main reason:
|
|
453
|
+
a library where data goes in and a finished chart comes out does not fit, even when it brings no new peer.
|
|
454
|
+
`recharts`, on the web, works with composed marks — adopting a data-in, chart-out library would invert the
|
|
455
|
+
relation in which Aurea holds and the engine draws with Aurea's props.
|
|
488
456
|
|
|
489
|
-
**
|
|
457
|
+
**No new dependency:** `react-native-svg` has been a peer since the icons.
|
|
490
458
|
|
|
491
|
-
###
|
|
459
|
+
### The scope, stated
|
|
492
460
|
|
|
493
|
-
|
|
|
461
|
+
| in | out |
|
|
494
462
|
|---|---|
|
|
495
|
-
| `line`, `area`, `bar` (
|
|
463
|
+
| `line`, `area`, `bar` (and mixing the three) | pie/donut · **two Y axes** (the number one chart mistake) · stacked · animation · zoom |
|
|
496
464
|
|
|
497
|
-
### ⚠
|
|
465
|
+
### ⚠ The legend does NOT turn off with two or more series
|
|
498
466
|
|
|
499
|
-
|
|
500
|
-
|
|
467
|
+
This is not advice — it is measurement. The `--chart-1..5` palette is **the same blue from light to dark**:
|
|
468
|
+
a magnitude ramp, not an identity set. Measured:
|
|
501
469
|
|
|
502
470
|
```
|
|
503
|
-
|
|
504
|
-
--chart-2 + --chart-4
|
|
471
|
+
all five, neighbouring pairs ΔE 5.9 (normal vision) · 5.2 (colour blindness) FAIL
|
|
472
|
+
--chart-2 + --chart-4 ΔE 13.7 · 10.6 passes for colour blindness
|
|
505
473
|
```
|
|
506
474
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
475
|
+
That is why the default colour order **skips a step** and starts with the measured pair. And that is why the
|
|
476
|
+
legend is required: on a phone the mark is thinner than on the web, and colour alone does not separate the
|
|
477
|
+
series of this ramp.
|
|
510
478
|
|
|
511
|
-
### ⚠
|
|
479
|
+
### ⚠ There is no tooltip — touch selects
|
|
512
480
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
`"jan,
|
|
481
|
+
The web documentation says the tooltip *"follows the pointer and is not focusable"*. **Both halves fail
|
|
482
|
+
on touch.** Instead: each label is a target, and its name carries the values —
|
|
483
|
+
`"jan, Cost: 210, Target: 200"`.
|
|
516
484
|
|
|
517
|
-
### ⚠
|
|
485
|
+
### ⚠ The list of values is the accessibility layer, and it is ON
|
|
518
486
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
487
|
+
The web delegates accessibility to the `recharts` keyboard support (*"arrow navigation between the points,
|
|
488
|
+
on by default"*). **There is no engine and there are no arrows.** What replaces it is `showValues`: when a
|
|
489
|
+
point is selected, the values come out as text. Turn it off only if you have already solved the same problem
|
|
490
|
+
another way.
|
|
523
491
|
|
|
524
|
-
###
|
|
492
|
+
### What else is different
|
|
525
493
|
|
|
526
494
|
| | |
|
|
527
495
|
|---|---|
|
|
528
|
-
| `role="group"` | **
|
|
529
|
-
|
|
|
530
|
-
|
|
|
531
|
-
|
|
|
496
|
+
| `role="group"` | **does not map** — it falls into `else -> null` on Android, like `dialog` and `table`. Here it is `accessible` + `accessibilityLabel`, which is what really groups |
|
|
497
|
+
| height | the web refuses a prop on purpose (*"the box is sized by the CSS"*). **Here there is no CSS**, so `height` exists — with the same default as there, 220 |
|
|
498
|
+
| gap in a series | `null` **SKIPS**: it does not become zero and does not join the neighbours across. Joining would invent data that does not exist |
|
|
499
|
+
| the base of the bar | zero is included in the ruler whenever the data is positive. **A bar that does not start at zero lies about proportion** |
|
|
532
500
|
|
|
533
|
-
⚠ **
|
|
534
|
-
|
|
535
|
-
**
|
|
501
|
+
⚠ **The Y-axis ruler divides the range into equal parts and does not look for round numbers** — an
|
|
502
|
+
axis from 0 to 97 comes out `0 · 24.25 · 48.5 · …`, not `0 · 25 · 50 · …`. This is a known
|
|
503
|
+
**improvement to make, not a defect**: what exists is correct, just not pretty.
|
|
536
504
|
|
|
537
|
-
##
|
|
505
|
+
## Data
|
|
538
506
|
|
|
539
507
|
```tsx
|
|
540
508
|
import {DataList, Table, Timeline} from "@aurea-uds/native";
|
|
541
509
|
```
|
|
542
510
|
|
|
543
|
-
### ⚠
|
|
511
|
+
### ⚠ `Table` is not a table here — and that is not a step back
|
|
544
512
|
|
|
545
|
-
|
|
513
|
+
Two measurements decide the design, and they point to the same place:
|
|
546
514
|
|
|
547
515
|
| | |
|
|
548
516
|
|---|---|
|
|
549
|
-
| **
|
|
550
|
-
| **
|
|
517
|
+
| **the role does not map** | `accessibilityRole` has no `table`; `role` has it, and it falls into `else -> null` on Android and has no trait on iOS — the same trap as `dialog` (see **Confirm and notify**). **A real grid would announce itself as a table on no platform** |
|
|
518
|
+
| **the grid does not fit** | `.table` has `min-width: 720px` in `aurea.css`. On a 360dp phone that is 2× horizontal scrolling — and the web documentation itself only accepts it because the region is keyboard-focusable. **On touch there is no keyboard**: what is left is dragging, which the web already considered the insufficient half |
|
|
551
519
|
|
|
552
520
|
```
|
|
553
|
-
|
|
554
|
-
|
|
521
|
+
keep the grid -> loses readability AND gains no semantics
|
|
522
|
+
become a list -> gains readability AND gains `accessibilityRole="list"`, which MAPS
|
|
555
523
|
```
|
|
556
524
|
|
|
557
|
-
**
|
|
525
|
+
**Only the list has both.**
|
|
558
526
|
|
|
559
|
-
⚠ **
|
|
560
|
-
tablet
|
|
561
|
-
|
|
562
|
-
|
|
527
|
+
⚠ **The GRID mode was not built**, on purpose: it would only make sense on a tablet, and no
|
|
528
|
+
tablet has been measured. On native, **demand comes before coverage** (the opposite of the rule for the
|
|
529
|
+
web) — a half-grid would be worse than no grid. It will come back as a prop when there is a measured
|
|
530
|
+
tablet screen.
|
|
563
531
|
|
|
564
532
|
### `Table`
|
|
565
533
|
|
|
566
534
|
```tsx
|
|
567
535
|
<Table
|
|
568
|
-
caption="
|
|
536
|
+
caption="Entries"
|
|
569
537
|
columns={[
|
|
570
|
-
{key: "data", header: "
|
|
571
|
-
{key: "km", header: "
|
|
572
|
-
{key: "custo", header: "
|
|
538
|
+
{key: "data", header: "Date", primary: true},
|
|
539
|
+
{key: "km", header: "Mileage"},
|
|
540
|
+
{key: "custo", header: "Cost", cell: (l) => moeda(l.custo)},
|
|
573
541
|
]}
|
|
574
542
|
rows={lancamentos}
|
|
575
543
|
keyExtractor={(l) => l.id}
|
|
576
544
|
onRowPress={abrir} />
|
|
577
545
|
```
|
|
578
546
|
|
|
579
|
-
⚠ **
|
|
580
|
-
`children`.
|
|
581
|
-
|
|
582
|
-
|
|
547
|
+
⚠ **The API is DIFFERENT from the web one, and it had to be.** There you write `<thead>`/`<tbody>` as
|
|
548
|
+
`children`. Here there are no table elements to write, so the component takes **data**.
|
|
549
|
+
It is not the same prop with another name — it is a different surface, stated here instead of discovered
|
|
550
|
+
through a type error.
|
|
583
551
|
|
|
584
|
-
⚠ **
|
|
585
|
-
|
|
586
|
-
|
|
552
|
+
⚠ **The header does not disappear: it moves.** Each `header` names its own cell inside the
|
|
553
|
+
card. That is what prevents the classic defect of a table turned into a list — four loose numbers, one
|
|
554
|
+
below the other, without saying what each one is.
|
|
587
555
|
|
|
588
|
-
⚠ **`primary`
|
|
589
|
-
|
|
556
|
+
⚠ **`primary` marks the column that identifies the row** (in a list of entries, the date). It
|
|
557
|
+
becomes the card title and **does not repeat its own name**.
|
|
590
558
|
|
|
591
|
-
⚠ **A
|
|
592
|
-
|
|
559
|
+
⚠ **A row only becomes a target with `onRowPress`.** A tappable row with no action would be announced as a
|
|
560
|
+
button and do nothing.
|
|
593
561
|
|
|
594
|
-
### `Timeline`
|
|
562
|
+
### `Timeline` and `DataList`
|
|
595
563
|
|
|
596
564
|
```tsx
|
|
597
|
-
<Timeline items={[{title: "
|
|
565
|
+
<Timeline items={[{title: "Created", description: "by the app", time: "08/09 14:20"}]} />
|
|
598
566
|
|
|
599
|
-
//
|
|
567
|
+
// Since 0.15.0: icon in a frame, colour by tone, value on the right and what happened between two items.
|
|
600
568
|
<Timeline items={[
|
|
601
|
-
{title: "
|
|
602
|
-
trailing: "R$ 216,00", between: "6
|
|
603
|
-
{title: "
|
|
569
|
+
{title: "Order shipped", description: "28/09", icon: "truck", tone: "success",
|
|
570
|
+
trailing: "R$ 216,00", between: "6 days later"},
|
|
571
|
+
{title: "Payment", description: "22/09", icon: "storefront", tone: "primary",
|
|
604
572
|
trailing: "R$ 460,00"},
|
|
605
573
|
]} />
|
|
606
574
|
|
|
607
|
-
<DataList items={[{term: "
|
|
575
|
+
<DataList items={[{term: "Mileage", value: "12,4 km/l"}]} />
|
|
608
576
|
```
|
|
609
577
|
|
|
610
|
-
⚠ **
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
578
|
+
⚠ **In `DataList`, each pair is ONE accessible node** named `"term: value"`. On the web, `<dl>`
|
|
579
|
+
guarantees the pair for free; here there is no `<dl>` and no definition-list role, so the link has to be
|
|
580
|
+
stated. Without it, someone swiping with a finger hears "Mileage", takes a step, hears "12,4 km/l" — and
|
|
581
|
+
on a panel of eight pairs loses which value belonged to which term.
|
|
614
582
|
|
|
615
|
-
⚠ **
|
|
616
|
-
|
|
617
|
-
|
|
583
|
+
⚠ **It stacks below 640dp, at the same breakpoint as the web.** A comment in the CSS records the defect
|
|
584
|
+
the rule avoids: at 320px the value column resolved to **0px** and pushed the text off the
|
|
585
|
+
page. `layout="inline"` / `"stacked"` forces one, regardless of width.
|
|
618
586
|
|
|
619
|
-
⚠ **
|
|
620
|
-
|
|
621
|
-
|
|
587
|
+
⚠ **One item with `icon` is enough for the whole column to take the frame's width** (40): items without
|
|
588
|
+
an icon keep the dot, centred in it, and the line goes through the centre of the frames. `between` does not
|
|
589
|
+
appear after the last item, because there is no next one.
|
|
622
590
|
|
|
623
|
-
⚠ **
|
|
624
|
-
`<ol>`,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
591
|
+
⚠ **In `Timeline`, count and position are NOT announced**, and that is a choice. On the web it is an
|
|
592
|
+
`<ol>`, and its documentation says the screen reader announces "1 of 40" for free; here that "for free" does
|
|
593
|
+
not exist and would have to be written item by item. Attaching it to every event of a history is noise at
|
|
594
|
+
every stop of the reader — and the chronological order is already in `time`, which is the real information.
|
|
595
|
+
**Whoever needs position actually needs the date.**
|
|
628
596
|
|
|
629
|
-
###
|
|
597
|
+
### Long list: `virtualized`
|
|
630
598
|
|
|
631
599
|
```tsx
|
|
632
|
-
<Screen> {/*
|
|
600
|
+
<Screen> {/* NO `scroll` */}
|
|
633
601
|
<Table … rows={mil} virtualized />
|
|
634
602
|
</Screen>
|
|
635
603
|
```
|
|
636
604
|
|
|
637
|
-
`virtualized`
|
|
638
|
-
pendência que a [ADR-0038](../../decisions/0038-um-componente-por-icone-sobre-react-native-svg.md)
|
|
639
|
-
deixou aberta em 31/08/2026 — *"o desempenho em lista longa volta a importar quando existir tela
|
|
640
|
-
de lista"*. **Esta é a tela de lista.**
|
|
605
|
+
`virtualized` replaces the `map` with a `FlatList`, which only mounts what is on screen.
|
|
641
606
|
|
|
642
|
-
⚠ **
|
|
643
|
-
|
|
644
|
-
|
|
607
|
+
⚠ **With `virtualized`, the component IS the scroller — do not put it inside `<Screen scroll>`.** Two
|
|
608
|
+
scrollers on the same axis is a known RN error: the outer one gives the inner one infinite height, the
|
|
609
|
+
virtualization turns off, and the console warns *"VirtualizedLists should never be nested inside plain
|
|
645
610
|
ScrollViews"*.
|
|
646
611
|
|
|
647
|
-
⚠ **
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
612
|
+
⚠ **And the `Timeline` rail is not drawn in virtualized mode** — honesty, not a defect.
|
|
613
|
+
It is a line from the top to the bottom of the WHOLE list, and in a `FlatList` the whole list does not exist:
|
|
614
|
+
only the window. Drawing it would give a rail that starts and ends in the wrong place as you scroll. The
|
|
615
|
+
dots remain.
|
|
651
616
|
|
|
652
|
-
##
|
|
617
|
+
## Confirm and notify
|
|
653
618
|
|
|
654
619
|
```tsx
|
|
655
620
|
import {BottomSheet, ConfirmDialog, Dialog, Drawer, ToastHost, useToast} from "@aurea-uds/native";
|
|
656
621
|
```
|
|
657
622
|
|
|
658
|
-
### ⚠
|
|
623
|
+
### ⚠ First, what does NOT work — and passes everything
|
|
659
624
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
625
|
+
React Native accepts `role="dialog"` and `role="alertdialog"`. They are in the type, they compile, and
|
|
626
|
+
they go through Fabric's C++. **And they do nothing on the device.** Measured on both platforms, in the
|
|
627
|
+
`react-native@0.87.1` source:
|
|
663
628
|
|
|
664
|
-
|
|
|
629
|
+
| platform | where it dies |
|
|
665
630
|
|---|---|
|
|
666
|
-
| Android | `ReactAccessibilityDelegate.kt:515`, `fromRole()`
|
|
667
|
-
| iOS |
|
|
631
|
+
| Android | `ReactAccessibilityDelegate.kt:515`, `fromRole()` falls into `else -> null` — with RN's own comment: *"No mapping from ARIA role to AccessibilityRole"* |
|
|
632
|
+
| iOS | the trait list (`accessibilityPropsConversions.h:24-104`) **has neither** `dialog` nor `alertdialog`; the `role` string only disambiguates `checkbox` and `radio` |
|
|
668
633
|
|
|
669
|
-
**
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
essas duas palavras.
|
|
634
|
+
**This is worse than the role not existing.** A component that used them would pass code review, pass
|
|
635
|
+
`tsc`, pass any test that asked "is the prop there?" — and be useless to people who use a screen reader.
|
|
636
|
+
There is a test in this repository whose only job is to reject those two words.
|
|
673
637
|
|
|
674
|
-
**
|
|
638
|
+
**What Aurea does instead:**
|
|
675
639
|
|
|
676
|
-
|
|
|
640
|
+
| the web | here |
|
|
677
641
|
|---|---|
|
|
678
|
-
| `role="dialog"` +
|
|
679
|
-
| `Escape`
|
|
680
|
-
| `aria-labelledby` |
|
|
681
|
-
| `aria-describedby` |
|
|
682
|
-
| `backdrop-filter: blur(5px)` | **
|
|
642
|
+
| `role="dialog"` + trapped focus | RN's **`Modal`**. It is a **system window**, and both TalkBack and VoiceOver already limit themselves to the top window — the confinement comes from the operating system, not from a `Tab` loop in JavaScript |
|
|
643
|
+
| `Escape` closes | **`onRequestClose`** — the Android BACK button. RN documents the prop as required; without it the box gets **stuck** |
|
|
644
|
+
| `aria-labelledby` | the title is a `Text` with `accessibilityRole="header"` — the only role in this family that Android maps |
|
|
645
|
+
| `aria-describedby` | does not exist. The sentence is read because it is **in order**, which is why it comes before the buttons in the tree |
|
|
646
|
+
| `backdrop-filter: blur(5px)` | **does not carry over.** There is no backdrop filter in RN, and what exists (`expo-blur`) is a new dependency. `--overlay` is already black at 74% and separates on its own |
|
|
683
647
|
|
|
684
|
-
### `Dialog`
|
|
648
|
+
### `Dialog` and `ConfirmDialog`
|
|
685
649
|
|
|
686
650
|
```tsx
|
|
687
|
-
<Dialog open={aberto} title="
|
|
688
|
-
footer={<><Button appearance="outline" onPress={fechar}>
|
|
689
|
-
<Button onPress={salvar}>
|
|
690
|
-
<Field label="
|
|
651
|
+
<Dialog open={aberto} title="Edit entry" onClose={fechar}
|
|
652
|
+
footer={<><Button appearance="outline" onPress={fechar}>Cancel</Button>
|
|
653
|
+
<Button onPress={salvar}>Save</Button></>}>
|
|
654
|
+
<Field label="Mileage"><Input value={km} onChangeText={setKm} /></Field>
|
|
691
655
|
</Dialog>
|
|
692
656
|
|
|
693
657
|
<ConfirmDialog open={perguntando} destructive
|
|
694
|
-
title="
|
|
695
|
-
description="
|
|
696
|
-
confirmLabel="
|
|
658
|
+
title="Delete this entry?"
|
|
659
|
+
description="It leaves the history and the cost per km. This cannot be undone."
|
|
660
|
+
confirmLabel="Delete" onConfirm={apagar} onCancel={desistir} />
|
|
697
661
|
```
|
|
698
662
|
|
|
699
|
-
⚠
|
|
700
|
-
|
|
701
|
-
|
|
663
|
+
⚠ **`ConfirmDialog` is NOT a `Dialog` with two buttons.** The difference is behaviour, and it
|
|
664
|
+
carried over whole from the web: **tapping outside does not close it.** A tap outside turning into "I
|
|
665
|
+
cancelled" is the accident the component exists to prevent.
|
|
702
666
|
|
|
703
|
-
⚠ **
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
667
|
+
⚠ **What did not carry over, and it is fair to say so:** on the web, focus starts on the safe button,
|
|
668
|
+
because someone who opens a "this deletes" and presses Enter by reflex has to cancel. **On touch there is no
|
|
669
|
+
such reflex** — there is no keyboard focus and no Enter. Moving the *screen reader* focus to Cancel would
|
|
670
|
+
translate the mechanism and lose the intent: it would skip exactly the sentence that says what is lost. So
|
|
671
|
+
focus is not moved, and what remains is what matters here: the backdrop does not close it, and the **order**
|
|
672
|
+
is cancel → confirm.
|
|
709
673
|
|
|
710
|
-
⚠ **`description`
|
|
674
|
+
⚠ **`description` is required**, and says what is lost and whether it comes back.
|
|
711
675
|
|
|
712
676
|
### `Drawer`
|
|
713
677
|
|
|
714
678
|
```tsx
|
|
715
|
-
<Drawer open={aberto} title="
|
|
679
|
+
<Drawer open={aberto} title="Filters" side="right" onClose={fechar}>…</Drawer>
|
|
716
680
|
```
|
|
717
681
|
|
|
718
|
-
⚠ **
|
|
719
|
-
|
|
682
|
+
⚠ **The side is PHYSICAL, not logical.** The reason comes from the web documentation and applies the
|
|
683
|
+
same: a panel tied to the writing direction would switch sides when the language changes, and a navigation
|
|
684
|
+
panel should not move.
|
|
720
685
|
|
|
721
|
-
⚠ **
|
|
722
|
-
**
|
|
686
|
+
⚠ **The animation is ours, and the `Modal` one is turned off** — RN's `animationType="slide"` comes up from
|
|
687
|
+
the **bottom**, always. Leaving it on would make the side panel enter through the floor.
|
|
723
688
|
|
|
724
|
-
### `BottomSheet` —
|
|
689
|
+
### `BottomSheet` — the only one without a web counterpart
|
|
725
690
|
|
|
726
691
|
```tsx
|
|
727
|
-
<BottomSheet open={aberto} title="
|
|
692
|
+
<BottomSheet open={aberto} title="New entry" onClose={fechar}>…</BottomSheet>
|
|
728
693
|
```
|
|
729
694
|
|
|
730
|
-
⚠ **
|
|
731
|
-
|
|
732
|
-
|
|
695
|
+
⚠ **It answers the same problem as the centred dialog, and answers differently because the hand is
|
|
696
|
+
different:** on a phone held in one hand, the top of the screen is the hardest place to reach.
|
|
697
|
+
The centred dialog puts the choices exactly there; the sheet puts them where the thumb is.
|
|
733
698
|
|
|
734
|
-
⚠ **
|
|
735
|
-
|
|
736
|
-
(`gesture-handler` + `reanimated`)
|
|
699
|
+
⚠ **Dragging is `PanResponder`, which is part of React Native itself — not a new dependency.** This was
|
|
700
|
+
a deliberate choice over a bottom-sheet library that would bring **two** new pieces
|
|
701
|
+
(`gesture-handler` + `reanimated`) for a one-axis gesture.
|
|
737
702
|
|
|
738
|
-
**
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
703
|
+
**What the choice buys and what it costs, stated instead of hidden:** it buys zero dependencies and a
|
|
704
|
+
component that runs in Expo Go. It costs the gesture running on the JS bridge, not on the UI thread — with a
|
|
705
|
+
long list inside the sheet, dragging may stutter. If that shows up on a device, the switch will be a
|
|
706
|
+
deliberate decision, not a patch.
|
|
742
707
|
|
|
743
|
-
⚠ **
|
|
744
|
-
|
|
708
|
+
⚠ **Releasing halfway SNAPS BACK**, it does not close: it only goes through if you dragged more than a third
|
|
709
|
+
of the height, or flicked quickly. Closing too early turns a shaky tap into lost data.
|
|
745
710
|
|
|
746
|
-
### `useToast` —
|
|
711
|
+
### `useToast` — and why the host is explicit
|
|
747
712
|
|
|
748
713
|
```tsx
|
|
749
714
|
<AureaProvider>
|
|
@@ -752,38 +717,38 @@ altura, ou deu um lance rápido. Fechar cedo demais transforma um toque trêmulo
|
|
|
752
717
|
</ToastHost>
|
|
753
718
|
</AureaProvider>
|
|
754
719
|
|
|
755
|
-
//
|
|
720
|
+
// anywhere inside:
|
|
756
721
|
const {add} = useToast();
|
|
757
|
-
add({title: "
|
|
722
|
+
add({title: "Entry saved", type: "success"});
|
|
758
723
|
```
|
|
759
724
|
|
|
760
|
-
⚠ **
|
|
761
|
-
|
|
725
|
+
⚠ **There is no portal in React Native.** On the web, `AureaProvider` hangs the stack at the end of `<body>`
|
|
726
|
+
and the app does not need to know. Here a component only draws where it is in the tree.
|
|
762
727
|
|
|
763
|
-
⚠ **
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
728
|
+
⚠ **The obvious way out would be for `AureaProvider` to draw the stack, and it is wrong.** Measured: today it
|
|
729
|
+
returns **only contexts**, no `View`. Putting a `View` there would change the layout of **every app that
|
|
730
|
+
already uses Aurea**, silently — a new container between the root and the first child is exactly what
|
|
731
|
+
breaks a `flex: 1` and shows up as *"why did my screen shrink?"* three days later.
|
|
767
732
|
|
|
768
|
-
|
|
769
|
-
|
|
733
|
+
So the host is its own component and in plain sight. If you do not call `useToast`, you do not add
|
|
734
|
+
`ToastHost`, you do not pay for the `View`, and nothing changes.
|
|
770
735
|
|
|
771
|
-
⚠ **`useToast()`
|
|
772
|
-
|
|
773
|
-
|
|
736
|
+
⚠ **`useToast()` without a host THROWS**, with a message that says what to do. Returning a silent `add()`
|
|
737
|
+
would be the most expensive defect possible: the "saved" notice that never appears breaks nothing, does not
|
|
738
|
+
throw, and vanishes in the middle of a flow that looked right.
|
|
774
739
|
|
|
775
|
-
⚠ **`duration: 0`
|
|
776
|
-
"
|
|
777
|
-
|
|
740
|
+
⚠ **`duration: 0` never closes on its own, and it is what a toast with `action` must use.** An
|
|
741
|
+
"Undo" button that slips away in five seconds is a button that does not exist for someone who reads slowly,
|
|
742
|
+
for someone who uses a screen reader, or for someone who just looked away.
|
|
778
743
|
|
|
779
|
-
⚠ **`offset`
|
|
780
|
-
|
|
781
|
-
|
|
744
|
+
⚠ **`offset` exists because of `BottomNav`:** without it the toast appears on top of the bar and covers
|
|
745
|
+
exactly what the person was about to tap. The gesture bar spacing is `Math.max`, **not a sum** — the
|
|
746
|
+
same calculation as `BottomNav`.
|
|
782
747
|
|
|
783
|
-
⚠ **
|
|
784
|
-
|
|
748
|
+
⚠ **Time is not motion:** with «remove animations» on, the toast does not slide, but the clock
|
|
749
|
+
keeps running. Someone who asked for less motion did not ask for the toast to stay forever.
|
|
785
750
|
|
|
786
|
-
##
|
|
751
|
+
## The frame
|
|
787
752
|
|
|
788
753
|
```tsx
|
|
789
754
|
<Screen padded={false} scroll onRefresh={buscar} refreshing={carregando}>
|
|
@@ -793,33 +758,33 @@ continua. Quem pediu menos movimento não pediu que o aviso ficasse para sempre.
|
|
|
793
758
|
<BottomNav
|
|
794
759
|
current={aba}
|
|
795
760
|
items={[
|
|
796
|
-
{id: "painel", label: "
|
|
797
|
-
{id: "avisos", label: "
|
|
761
|
+
{id: "painel", label: "Dashboard", icon: "squares-four", onPress: () => ir("painel")},
|
|
762
|
+
{id: "avisos", label: "Alerts", icon: "bell", badge: 8, onPress: () => ir("avisos")},
|
|
798
763
|
]} />
|
|
799
764
|
```
|
|
800
765
|
|
|
801
|
-
⚠ **
|
|
802
|
-
`onPress`.
|
|
766
|
+
⚠ **Aurea does not provide routing.** These components take `items` and `current` and report through
|
|
767
|
+
`onPress`. The app is what changes screens.
|
|
803
768
|
|
|
804
|
-
⚠
|
|
805
|
-
*
|
|
806
|
-
|
|
769
|
+
⚠ **`BottomNav` is not `Tabs`, and this is not a naming detail:** a tab switches a panel of
|
|
770
|
+
*this* screen; the bar switches screens. That is why the items are `link` and not `tab` — giving `tablist`
|
|
771
|
+
to a menu makes the screen reader promise arrow keys that lead nowhere.
|
|
807
772
|
|
|
808
|
-
⚠ **
|
|
809
|
-
|
|
773
|
+
⚠ **It respects the gesture bar on its own**, using the larger of the theme spacing and the system
|
|
774
|
+
inset.
|
|
810
775
|
|
|
811
|
-
⚠
|
|
812
|
-
|
|
776
|
+
⚠ **`Topbar` does not stick on its own** — `position: sticky` does not exist in RN. The bar stays put
|
|
777
|
+
because the screen places it **outside** the `ScrollView`, as in the example above.
|
|
813
778
|
|
|
814
|
-
###
|
|
779
|
+
### Pull to refresh
|
|
815
780
|
|
|
816
|
-
`onRefresh` + `refreshing`
|
|
817
|
-
|
|
781
|
+
`onRefresh` + `refreshing` on the `Screen`, and only with `scroll` — there is nothing to pull on a screen that
|
|
782
|
+
does not scroll. `refreshing` belongs to the app: the component does not guess when the fetch has finished.
|
|
818
783
|
|
|
819
|
-
##
|
|
784
|
+
## Strings
|
|
820
785
|
|
|
821
|
-
`Alert`, `Status`, `EmptyState`
|
|
822
|
-
|
|
786
|
+
`Alert`, `Status`, `EmptyState` and `DataState` speak on their own: the seven universal states, the empty
|
|
787
|
+
state, the error, the `Spinner` label. The default is **English**, as on the web.
|
|
823
788
|
|
|
824
789
|
```tsx
|
|
825
790
|
import {AureaProvider, ptBR} from "@aurea-uds/native";
|
|
@@ -827,68 +792,66 @@ import {AureaProvider, ptBR} from "@aurea-uds/native";
|
|
|
827
792
|
<AureaProvider strings={ptBR}>…</AureaProvider>
|
|
828
793
|
```
|
|
829
794
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
795
|
+
The table has **far fewer keys** than the one in `@aurea-uds/react` — it is the size of what the
|
|
796
|
+
native target draws, and each new key is born with a component that uses it. `useAureaStrings()`
|
|
797
|
+
reads whatever is in effect.
|
|
833
798
|
|
|
834
|
-
##
|
|
799
|
+
## Motion
|
|
835
800
|
|
|
836
801
|
```tsx
|
|
837
|
-
const reduzir = useReduceMotion(); // true · false · null (
|
|
802
|
+
const reduzir = useReduceMotion(); // true · false · null (not known yet)
|
|
838
803
|
```
|
|
839
804
|
|
|
840
|
-
⚠ **
|
|
841
|
-
`prefers-reduced-motion`
|
|
842
|
-
|
|
843
|
-
|
|
805
|
+
⚠ **On the web this comes for free, and here it does not.** `aurea.css` has a global
|
|
806
|
+
`prefers-reduced-motion` rule that zeroes every animation; **React Native has no cascade**, so whoever
|
|
807
|
+
animates has to ask. `Spinner` and `Skeleton` already ask — this hook is for your code to do the
|
|
808
|
+
same.
|
|
844
809
|
|
|
845
|
-
|
|
846
|
-
|
|
810
|
+
`null` is the honest answer while the system has not answered: the read is asynchronous, and starting
|
|
811
|
+
at `false` would play an animation frame in the face of someone who asked for none. If you animate, write
|
|
847
812
|
`if (reduzir !== false) return;`.
|
|
848
813
|
|
|
849
|
-
##
|
|
814
|
+
## The reading panel
|
|
850
815
|
|
|
851
816
|
```tsx
|
|
852
817
|
<DataState state={carregando ? "loading" : erro ? "error" : vazio ? "empty" : undefined}>
|
|
853
818
|
{() => (
|
|
854
819
|
<Stack>
|
|
855
|
-
<KPI label="
|
|
856
|
-
<Progress value={score} label="
|
|
857
|
-
<Status variant="online">
|
|
820
|
+
<KPI label="Cost per km" value="R$ 1,20" trend="+3% this month" />
|
|
821
|
+
<Progress value={score} label="Health" />
|
|
822
|
+
<Status variant="online">Synced</Status>
|
|
858
823
|
</Stack>
|
|
859
824
|
)}
|
|
860
825
|
</DataState>
|
|
861
826
|
```
|
|
862
827
|
|
|
863
|
-
⚠ **
|
|
864
|
-
`offline`
|
|
828
|
+
⚠ **The seven universal states ACCOMPANY the content**, they do not replace it: `stale`, `partial` and
|
|
829
|
+
`offline` say the data is there with a caveat. Only `loading`, `error` and `empty` take its place.
|
|
865
830
|
|
|
866
|
-
⚠ **`children`
|
|
831
|
+
⚠ **`children` as a FUNCTION** exists so expensive content is not built behind a skeleton.
|
|
867
832
|
|
|
868
|
-
⚠
|
|
869
|
-
`check-circle`, `warning`, `x-circle`).
|
|
870
|
-
|
|
833
|
+
⚠ **`Alert` needs the variant glyphs in the registry** (`info`,
|
|
834
|
+
`check-circle`, `warning`, `x-circle`). This package does not import them for
|
|
835
|
+
you — that would bring icons into the bundler graph behind your back.
|
|
871
836
|
|
|
872
|
-
###
|
|
837
|
+
### The anchored badge, and the label it requires
|
|
873
838
|
|
|
874
839
|
```tsx
|
|
875
840
|
<Badge count={8} anchor="top-end">
|
|
876
|
-
<IconButton name="bell" label="
|
|
841
|
+
<IconButton name="bell" label="Alerts, 8 unread" onPress={abrir} />
|
|
877
842
|
</Badge>
|
|
878
843
|
```
|
|
879
844
|
|
|
880
|
-
⚠ **
|
|
881
|
-
|
|
845
|
+
⚠ **When anchored, the number leaves the accessibility tree** — the information is carried by the label
|
|
846
|
+
of what was decorated. Without it the screen reader announces *"bell, 8"* and nobody knows what the 8 is.
|
|
882
847
|
|
|
883
|
-
##
|
|
848
|
+
## Icons
|
|
884
849
|
|
|
885
|
-
|
|
886
|
-
`react-native-svg
|
|
887
|
-
|
|
888
|
-
duas formas: a regular (`icons/house`) e a cheia (`icons/house-fill`), que é a do item escolhido e
|
|
889
|
-
a dos avisos.
|
|
850
|
+
One component per icon and per weight, generated from the `@phosphor-icons/core` SVG on top of
|
|
851
|
+
`react-native-svg`. Each icon has two shapes: the regular one (`icons/house`) and the filled one
|
|
852
|
+
(`icons/house-fill`), which is used for the selected item and for notices.
|
|
890
853
|
|
|
891
|
-
**
|
|
854
|
+
**The documented form is the deep path:**
|
|
892
855
|
|
|
893
856
|
```tsx
|
|
894
857
|
import Plus from "@aurea-uds/native/icons/plus";
|
|
@@ -897,28 +860,27 @@ import CaretDown from "@aurea-uds/native/icons/caret-down";
|
|
|
897
860
|
<Plus size={size.iconMd} color={color.foreground} />
|
|
898
861
|
```
|
|
899
862
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
— experimental,
|
|
903
|
-
|
|
863
|
+
Importing 40 icons loads 40. **The barrel (`@aurea-uds/native/icons`) exists, but it is not the documented
|
|
864
|
+
form:** it brings every icon into the bundler graph unless Metro's tree-shaking
|
|
865
|
+
— experimental, three flags, production only — is on. The deep path does not depend on any
|
|
866
|
+
tree-shaking: a module that is not imported does not enter the graph.
|
|
904
867
|
|
|
905
|
-
`color` **
|
|
906
|
-
`currentColor`.
|
|
868
|
+
`color` **is not inherited**: `currentColor` does not exist in React Native, and the Phosphor drawing paints
|
|
869
|
+
with `currentColor`. The default is explicit black — pass the theme colour.
|
|
907
870
|
|
|
908
|
-
**
|
|
909
|
-
`criarRegistroDeIcones({house: House, "house-fill": HouseFill})`.
|
|
910
|
-
item
|
|
911
|
-
|
|
871
|
+
**The filled shape goes into the registry with the `-fill` suffix**, like the file:
|
|
872
|
+
`criarRegistroDeIcones({house: House, "house-fill": HouseFill})`. Components ask for the filled one on the
|
|
873
|
+
selected item (`BottomNav`), on notices (`Alert`, `Toast`) and on `ThemeToggle`; if it is not in the
|
|
874
|
+
registry, the regular one is used.
|
|
912
875
|
|
|
913
|
-
**
|
|
914
|
-
|
|
876
|
+
**Coming from the icons used until `0.12.4`:** every name changed. The table
|
|
877
|
+
`@aurea-uds/icons/carbon-para-phosphor.json` maps the old names to the new ones.
|
|
915
878
|
|
|
916
|
-
|
|
917
|
-
desenha lá, `icons/<nome>` desenha aqui.
|
|
879
|
+
The names are **the same as in the web sprite**: what `<Icon name>` draws there, `icons/<name>` draws here.
|
|
918
880
|
|
|
919
|
-
**
|
|
920
|
-
`react-native-svg`:
|
|
921
|
-
|
|
881
|
+
**A custom glyph** (the app logo) comes from `criarGlifo`, without the app importing
|
|
882
|
+
`react-native-svg`: rectangles, circles and paths, filled or stroked. The paint uses the SVG names,
|
|
883
|
+
and `"currentColor"` is the `Icon` colour:
|
|
922
884
|
|
|
923
885
|
```tsx
|
|
924
886
|
const Logo = criarGlifo({fill: "none", stroke: "currentColor", strokeWidth: 2,
|
|
@@ -926,9 +888,9 @@ const Logo = criarGlifo({fill: "none", stroke: "currentColor", strokeWidth: 2,
|
|
|
926
888
|
const ICONES = criarRegistroDeIcones({...OS_DO_APP, logo: Logo});
|
|
927
889
|
```
|
|
928
890
|
|
|
929
|
-
**
|
|
930
|
-
|
|
931
|
-
|
|
891
|
+
**The name is checked by TypeScript**: `<Icon name="chevron-down">`, with a single hyphen, does not
|
|
892
|
+
compile, and the registry key is checked too. A custom glyph is added by declaring its name
|
|
893
|
+
**once**:
|
|
932
894
|
|
|
933
895
|
```tsx
|
|
934
896
|
declare module "@aurea-uds/native" {
|
|
@@ -936,24 +898,23 @@ declare module "@aurea-uds/native" {
|
|
|
936
898
|
}
|
|
937
899
|
```
|
|
938
900
|
|
|
939
|
-
##
|
|
901
|
+
## What this package does not do
|
|
940
902
|
|
|
941
|
-
- **
|
|
942
|
-
`<input type=file>`
|
|
943
|
-
- **
|
|
944
|
-
- **
|
|
903
|
+
- **It does not promise parity** with the web. React Native has no `<p>`, no type cascade,
|
|
904
|
+
no `<input type=file>` and no hover — the native list is **its own**, not the same one with fewer items.
|
|
905
|
+
- **It does not provide routing.** `expo-router`/`react-navigation` is the app's choice.
|
|
906
|
+
- **It does not force a framework.** Expo is not a peer: the package is a library.
|
|
945
907
|
|
|
946
|
-
##
|
|
908
|
+
## Colour: a platform limit, stated
|
|
947
909
|
|
|
948
|
-
|
|
949
|
-
**
|
|
950
|
-
0.81.5
|
|
951
|
-
`style`
|
|
910
|
+
Colours come out in **hex**, and not by our choice. React Native's colour parser
|
|
911
|
+
**rejects** `oklch()`, `lab()`, `color(display-p3 …)` and even `color(srgb …)` — measured on versions
|
|
912
|
+
0.81.5 and 0.87.0, and it is JavaScript shared between iOS and Android. Passing a wide gamut to a
|
|
913
|
+
`style` makes the colour **silently discarded**.
|
|
952
914
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
[ADR-0027](../../decisions/0027-a-cor-no-alvo-nativo.md).
|
|
915
|
+
Consequence: on a wide-gamut screen the brand yellow loses **ΔEok 0.0225**, which sits right on the
|
|
916
|
+
threshold of what is perceptible. It cannot be avoided today — it is a platform ceiling.
|
|
956
917
|
|
|
957
|
-
##
|
|
918
|
+
## License
|
|
958
919
|
|
|
959
|
-
Apache-2.0.
|
|
920
|
+
Apache-2.0. The glyphs are from `@phosphor-icons/core` (Phosphor Icons, MIT) — see `NOTICE`.
|