@punks/cli 2.3.2 → 2.3.3
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/dist/BASELINE_CHANGELOG.md +40 -0
- package/dist/CHANGELOG.md +26 -0
- package/dist/index.js +194 -220
- package/dist/skills/agnostic/cli/dp-cli/SKILL.md +1 -12
- package/dist/skills/agnostic/cli/dp-cli/references/commands.md +22 -18
- package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +15 -19
- package/dist/skills/agnostic/quality/review/SKILL.md +89 -0
- package/dist/skills/agnostic/research/parallel-research/SKILL.md +5 -2
- package/dist/skills/frameworks/expo/add-app-clip/SKILL.md +280 -0
- package/dist/skills/frameworks/expo/add-app-clip/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/add-app-clip/references/native-module.md +96 -0
- package/dist/skills/frameworks/expo/building-native-ui/SKILL.md +377 -0
- package/dist/skills/frameworks/expo/building-native-ui/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/animations.md +220 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/controls.md +270 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/form-sheet.md +253 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/gradients.md +106 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/icons.md +213 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/media.md +198 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/route-structure.md +229 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/search.md +248 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/storage.md +121 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/tabs.md +433 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/toolbar-and-headers.md +284 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/visual-effects.md +197 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/webgpu-three.md +605 -0
- package/dist/skills/frameworks/expo/building-native-ui/references/zoom-transitions.md +158 -0
- package/dist/skills/frameworks/expo/eas-simulator/SKILL.md +154 -0
- package/dist/skills/frameworks/expo/eas-simulator/references/controllers.md +67 -0
- package/dist/skills/frameworks/expo/eas-simulator/references/run-your-app.md +185 -0
- package/dist/skills/frameworks/expo/eas-simulator/references/troubleshooting.md +38 -0
- package/dist/skills/frameworks/expo/eas-update-insights/SKILL.md +228 -0
- package/dist/skills/frameworks/expo/eas-update-insights/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/dist/skills/frameworks/expo/eas-update-insights/references/update-insights-schema.md +69 -0
- package/dist/skills/frameworks/expo/expo-api-routes/SKILL.md +368 -0
- package/dist/skills/frameworks/expo/expo-api-routes/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-brownfield/SKILL.md +54 -0
- package/dist/skills/frameworks/expo/expo-brownfield/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/brownfield-integrated.md +526 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/brownfield-isolated.md +402 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/comparison.md +63 -0
- package/dist/skills/frameworks/expo/expo-brownfield/references/troubleshooting.md +88 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/SKILL.md +92 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/fetch.js +109 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/package.json +11 -0
- package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/validate.js +84 -0
- package/dist/skills/frameworks/expo/expo-deployment/SKILL.md +167 -0
- package/dist/skills/frameworks/expo/expo-deployment/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/app-store-metadata.md +497 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/ios-app-store.md +371 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/play-store.md +246 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/testflight.md +58 -0
- package/dist/skills/frameworks/expo/expo-deployment/references/workflows.md +160 -0
- package/dist/skills/frameworks/expo/expo-dev-client/SKILL.md +172 -0
- package/dist/skills/frameworks/expo/expo-dev-client/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-examples/SKILL.md +97 -0
- package/dist/skills/frameworks/expo/expo-examples/references/catalog.md +105 -0
- package/dist/skills/frameworks/expo/expo-module/SKILL.md +141 -0
- package/dist/skills/frameworks/expo/expo-module/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-module/references/config-plugin.md +90 -0
- package/dist/skills/frameworks/expo/expo-module/references/create-expo-module.md +206 -0
- package/dist/skills/frameworks/expo/expo-module/references/lifecycle.md +127 -0
- package/dist/skills/frameworks/expo/expo-module/references/module-config.md +48 -0
- package/dist/skills/frameworks/expo/expo-module/references/native-module.md +286 -0
- package/dist/skills/frameworks/expo/expo-module/references/native-view.md +171 -0
- package/dist/skills/frameworks/expo/expo-observe/SKILL.md +29 -0
- package/dist/skills/frameworks/expo/expo-observe/references/metrics.md +47 -0
- package/dist/skills/frameworks/expo/expo-observe/references/queries.md +342 -0
- package/dist/skills/frameworks/expo/expo-observe/references/setup.md +255 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/SKILL.md +314 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/agents/visual-grader.md +52 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/references/design-rubric.md +45 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/references/runtime-matrix.md +33 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/check-static.sh +64 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/clean-fixture.sh +56 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/generate_viewer.py +450 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/latest-sdk.sh +46 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/make-fixture.sh +95 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/make-workspace.sh +31 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-android.sh +284 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-ios.sh +132 -0
- package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-web.sh +61 -0
- package/dist/skills/frameworks/expo/expo-tailwind-setup/SKILL.md +480 -0
- package/dist/skills/frameworks/expo/expo-tailwind-setup/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-ui/SKILL.md +47 -0
- package/dist/skills/frameworks/expo/expo-ui/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/expo-ui/references/drop-in-replacements.md +27 -0
- package/dist/skills/frameworks/expo/expo-ui/references/jetpack-compose.md +73 -0
- package/dist/skills/frameworks/expo/expo-ui/references/swift-ui.md +73 -0
- package/dist/skills/frameworks/expo/expo-ui/references/universal.md +73 -0
- package/dist/skills/frameworks/expo/expo-ui/scripts/list-components.js +193 -0
- package/dist/skills/frameworks/expo/native-data-fetching/SKILL.md +505 -0
- package/dist/skills/frameworks/expo/native-data-fetching/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/native-data-fetching/references/expo-router-loaders.md +341 -0
- package/dist/skills/frameworks/expo/upgrading-expo/SKILL.md +134 -0
- package/dist/skills/frameworks/expo/upgrading-expo/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/expo-av-to-audio.md +132 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/expo-av-to-video.md +160 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/native-tabs.md +124 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/new-architecture.md +79 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/react-19.md +79 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/react-compiler.md +59 -0
- package/dist/skills/frameworks/expo/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
- package/dist/skills/frameworks/expo/use-dom/SKILL.md +417 -0
- package/dist/skills/frameworks/expo/use-dom/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/expo/web-to-native/SKILL.md +83 -0
- package/dist/skills/frameworks/expo/web-to-native/references/false-friends.md +119 -0
- package/dist/skills/frameworks/expo/web-to-native/references/native-patterns.md +39 -0
- package/dist/skills/frameworks/expo/web-to-native/references/run-as-goal.md +48 -0
- package/dist/skills/frameworks/expo/web-to-native/references/verify-on-device.md +45 -0
- package/dist/skills/phases/review-phase/REFERENCE.md +36 -3
- package/dist/skills/phases/review-phase/SKILL.md +18 -11
- package/package.json +1 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Native Module DSL Reference
|
|
2
|
+
|
|
3
|
+
Swift is shown as the primary language. Kotlin follows the same DSL structure (see SKILL.md for both). Kotlin-specific syntax is noted where it meaningfully differs.
|
|
4
|
+
|
|
5
|
+
## Name
|
|
6
|
+
|
|
7
|
+
Sets the module identifier used in JavaScript.
|
|
8
|
+
|
|
9
|
+
```swift
|
|
10
|
+
Name("MyModule")
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Constant
|
|
14
|
+
|
|
15
|
+
Computed once on first access, then cached.
|
|
16
|
+
|
|
17
|
+
```swift
|
|
18
|
+
Constant("PI") { 3.14159 }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Function (Synchronous)
|
|
22
|
+
|
|
23
|
+
Blocks the JS thread until completion. Supports up to 8 arguments.
|
|
24
|
+
|
|
25
|
+
```swift
|
|
26
|
+
Function("add") { (a: Int, b: Int) -> Int in
|
|
27
|
+
return a + b
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## AsyncFunction
|
|
32
|
+
|
|
33
|
+
Returns a Promise. Runs on a background thread by default.
|
|
34
|
+
|
|
35
|
+
```swift
|
|
36
|
+
AsyncFunction("fetchData") { (url: URL) -> String in
|
|
37
|
+
let data = try Data(contentsOf: url)
|
|
38
|
+
return String(data: data, encoding: .utf8) ?? ""
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Force main queue execution
|
|
42
|
+
AsyncFunction("updateUI") { () -> Void in
|
|
43
|
+
// UI work
|
|
44
|
+
}.runOnQueue(.main)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Kotlin differences:**
|
|
48
|
+
|
|
49
|
+
```kotlin
|
|
50
|
+
// Supports Kotlin coroutines
|
|
51
|
+
AsyncFunction("fetchData") Coroutine { url: java.net.URL ->
|
|
52
|
+
withContext(Dispatchers.IO) {
|
|
53
|
+
url.readText()
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Property
|
|
59
|
+
|
|
60
|
+
Getter/setter for JS object properties.
|
|
61
|
+
|
|
62
|
+
```swift
|
|
63
|
+
// Read-only
|
|
64
|
+
Property("version") { "1.0.0" }
|
|
65
|
+
|
|
66
|
+
// Read-write
|
|
67
|
+
Property("volume")
|
|
68
|
+
.get { () -> Float in self.volume }
|
|
69
|
+
.set { (newValue: Float) in self.volume = newValue }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Events
|
|
73
|
+
|
|
74
|
+
Declares events the module can send to JS. Must be declared before using `sendEvent`.
|
|
75
|
+
|
|
76
|
+
```swift
|
|
77
|
+
// Declaration
|
|
78
|
+
Events("onChange", "onError")
|
|
79
|
+
|
|
80
|
+
// Sending from native (Swift)
|
|
81
|
+
sendEvent("onChange", ["value": newValue])
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Kotlin difference** — uses `bundleOf`:
|
|
85
|
+
|
|
86
|
+
```kotlin
|
|
87
|
+
sendEvent("onChange", bundleOf("value" to newValue))
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**JS subscription:**
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { useEvent } from "expo";
|
|
94
|
+
import MyModule from "./MyModule";
|
|
95
|
+
|
|
96
|
+
// Hook-based (recommended)
|
|
97
|
+
const event = useEvent(MyModule, "onChange");
|
|
98
|
+
|
|
99
|
+
// Manual subscription
|
|
100
|
+
const subscription = MyModule.addListener("onChange", (event) => {
|
|
101
|
+
console.log(event.value);
|
|
102
|
+
});
|
|
103
|
+
// Clean up: subscription.remove()
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### OnStartObserving / OnStopObserving
|
|
107
|
+
|
|
108
|
+
Called when the first listener attaches / last listener detaches. Can be scoped to specific events.
|
|
109
|
+
|
|
110
|
+
```swift
|
|
111
|
+
OnStartObserving("onChange") {
|
|
112
|
+
// Start producing events
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
OnStopObserving("onChange") {
|
|
116
|
+
// Stop producing events
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Type System
|
|
123
|
+
|
|
124
|
+
### Primitives
|
|
125
|
+
|
|
126
|
+
| Swift | Kotlin | JS |
|
|
127
|
+
|-------|--------|----|
|
|
128
|
+
| `Bool` | `Boolean` | `boolean` |
|
|
129
|
+
| `Int`, `Int32` | `Int` | `number` |
|
|
130
|
+
| `Int64` | `Long` | `number` |
|
|
131
|
+
| `Float`, `Float32` | `Float` | `number` |
|
|
132
|
+
| `Double` | `Double` | `number` |
|
|
133
|
+
| `String` | `String` | `string` |
|
|
134
|
+
| `URL` | `java.net.URL` / `android.net.Uri` | `string` |
|
|
135
|
+
| `CGPoint` | - | `{ x, y }` |
|
|
136
|
+
| `CGSize` | - | `{ width, height }` |
|
|
137
|
+
| `CGRect` | - | `{ x, y, width, height }` |
|
|
138
|
+
| `UIColor` / `CGColor` | `android.graphics.Color` | `string` (ProcessedColorValue) |
|
|
139
|
+
| `Data` | `kotlin.ByteArray` | `Uint8Array` |
|
|
140
|
+
|
|
141
|
+
### Records (Struct-like types)
|
|
142
|
+
|
|
143
|
+
```swift
|
|
144
|
+
struct UserRecord: Record {
|
|
145
|
+
@Field var name: String = ""
|
|
146
|
+
@Field var age: Int = 0
|
|
147
|
+
@Field var email: String?
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
Function("createUser") { (user: UserRecord) -> Bool in
|
|
151
|
+
return true
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Kotlin difference** — uses `class` instead of `struct`, optional fields need explicit `= null`:
|
|
156
|
+
|
|
157
|
+
```kotlin
|
|
158
|
+
class UserRecord : Record {
|
|
159
|
+
@Field var name: String = ""
|
|
160
|
+
@Field var age: Int = 0
|
|
161
|
+
@Field var email: String? = null
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Enums (Enumerable)
|
|
166
|
+
|
|
167
|
+
```swift
|
|
168
|
+
enum Theme: String, Enumerable {
|
|
169
|
+
case light
|
|
170
|
+
case dark
|
|
171
|
+
case system
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
Function("setTheme") { (theme: Theme) in
|
|
175
|
+
// type-safe enum value
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Kotlin difference** — uses `enum class` with explicit `value` property:
|
|
180
|
+
|
|
181
|
+
```kotlin
|
|
182
|
+
enum class Theme(val value: String) : Enumerable {
|
|
183
|
+
LIGHT("light"),
|
|
184
|
+
DARK("dark"),
|
|
185
|
+
SYSTEM("system")
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Either Types (Union types)
|
|
190
|
+
|
|
191
|
+
```swift
|
|
192
|
+
Function("process") { (input: Either<String, Int>) in
|
|
193
|
+
if let str = input.get(String.self) {
|
|
194
|
+
// handle string
|
|
195
|
+
} else if let num = input.get(Int.self) {
|
|
196
|
+
// handle number
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Also available: `EitherOfThree<A, B, C>`, `EitherOfFour<A, B, C, D>`.
|
|
202
|
+
|
|
203
|
+
### JavaScript Values (Direct JS manipulation)
|
|
204
|
+
|
|
205
|
+
For advanced use in synchronous functions running on JS thread:
|
|
206
|
+
|
|
207
|
+
```swift
|
|
208
|
+
Function("callback") { (fn: JavaScriptFunction<String>) in
|
|
209
|
+
let result = fn("arg1", "arg2")
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Shared Objects
|
|
216
|
+
|
|
217
|
+
Bridge native class instances to JS with automatic lifecycle management. Instances are deallocated when neither JS nor native code holds a reference.
|
|
218
|
+
|
|
219
|
+
### Defining a Shared Object
|
|
220
|
+
|
|
221
|
+
```swift
|
|
222
|
+
class ImageContext: SharedObject {
|
|
223
|
+
private var image: UIImage
|
|
224
|
+
|
|
225
|
+
init(image: UIImage) {
|
|
226
|
+
self.image = image
|
|
227
|
+
super.init()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
func rotate(degrees: Double) {
|
|
231
|
+
image = image.rotated(degrees: degrees)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Kotlin difference** — takes `RuntimeContext` in constructor, override `sharedObjectDidRelease()` for cleanup:
|
|
237
|
+
|
|
238
|
+
```kotlin
|
|
239
|
+
class ImageContext(
|
|
240
|
+
runtimeContext: RuntimeContext,
|
|
241
|
+
private var bitmap: Bitmap
|
|
242
|
+
) : SharedObject(runtimeContext) {
|
|
243
|
+
|
|
244
|
+
fun rotate(degrees: Float) { /* ... */ }
|
|
245
|
+
|
|
246
|
+
override fun sharedObjectDidRelease() {
|
|
247
|
+
if (!bitmap.isRecycled) bitmap.recycle()
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Exposing via Class DSL
|
|
253
|
+
|
|
254
|
+
```swift
|
|
255
|
+
Class("Context", ImageContext.self) {
|
|
256
|
+
Constructor { (path: String) -> ImageContext in
|
|
257
|
+
return ImageContext(image: UIImage(contentsOfFile: path)!)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
Function("rotate") { (ctx: ImageContext, degrees: Double) -> ImageContext in
|
|
261
|
+
ctx.rotate(degrees: degrees)
|
|
262
|
+
return ctx
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
Property("width")
|
|
266
|
+
.get { (ctx: ImageContext) -> Int in ctx.width }
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Other Class DSL components: `StaticFunction`, `StaticAsyncFunction`, `AsyncFunction`.
|
|
271
|
+
|
|
272
|
+
### SharedRef
|
|
273
|
+
|
|
274
|
+
Specialized shared reference for passing typed objects between modules:
|
|
275
|
+
|
|
276
|
+
```swift
|
|
277
|
+
final class ImageRef: SharedRef<UIImage> {}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### JS Usage
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
const ctx = await ImageModule.create("/path/to/image.png");
|
|
284
|
+
ctx.rotate(90);
|
|
285
|
+
console.log(ctx.width);
|
|
286
|
+
```
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Native View Reference
|
|
2
|
+
|
|
3
|
+
Native views let you render platform UI components (UIView on iOS, Android View on Android) as React components.
|
|
4
|
+
|
|
5
|
+
## Defining a View
|
|
6
|
+
|
|
7
|
+
**Swift:**
|
|
8
|
+
|
|
9
|
+
```swift
|
|
10
|
+
public class MyViewModule: Module {
|
|
11
|
+
public func definition() -> ModuleDefinition {
|
|
12
|
+
Name("MyView")
|
|
13
|
+
|
|
14
|
+
View(MyNativeView.self) {
|
|
15
|
+
Prop("title") { (view: MyNativeView, title: String) in
|
|
16
|
+
view.titleLabel.text = title
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Events("onPress", "onLoad")
|
|
20
|
+
|
|
21
|
+
AsyncFunction("reset") { (view: MyNativeView) in
|
|
22
|
+
view.reset()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class MyNativeView: ExpoView {
|
|
29
|
+
let titleLabel = UILabel()
|
|
30
|
+
|
|
31
|
+
required init(appContext: AppContext) {
|
|
32
|
+
super.init(appContext: appContext)
|
|
33
|
+
clipsToBounds = true
|
|
34
|
+
addSubview(titleLabel)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override func layoutSubviews() {
|
|
38
|
+
super.layoutSubviews()
|
|
39
|
+
titleLabel.frame = bounds
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Kotlin:**
|
|
45
|
+
|
|
46
|
+
```kotlin
|
|
47
|
+
class MyViewModule : Module() {
|
|
48
|
+
override fun definition() = ModuleDefinition {
|
|
49
|
+
Name("MyView")
|
|
50
|
+
|
|
51
|
+
View(MyNativeView::class) {
|
|
52
|
+
Prop("title") { view: MyNativeView, title: String ->
|
|
53
|
+
view.titleView.text = title
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Events("onPress", "onLoad")
|
|
57
|
+
|
|
58
|
+
AsyncFunction("reset") { view: MyNativeView ->
|
|
59
|
+
view.reset()
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class MyNativeView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
|
66
|
+
val titleView = TextView(context).also {
|
|
67
|
+
addView(it, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**TypeScript:**
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { requireNativeView } from "expo";
|
|
76
|
+
|
|
77
|
+
export type MyViewProps = {
|
|
78
|
+
title?: string;
|
|
79
|
+
onPress?: (event: { nativeEvent: { x: number; y: number } }) => void;
|
|
80
|
+
onLoad?: () => void;
|
|
81
|
+
} & ViewProps;
|
|
82
|
+
|
|
83
|
+
const NativeView = requireNativeView<MyViewProps>("MyView");
|
|
84
|
+
|
|
85
|
+
export function MyView(props: MyViewProps) {
|
|
86
|
+
return <NativeView {...props} />;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## View Event Dispatching
|
|
91
|
+
|
|
92
|
+
**Swift:**
|
|
93
|
+
|
|
94
|
+
```swift
|
|
95
|
+
class MyNativeView: ExpoView {
|
|
96
|
+
let onPress = EventDispatcher()
|
|
97
|
+
|
|
98
|
+
func handleTap(at point: CGPoint) {
|
|
99
|
+
onPress(["x": point.x, "y": point.y])
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Kotlin:**
|
|
105
|
+
|
|
106
|
+
```kotlin
|
|
107
|
+
class MyNativeView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
|
|
108
|
+
private val onPress by EventDispatcher()
|
|
109
|
+
|
|
110
|
+
fun handleTap(x: Float, y: Float) {
|
|
111
|
+
onPress(mapOf("x" to x, "y" to y))
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## View Lifecycle
|
|
117
|
+
|
|
118
|
+
```swift
|
|
119
|
+
// Called after all props have been set
|
|
120
|
+
OnViewDidUpdateProps { (view: MyNativeView) in
|
|
121
|
+
view.applyChanges()
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```kotlin
|
|
126
|
+
// Android only - called when view is no longer used
|
|
127
|
+
OnViewDestroys { view: MyNativeView ->
|
|
128
|
+
view.cleanup()
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## AsyncFunction on Views
|
|
133
|
+
|
|
134
|
+
Functions defined inside `View` are accessible via React ref:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const ref = useRef<MyView>(null);
|
|
138
|
+
// Call native function
|
|
139
|
+
await ref.current?.reset();
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## PropGroup (Android)
|
|
143
|
+
|
|
144
|
+
Batch-register multiple props with shared setter logic:
|
|
145
|
+
|
|
146
|
+
```kotlin
|
|
147
|
+
View(MyNativeView::class) {
|
|
148
|
+
PropGroup("border", "width" to Float::class, "color" to Int::class) { view, index, value ->
|
|
149
|
+
when (index) {
|
|
150
|
+
0 -> view.borderWidth = value as Float
|
|
151
|
+
1 -> view.borderColor = value as Int
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## GroupView (Android)
|
|
158
|
+
|
|
159
|
+
Enable view group functionality for managing child views:
|
|
160
|
+
|
|
161
|
+
```kotlin
|
|
162
|
+
View(MyContainerView::class) {
|
|
163
|
+
GroupView {
|
|
164
|
+
AddChildView { parent, child, index -> parent.addView(child, index) }
|
|
165
|
+
GetChildCount { parent -> parent.childCount }
|
|
166
|
+
GetChildViewAt { parent, index -> parent.getChildAt(index) }
|
|
167
|
+
RemoveChildView { parent, child -> parent.removeView(child) }
|
|
168
|
+
RemoveChildViewAt { parent, index -> parent.removeViewAt(index) }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: expo-observe
|
|
3
|
+
description: Use for anything related to EAS Observe — adding `expo-observe` to an Expo project (AppMetricsRoot/ObserveRoot HOC, markInteractive, the useObserve hook, and the Expo Router / React Navigation integrations for per-route metrics), querying via the EAS CLI (`eas observe:metrics-summary`, `observe:metrics`, `observe:routes`, `observe:events`, `observe:versions`), or interpreting the resulting metrics (cold/warm launch, TTR, TTI, navigation cold/warm TTR, update download, and the TTI frameRate params for triaging slow startups).
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
license: MIT
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# EAS Observe
|
|
9
|
+
|
|
10
|
+
EAS Observe tracks startup, navigation, and custom-event performance from production Expo apps.
|
|
11
|
+
|
|
12
|
+
> **Source of truth:** https://docs.expo.dev/eas/observe/ — always consult the canonical docs when API details matter, especially get-started, configuration, integrations, and the metrics reference. EAS Observe is evolving; this skill's references are written to stay accurate but may lag the docs.
|
|
13
|
+
|
|
14
|
+
## Which reference to read
|
|
15
|
+
|
|
16
|
+
The three reference files in `./references/` cover the three things people typically need this skill for:
|
|
17
|
+
|
|
18
|
+
- **Adding EAS Observe to a project** → [`./references/setup.md`](./references/setup.md). Install, wrap the root layout (`AppMetricsRoot` on SDK 55, `ObserveRoot` on SDK 56+), call `markInteractive()` (global on SDK 55, via the `useObserve()` hook on SDK 56+), and optional per-route navigation metrics through the Expo Router / React Navigation integrations.
|
|
19
|
+
- **Querying metrics from the terminal** → [`./references/queries.md`](./references/queries.md). The five `eas observe:*` commands — `metrics-summary`, `metrics`, `routes`, `events`, `versions` — with flags, table layouts, JSON shapes, and common workflows.
|
|
20
|
+
- **Reading a dashboard or CLI output** → [`./references/metrics.md`](./references/metrics.md). Target thresholds per metric, what the TTI `frameRate.*` params mean, and diagnostic patterns for telling slow-but-smooth startup apart from main-thread contention or hard blocks.
|
|
21
|
+
|
|
22
|
+
## Quick links to the docs
|
|
23
|
+
|
|
24
|
+
- Get started: https://docs.expo.dev/eas/observe/get-started/
|
|
25
|
+
- Dashboard guide: https://docs.expo.dev/eas/observe/dashboard/
|
|
26
|
+
- Metrics reference: https://docs.expo.dev/eas/observe/reference/metrics/
|
|
27
|
+
- Expo Router integration: https://docs.expo.dev/eas/observe/integrations/expo-router/
|
|
28
|
+
- React Navigation integration: https://docs.expo.dev/eas/observe/integrations/react-navigation/
|
|
29
|
+
- Configuration: https://docs.expo.dev/eas/observe/configuration/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# EAS Observe metrics — interpretation cheatsheet
|
|
2
|
+
|
|
3
|
+
Quick reference for reading EAS Observe dashboards and CLI output.
|
|
4
|
+
|
|
5
|
+
> Source: https://docs.expo.dev/eas/observe/reference/metrics/ — this is the canonical reference for metrics. Consult this page for the latest guidance, full prose definitions, optimization tips, and rationale.
|
|
6
|
+
|
|
7
|
+
All durations are in seconds. Data is retained for 90 days. All durations are in seconds. By default, every installation dispatches all of its events. Apps with high volumes can opt into per-installation sampling via configure({ sampleRate }). See [Sampling](https://docs.expo.dev/eas/observe/configuration/#sampling).
|
|
8
|
+
|
|
9
|
+
## Target thresholds
|
|
10
|
+
|
|
11
|
+
| Metric | Full name | Target | Auto-collected? |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| Cold launch | `expo.app_startup.cold_launch_time` | **< 1.5s** | Yes (native-only — JS code does not affect it) |
|
|
14
|
+
| Warm launch | `expo.app_startup.warm_launch_time` | **< 0.5s** | Yes (OS decides when warm vs cold happens) |
|
|
15
|
+
| Bundle load | `expo.app_startup.bundle_load_time` | **< 0.3s** | Yes (JS load + evaluation, before `runApplication`) |
|
|
16
|
+
| Time to first render (TTR) | `expo.app_startup.ttr` | **< 2s** incl. cold launch | Yes when root is wrapped with `AppMetricsRoot` (SDK 55) / `ObserveRoot` (SDK 56+) |
|
|
17
|
+
| Time to interactive (TTI) | `expo.app_startup.tti` | **< 3s** incl. cold launch | **No** — call `markInteractive()` once the screen is genuinely usable |
|
|
18
|
+
|
|
19
|
+
Both TTR and TTI are measured *from native launch* through the React render, so the cold-launch portion counts against them.
|
|
20
|
+
|
|
21
|
+
## Interpreting TTI events (frameRate params)
|
|
22
|
+
|
|
23
|
+
Every TTI event carries three frame-rate params. The pattern of high/low values across them tells you *what kind* of slowness you're seeing.
|
|
24
|
+
|
|
25
|
+
| Param | Definition | What it indicates |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `expo.frameRate.slowFrames` | Count of frames ≥ 17ms | Main thread consistently busy during launch (heavy layout, sync bridge calls, too many components rendering) |
|
|
28
|
+
| `expo.frameRate.frozenFrames` | Count of frames ≥ 700ms | Hard freezes. Even one during startup is a serious issue (sync I/O, large JSON parsing, blocking network) |
|
|
29
|
+
| `expo.frameRate.totalDelay` | Total accumulated time (seconds) frames exceeded their target duration | Best single "smoothness" number — compare to TTI |
|
|
30
|
+
|
|
31
|
+
**Diagnostic patterns:**
|
|
32
|
+
|
|
33
|
+
- **High TTI + low totalDelay** → slow but smooth. The launch sequence itself is long. Optimize bundle size, data-fetch waterfalls, initialization chains.
|
|
34
|
+
- **High TTI + high totalDelay + many slowFrames** → main-thread contention. Offload work, simplify the initial render tree.
|
|
35
|
+
- **High TTI + high totalDelay + any frozenFrames** → something is blocking hard. Look for synchronous I/O, large JSON parsing, or blocking network calls.
|
|
36
|
+
|
|
37
|
+
## Dispatch caveats
|
|
38
|
+
|
|
39
|
+
- **Debug builds** (native debug OR JS bundle with `__DEV__` = true) do **not** dispatch metrics unless `configure({ dispatchInDebug: true })` is set.
|
|
40
|
+
- The `environment` tag (defaults to `process.env.NODE_ENV`) is metadata only — it does not gate dispatch by itself.
|
|
41
|
+
- Offline events are buffered on-device and flushed when the app backgrounds or `Observe.dispatchEvents()` is called.
|
|
42
|
+
|
|
43
|
+
## Cross-references
|
|
44
|
+
|
|
45
|
+
- Full metric definitions and optimization guidance: https://docs.expo.dev/eas/observe/reference/metrics/
|
|
46
|
+
- Setup steps (`AppMetricsRoot` / `ObserveRoot`, `markInteractive`): see [`./setup.md`](./setup.md).
|
|
47
|
+
- Querying metrics via the EAS CLI: see [`./queries.md`](./queries.md).
|