create-disposabl-app 0.0.4 → 0.1.1
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/index.js +490 -105
- package/dist/templates/default/LICENSE +21 -0
- package/dist/templates/default/apps/blog/package.json +1 -0
- package/dist/templates/default/apps/changelog/package.json +1 -0
- package/dist/templates/default/apps/desktop/.oxfmtrc.json +5 -0
- package/dist/templates/default/apps/desktop/.oxlintrc.json +6 -0
- package/dist/templates/default/apps/desktop/README.md +58 -0
- package/dist/templates/default/apps/desktop/forge.config.mts +90 -0
- package/dist/templates/default/apps/desktop/index.html +12 -0
- package/dist/templates/default/apps/desktop/package.json +55 -0
- package/dist/templates/default/apps/desktop/src/declarations.d.ts +2 -0
- package/dist/templates/default/apps/desktop/src/index.css +8 -0
- package/dist/templates/default/apps/desktop/src/main.ts +58 -0
- package/dist/templates/default/apps/desktop/src/preload.ts +3 -0
- package/dist/templates/default/apps/desktop/src/renderer.ts +19 -0
- package/dist/templates/default/apps/desktop/tsconfig.json +14 -0
- package/dist/templates/default/apps/desktop/vite.main.config.mts +4 -0
- package/dist/templates/default/apps/desktop/vite.preload.config.mts +4 -0
- package/dist/templates/default/apps/desktop/vite.renderer.config.mts +4 -0
- package/dist/templates/default/apps/docs/package.json +1 -0
- package/dist/templates/default/apps/mobile/.agents/skills/agent-device/SKILL.md +22 -0
- package/dist/templates/default/apps/mobile/.agents/skills/android-emulator/SKILL.md +32 -0
- package/dist/templates/default/apps/mobile/.agents/skills/dogfood/SKILL.md +27 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/SKILL.md +176 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/references/app-store-metadata.md +497 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/references/ios-app-store.md +376 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/references/native-ios.md +167 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/references/play-store.md +244 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/references/testflight.md +62 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-app-stores/references/workflows.md +120 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-hosting/SKILL.md +431 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-hosting/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/SKILL.md +46 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/metrics.md +98 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/queries.md +444 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/setup.md +529 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-observe/references/third-party.md +136 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/SKILL.md +237 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/references/controllers.md +139 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/references/logs-and-crashes.md +101 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/references/run-your-app.md +256 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-simulator/references/troubleshooting.md +56 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update/SKILL.md +146 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update-insights/SKILL.md +238 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update-insights/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-update-insights/references/update-insights-schema.md +69 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-workflows/SKILL.md +99 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-workflows/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-workflows/scripts/fetch.js +109 -0
- package/dist/templates/default/apps/mobile/.agents/skills/eas-workflows/scripts/package.json +6 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-animation/LICENSE +21 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-animation/RECIPES.md +385 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-animation/SKILL.md +274 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-app-clip/SKILL.md +290 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-app-clip/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-app-clip/references/native-module.md +96 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/SKILL.md +69 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/references/brownfield-integrated.md +551 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/references/brownfield-isolated.md +449 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/references/comparison.md +63 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/references/feature-integration.md +163 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/references/troubleshooting.md +88 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-brownfield/references/version-compatibility.md +40 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-data-fetching/SKILL.md +478 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-data-fetching/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-data-fetching/references/expo-router-loaders.md +341 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-data-fetching/references/offline-and-cancellation.md +68 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-design-system/SKILL.md +376 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-design-system/references/audit.md +190 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-design-system/references/native-slop.md +74 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-dev-client/SKILL.md +184 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-dev-client/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-dom/SKILL.md +425 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-dom/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-examples/SKILL.md +106 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-examples/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-examples/references/catalog.md +105 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/SKILL.md +124 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/references/compatibility.md +130 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/references/example.md +212 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-migrate-module/references/migration-map.md +457 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/SKILL.md +151 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/references/config-plugin.md +90 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/references/create-expo-module.md +206 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/references/lifecycle.md +127 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/references/module-config.md +48 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/references/native-module.md +286 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-module/references/native-view.md +171 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/SKILL.md +201 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/controls.md +231 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/gradients.md +106 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/icons.md +232 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/media.md +193 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/storage.md +121 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/visual-effects.md +198 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-native-ui/references/webgpu-three.md +605 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-overview/SKILL.md +120 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-overview/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-overview/references/launch-without-dev-menu.md +24 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-project-structure/SKILL.md +114 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/SKILL.md +240 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/references/form-sheet.md +253 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/references/route-structure.md +229 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/references/search.md +248 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/references/tabs.md +433 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/references/toolbar-and-headers.md +284 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-router/references/zoom-transitions.md +158 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/SKILL.md +314 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/agents/visual-grader.md +52 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/references/design-rubric.md +45 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/references/runtime-matrix.md +34 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/check-static.sh +64 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/clean-fixture.sh +56 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/generate_viewer.py +450 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/latest-sdk.sh +46 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/make-fixture.sh +95 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/make-workspace.sh +31 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/snapshot-android.sh +284 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/snapshot-ios.sh +132 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-skill-eval/scripts/snapshot-web.sh +61 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/SKILL.md +101 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/references/drop-in-replacements.md +27 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/references/jetpack-compose.md +73 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/references/swift-ui.md +73 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/references/universal.md +104 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-ui/scripts/list-components.js +193 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/SKILL.md +150 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/expo-av-to-audio.md +132 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/expo-av-to-video.md +160 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/native-tabs.md +124 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/new-architecture.md +79 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/react-19.md +79 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/react-compiler.md +59 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-upgrade/references/react-navigation-to-expo-router.md +61 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/SKILL.md +91 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/references/false-friends.md +119 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/references/native-patterns.md +39 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/references/run-as-goal.md +48 -0
- package/dist/templates/default/apps/mobile/.agents/skills/expo-web-to-native/references/verify-on-device.md +45 -0
- package/dist/templates/default/apps/mobile/.agents/skills/ios-simulator/SKILL.md +32 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/POWER.md +172 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/SKILL.md +238 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/agents/openai.yaml +4 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-analyze-app.md +208 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-analyze-js.md +264 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-barrel-exports.md +250 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-code-splitting.md +255 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-hermes-mmap.md +167 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-library-size.md +164 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-native-assets.md +208 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-r8-android.md +231 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/bundle-tree-shaking.md +215 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/bundle-treemap-source-map-explorer.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/controlled-textinput-pingpong.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/devtools-flamegraph.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/emerge-xray-ios.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/expo-atlas-treemap.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/flashlight-flatlist-vs-flashlist.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/fps-drop-graph.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/memory-heap-snapshot.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/tti-warm-start-diagram.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/view-hierarchy-flattening.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/xcode-instruments-templates.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/images/xcode-thread-view.png +0 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-animations-reanimated.md +273 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-atomic-state.md +190 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-bottomsheet.md +339 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-concurrent-react.md +238 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-lists-flatlist-flashlist.md +223 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-measure-fps.md +178 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-memory-leaks.md +168 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-profile-react.md +138 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-react-compiler.md +261 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/js-uncontrolled-components.md +219 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-android-16kb-alignment.md +114 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-measure-tti.md +221 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-memory-leaks.md +206 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-memory-patterns.md +240 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-platform-setup.md +112 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-profiling.md +140 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-sdks-over-polyfills.md +192 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-threading-model.md +230 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-turbo-modules.md +210 -0
- package/dist/templates/default/apps/mobile/.agents/skills/react-native-best-practices/references/native-view-flattening.md +180 -0
- package/dist/templates/default/apps/mobile/AGENTS.md +41 -0
- package/dist/templates/default/apps/mobile/app.json +38 -0
- package/dist/templates/default/apps/mobile/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
- package/dist/templates/default/apps/mobile/assets/expo.icon/Assets/grid.png +0 -0
- package/dist/templates/default/apps/mobile/assets/expo.icon/icon.json +40 -0
- package/dist/templates/default/apps/mobile/assets/images/android-icon-background.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/android-icon-foreground.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/android-icon-monochrome.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/icon.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/splash-icon.png +0 -0
- package/dist/templates/default/apps/mobile/eslint.config.js +10 -0
- package/dist/templates/default/apps/mobile/package.json +43 -0
- package/dist/templates/default/apps/mobile/skills-lock.json +185 -0
- package/dist/templates/default/apps/mobile/src/app/_layout.tsx +5 -0
- package/dist/templates/default/apps/mobile/src/app/index.tsx +17 -0
- package/dist/templates/default/apps/mobile/tsconfig.json +20 -0
- package/dist/templates/default/apps/web/.agents/skills/frontend-design/SKILL.md +71 -0
- package/dist/templates/default/apps/web/.agents/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/default/apps/web/.env.example +3 -0
- package/dist/templates/default/apps/web/components.json +23 -0
- package/dist/templates/default/apps/web/eslint.config.ts +21 -0
- package/dist/templates/default/apps/web/package.json +39 -0
- package/dist/templates/default/apps/web/public/disposabl-logo.svg +8 -0
- package/dist/templates/default/apps/web/public/favicon.ico +0 -0
- package/dist/templates/default/apps/web/public/manifest.json +25 -0
- package/dist/templates/default/apps/web/skills-lock.json +17 -0
- package/dist/templates/default/apps/web/src/index.css +92 -0
- package/dist/templates/default/apps/web/src/routeTree.gen.ts +282 -0
- package/dist/templates/default/apps/web/src/router/__root.tsx +63 -0
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.tsx +9 -0
- package/dist/templates/default/apps/web/src/router/_authenticated/todos/$id.tsx +27 -0
- package/dist/templates/default/apps/web/src/router/_authenticated/todos/index.tsx +33 -0
- package/dist/templates/default/apps/web/src/router/index.tsx +15 -0
- package/dist/templates/default/apps/web/src/router.tsx +20 -0
- package/dist/templates/default/apps/web/tsconfig.json +33 -0
- package/dist/templates/default/apps/web/tsr.config.json +6 -0
- package/dist/templates/default/apps/web/vite.config.ts +67 -0
- package/dist/templates/default/bun.lock +3932 -0
- package/dist/templates/default/bunfig.toml +5 -0
- package/dist/templates/default/disposabl.json +5 -0
- package/dist/templates/default/gitignore +10 -0
- package/dist/templates/default/package.json +31 -10
- package/dist/templates/default/packages/backend/.agents/skills/convex/SKILL.md +69 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-add/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-advisor/SKILL.md +32 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-agent/SKILL.md +25 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-auth/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-authz/SKILL.md +36 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-backup/SKILL.md +33 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-billing/SKILL.md +69 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-cost/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/SKILL.md +325 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/agents/openai.yaml +14 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/assets/icon.svg +3 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/references/advanced-patterns.md +146 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/references/hybrid-components.md +38 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/references/local-components.md +39 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-create-component/references/packaged-components.md +54 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-crons/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-deploy-guard/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-design/SKILL.md +30 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-docs/SKILL.md +31 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-domains/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-env/SKILL.md +24 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-expert/SKILL.md +38 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-explain-app/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-improve-convex-plugin/SKILL.md +24 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-insights/SKILL.md +32 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-launch-readiness/SKILL.md +35 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-migrate/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-migrate-rehearse/SKILL.md +31 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-monitor/SKILL.md +22 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-optimize/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-quickstart/SKILL.md +29 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-quickstart/agents/openai.yaml +14 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-quickstart/assets/icon.svg +4 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-reviewer/SKILL.md +26 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-seed/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-self-heal/SKILL.md +38 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-sentinel/SKILL.md +25 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-suggest/SKILL.md +27 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-test/SKILL.md +23 -0
- package/dist/templates/default/packages/backend/.agents/skills/convex-verify/SKILL.md +34 -0
- package/dist/templates/default/packages/backend/.prettierignore +4 -0
- package/dist/templates/default/packages/backend/AGENTS.md +18 -0
- package/dist/templates/default/packages/backend/CLAUDE.md +13 -0
- package/dist/templates/default/packages/backend/README.md +25 -0
- package/dist/templates/default/packages/backend/convex/_generated/ai/ai-files.state.json +6 -0
- package/dist/templates/default/packages/backend/convex/_generated/ai/guidelines.md +286 -0
- package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +66 -0
- package/dist/templates/default/packages/backend/convex/_generated/api.js +23 -0
- package/dist/templates/default/packages/backend/convex/_generated/dataModel.d.ts +60 -0
- package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +164 -0
- package/dist/templates/default/packages/backend/convex/_generated/server.js +101 -0
- package/dist/templates/default/packages/backend/convex/auth.config.ts +14 -0
- package/dist/templates/default/packages/backend/convex/auth.ts +15 -0
- package/dist/templates/default/packages/backend/convex/convex.config.ts +30 -0
- package/dist/templates/default/packages/backend/convex/http.ts +5 -0
- package/dist/templates/default/packages/backend/convex/mcp.ts +8 -0
- package/dist/templates/default/packages/backend/convex/schema.ts +10 -0
- package/dist/templates/default/packages/backend/convex/todos/index.ts +26 -0
- package/dist/templates/default/packages/backend/convex/todos/internal.ts +43 -0
- package/dist/templates/default/packages/backend/convex/tsconfig.json +27 -0
- package/dist/templates/default/packages/backend/convex/users.ts +20 -0
- package/dist/templates/default/packages/backend/eslint.config.mjs +62 -0
- package/dist/templates/default/packages/backend/package.json +36 -0
- package/dist/templates/default/packages/backend/skills-lock.json +203 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/accordion.tsx +77 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/alert-dialog.tsx +185 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/alert.tsx +75 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/aspect-ratio.tsx +22 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/attachment.tsx +207 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/avatar.tsx +106 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/badge.tsx +51 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/breadcrumb.tsx +121 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/bubble.tsx +127 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/button-group.tsx +87 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/button.tsx +57 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/calendar.tsx +241 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/card.tsx +102 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/carousel.tsx +239 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/chart.tsx +368 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/checkbox.tsx +27 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/code-block.tsx +243 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/collapsible.tsx +19 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/combobox.tsx +300 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/command.tsx +194 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/context-menu.tsx +271 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/dialog.tsx +156 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/direction.tsx +4 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/drawer.tsx +224 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/dropdown-menu.tsx +269 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/empty.tsx +103 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/field.tsx +236 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/hover-card.tsx +50 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/input-group.tsx +158 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/input-otp.tsx +83 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/input.tsx +19 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/item.tsx +201 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/kbd.tsx +26 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/label.tsx +19 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/marker.tsx +70 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/menubar.tsx +284 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/message-scroller.tsx +128 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/message.tsx +91 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/native-select.tsx +64 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/navigation-menu.tsx +170 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/pagination.tsx +133 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/popover.tsx +87 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/progress.tsx +82 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/questionnaire.tsx +330 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/radio-group.tsx +35 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/resizable.tsx +49 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/scroll-area.tsx +51 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/select.tsx +201 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/separator.tsx +22 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/sheet.tsx +132 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/sidebar.tsx +723 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/skeleton.tsx +13 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/slider.tsx +51 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/spinner.tsx +16 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/switch.tsx +31 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/table.tsx +113 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/tabs.tsx +81 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/textarea.tsx +17 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/toast.tsx +229 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/toggle-group.tsx +87 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/toggle.tsx +42 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/tooltip.tsx +65 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/trace.tsx +161 -0
- package/dist/templates/default/packages/disposabl-kit/client/hooks/use-mobile.ts +21 -0
- package/dist/templates/default/packages/disposabl-kit/client/lib/prerender.ts +89 -0
- package/dist/templates/default/packages/disposabl-kit/client/lib/return-to.ts +12 -0
- package/dist/templates/default/packages/disposabl-kit/client/lib/utils.ts +1 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +114 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +120 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_authenticated/route.tsx +38 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +137 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +30 -0
- package/dist/templates/default/packages/disposabl-kit/client/styles/globals.css +60 -0
- package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +32 -0
- package/dist/templates/default/packages/disposabl-kit/components.json +23 -0
- package/dist/templates/default/packages/disposabl-kit/eslint.config.js +21 -0
- package/dist/templates/default/packages/disposabl-kit/package.json +60 -0
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +86 -0
- package/dist/templates/default/packages/disposabl-kit/server/lib/functions.ts +40 -0
- package/dist/templates/default/packages/disposabl-kit/server/lib/platforms.ts +20 -0
- package/dist/templates/default/packages/disposabl-kit/server/lib/static-routes.ts +56 -0
- package/dist/templates/default/packages/disposabl-kit/tsconfig.json +17 -0
- package/dist/templates/default/patches/@convex-dev%2Fauth@2.0.0-beta.0.patch +310 -0
- package/dist/templates/default/patches/@convex-dev%2Fstatic-hosting@0.2.1.patch +187 -0
- package/dist/templates/default/tsconfig.json +9 -0
- package/dist/templates/default/turbo.json +51 -0
- package/package.json +21 -5
- package/README.md +0 -34
- package/dist/templates/default/README.md +0 -12
- package/dist/templates/default/docs/index.html +0 -8
- package/dist/templates/default/eslint.config.js +0 -18
- package/dist/templates/default/index.ts +0 -14
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Higher-Order Lists
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
tags: lists, flatlist, flashlist, legend-list, scrollview, virtualization
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: Higher-Order Lists
|
|
8
|
+
|
|
9
|
+
Replace ScrollView with FlatList, FlashList, or Legend List for performant large list rendering.
|
|
10
|
+
|
|
11
|
+
## Quick Pattern
|
|
12
|
+
|
|
13
|
+
**Incorrect:**
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
<ScrollView>
|
|
17
|
+
{items.map((item) => <Item key={item.id} {...item} />)}
|
|
18
|
+
</ScrollView>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Correct:**
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<FlashList
|
|
25
|
+
data={items}
|
|
26
|
+
keyExtractor={(item) => item.id}
|
|
27
|
+
renderItem={({ item }) => <Item {...item} />}
|
|
28
|
+
// FlashList v1 only: add estimatedItemSize.
|
|
29
|
+
// FlashList v2+: do not add estimated sizing props.
|
|
30
|
+
/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## When to Use
|
|
34
|
+
|
|
35
|
+
- Rendering enough items that eager mounting affects FPS, memory, or startup
|
|
36
|
+
- List scrolling is choppy or laggy
|
|
37
|
+
- App freezes when loading list data
|
|
38
|
+
- Memory usage spikes with long lists
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
- `@shopify/flash-list` for FlashList on React Native New Architecture
|
|
43
|
+
- `@legendapp/list` for a JS/TypeScript list option without native dependencies
|
|
44
|
+
- Understanding of list virtualization
|
|
45
|
+
|
|
46
|
+
## Version Guardrail
|
|
47
|
+
|
|
48
|
+
- FlashList v1: `estimatedItemSize` is part of the optimization guidance.
|
|
49
|
+
- FlashList v2 and newer: `estimatedItemSize`, `estimatedListSize`, and `estimatedFirstItemOffset` are deprecated and no longer used. Do not flag them as missing.
|
|
50
|
+
- Before suggesting a FlashList fix, confirm the installed major version and tailor the advice. See [FlashList v2 changes](https://shopify.github.io/flash-list/docs/v2-changes/).
|
|
51
|
+
|
|
52
|
+
## Step-by-Step Instructions
|
|
53
|
+
|
|
54
|
+
### 1. Identify the Problem
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
// BAD: ScrollView renders ALL items at once
|
|
60
|
+
const BadList = ({ items }) => (
|
|
61
|
+
<ScrollView>
|
|
62
|
+
{items.map((item) => (
|
|
63
|
+
<View key={item.id}>
|
|
64
|
+
<Text>{item.title}</Text>
|
|
65
|
+
</View>
|
|
66
|
+
))}
|
|
67
|
+
</ScrollView>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Large eager lists mount every row immediately, increasing JS work, native view count, and memory before the user can interact.
|
|
72
|
+
|
|
73
|
+
### 2. Replace with FlatList
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
import { FlatList } from 'react-native';
|
|
77
|
+
|
|
78
|
+
const BetterList = ({ items }) => {
|
|
79
|
+
const renderItem = ({ item }) => (
|
|
80
|
+
<View>
|
|
81
|
+
<Text>{item.title}</Text>
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<FlatList
|
|
87
|
+
data={items}
|
|
88
|
+
renderItem={renderItem}
|
|
89
|
+
keyExtractor={(item) => item.id}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
FlatList only renders visible items + buffer (windowing).
|
|
96
|
+
|
|
97
|
+
### 3. Optimize FlatList with getItemLayout
|
|
98
|
+
|
|
99
|
+
For fixed-height items, skip layout measurement:
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
const ITEM_HEIGHT = 50;
|
|
103
|
+
|
|
104
|
+
const OptimizedList = ({ items }) => {
|
|
105
|
+
const renderItem = ({ item }) => (
|
|
106
|
+
<View style={{ height: ITEM_HEIGHT }}>
|
|
107
|
+
<Text>{item.title}</Text>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const getItemLayout = (_, index) => ({
|
|
112
|
+
length: ITEM_HEIGHT,
|
|
113
|
+
offset: ITEM_HEIGHT * index,
|
|
114
|
+
index,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<FlatList
|
|
119
|
+
data={items}
|
|
120
|
+
renderItem={renderItem}
|
|
121
|
+
keyExtractor={(item) => item.id}
|
|
122
|
+
getItemLayout={getItemLayout}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 4. Upgrade to FlashList
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm install @shopify/flash-list
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```jsx
|
|
135
|
+
import { FlashList } from '@shopify/flash-list';
|
|
136
|
+
|
|
137
|
+
const BestList = ({ items }) => {
|
|
138
|
+
const renderItem = ({ item }) => (
|
|
139
|
+
<View style={{ height: 50 }}>
|
|
140
|
+
<Text>{item.title}</Text>
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<FlashList
|
|
146
|
+
data={items}
|
|
147
|
+
renderItem={renderItem}
|
|
148
|
+
keyExtractor={(item) => item.id}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For FlashList v1, add `estimatedItemSize` with a realistic average item height. FlashList v2 requires React Native New Architecture and no longer needs size estimates; it computes sizing automatically. For old architecture apps, use FlashList v1 docs or evaluate Legend List.
|
|
155
|
+
|
|
156
|
+
**FlashList advantages:**
|
|
157
|
+
- Recycles views instead of creating new ones
|
|
158
|
+
- Often improves memory and scroll smoothness for large, complex lists
|
|
159
|
+
- Supports item-type-aware recycling with `getItemType`
|
|
160
|
+
|
|
161
|
+
### 5. Evaluate Legend List
|
|
162
|
+
|
|
163
|
+
Legend List is a JS/TypeScript list alternative with no native dependency. It supports dynamic item sizes, bidirectional infinite scrolling, chat-friendly bottom alignment, and optional recycling.
|
|
164
|
+
|
|
165
|
+
Enable `recycleItems` for long lists after confirming item components do not keep item-specific local state or side effects.
|
|
166
|
+
|
|
167
|
+
## Code Examples
|
|
168
|
+
|
|
169
|
+
### Mixed Item Types
|
|
170
|
+
|
|
171
|
+
```jsx
|
|
172
|
+
<FlashList
|
|
173
|
+
data={items}
|
|
174
|
+
renderItem={({ item }) => {
|
|
175
|
+
if (item.type === 'header') return <Header {...item} />;
|
|
176
|
+
if (item.type === 'product') return <Product {...item} />;
|
|
177
|
+
return <DefaultItem {...item} />;
|
|
178
|
+
}}
|
|
179
|
+
getItemType={(item) => item.type} // Helps recycling
|
|
180
|
+
/>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
If the project is still on FlashList v1, keep `estimatedItemSize` alongside `getItemType`.
|
|
184
|
+
|
|
185
|
+
### FlatList Optimizations (if not using FlashList)
|
|
186
|
+
|
|
187
|
+
```jsx
|
|
188
|
+
<FlatList
|
|
189
|
+
data={items}
|
|
190
|
+
renderItem={renderItem}
|
|
191
|
+
// Performance props
|
|
192
|
+
removeClippedSubviews={true}
|
|
193
|
+
maxToRenderPerBatch={10}
|
|
194
|
+
updateCellsBatchingPeriod={50}
|
|
195
|
+
initialNumToRender={10}
|
|
196
|
+
windowSize={5}
|
|
197
|
+
// Avoid re-renders
|
|
198
|
+
keyExtractor={(item) => item.id}
|
|
199
|
+
extraData={selectedId} // Only when selection changes
|
|
200
|
+
/>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Decision Matrix
|
|
204
|
+
|
|
205
|
+
| Scenario | Recommendation |
|
|
206
|
+
|----------|---------------|
|
|
207
|
+
| Small static content | ScrollView OK |
|
|
208
|
+
| Measured eager-mount or scroll cost | FlatList minimum |
|
|
209
|
+
| Large or complex list | FlashList or Legend List |
|
|
210
|
+
| Complex item layouts | FlashList with `getItemType`, or Legend List |
|
|
211
|
+
| Fixed height items | FlatList: `getItemLayout`; FlashList v1: `estimatedItemSize`; FlashList v2+: stable item structure |
|
|
212
|
+
|
|
213
|
+
## Common Pitfalls
|
|
214
|
+
|
|
215
|
+
- **Inline renderItem functions**: Causes re-renders. Define outside or use `useCallback`.
|
|
216
|
+
- **Missing keyExtractor**: Use unique IDs, not array index when possible.
|
|
217
|
+
- **Assuming all FlashList versions need `estimatedItemSize`**: FlashList v2 ignores it. Check the installed version before suggesting it.
|
|
218
|
+
- **Heavy item components**: Keep list items light. Move side effects out.
|
|
219
|
+
|
|
220
|
+
## Related Skills
|
|
221
|
+
|
|
222
|
+
- [js-profile-react.md](./js-profile-react.md) - Profile list rendering
|
|
223
|
+
- [js-measure-fps.md](./js-measure-fps.md) - Measure scroll performance
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Measure JS FPS
|
|
3
|
+
impact: HIGH
|
|
4
|
+
tags: fps, performance, monitoring, flashlight
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: Measure JS FPS
|
|
8
|
+
|
|
9
|
+
Monitor and measure JavaScript frame rate to quantify app smoothness and identify performance regressions.
|
|
10
|
+
|
|
11
|
+
## Quick Command
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Method 1: Built-in Perf Monitor
|
|
15
|
+
# Shake device → Dev Menu → "Perf Monitor"
|
|
16
|
+
|
|
17
|
+
# Method 2: Flashlight (Android, detailed reports)
|
|
18
|
+
# Install Flashlight from an official, verified release channel first.
|
|
19
|
+
flashlight measure
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## When to Use
|
|
23
|
+
|
|
24
|
+
- Animations feel choppy or janky
|
|
25
|
+
- Scrolling is not smooth
|
|
26
|
+
- Need baseline FPS metrics before/after optimization
|
|
27
|
+
- Want to compare performance across builds
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
- React Native app running on device/simulator
|
|
32
|
+
- For Flashlight: Android device (iOS not supported)
|
|
33
|
+
|
|
34
|
+
> **Note**: This skill involves visual output (FPS graphs, performance overlays). Use `agent-device` for runnable scenario evidence; install it through the environment's approved/trusted path or ask the user if verification needs it and it is missing. FPS graph interpretation may still require exported reports or human review. Record concrete FPS ranges, dropped-frame counts, device tier, and build type in text when asking an agent to reason about them.
|
|
35
|
+
|
|
36
|
+
## Step-by-Step Instructions
|
|
37
|
+
|
|
38
|
+
### Method 1: React Perf Monitor (Quick Check)
|
|
39
|
+
|
|
40
|
+
1. Open Dev Menu:
|
|
41
|
+
- iOS Simulator: `Ctrl + Cmd + Z` or Device > Shake
|
|
42
|
+
- Android Emulator: `Cmd + M` (Mac) / `Ctrl + M` (Windows)
|
|
43
|
+
|
|
44
|
+
2. Select **"Perf Monitor"**
|
|
45
|
+
|
|
46
|
+
3. Observe the overlay showing:
|
|
47
|
+
- **UI (Main) thread FPS** - Native rendering
|
|
48
|
+
- **JS thread FPS** - JavaScript execution
|
|
49
|
+
- **RAM usage**
|
|
50
|
+
|
|
51
|
+
4. Hide with "Hide Perf Monitor" from Dev Menu
|
|
52
|
+
|
|
53
|
+
**Interpretation:**
|
|
54
|
+
- **60 FPS** = Smooth (16.6ms per frame)
|
|
55
|
+
- **< 60 FPS** = Dropping frames
|
|
56
|
+
- **120 FPS** target for high refresh rate devices (8.3ms per frame)
|
|
57
|
+
|
|
58
|
+
### Method 2: Flashlight (Automated Benchmarking)
|
|
59
|
+
|
|
60
|
+
> Android only. Provides detailed reports and JSON export.
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
Flashlight shows comparative performance data:
|
|
65
|
+
- **Score** (0-100): Overall performance rating (higher is better)
|
|
66
|
+
- **Average FPS**: Target 60 FPS for smooth scrolling
|
|
67
|
+
- **FPS Graph**: Real-time frame rate over test duration
|
|
68
|
+
- **CPU/RAM metrics**: Resource consumption
|
|
69
|
+
|
|
70
|
+
The image shows FlatList (score: 3) vs FlashList (score: 67) - a dramatic difference visible in both the score and FPS graph.
|
|
71
|
+
|
|
72
|
+
**Installation:**
|
|
73
|
+
|
|
74
|
+
Install Flashlight from the vendor's official release channel before using it. Prefer a package manager or a version-pinned binary with checksum/signature verification. Do not pipe a remote install script directly into a shell.
|
|
75
|
+
|
|
76
|
+
**Usage:**
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Start measuring (app must be running on Android)
|
|
80
|
+
flashlight measure
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Features:**
|
|
84
|
+
- Real-time FPS graph
|
|
85
|
+
- Average FPS calculation
|
|
86
|
+
- CPU and RAM metrics
|
|
87
|
+
- Overall performance score
|
|
88
|
+
- JSON export for CI comparison
|
|
89
|
+
|
|
90
|
+
### Important: Disable Dev Mode
|
|
91
|
+
|
|
92
|
+
**Always disable development mode for accurate measurements:**
|
|
93
|
+
|
|
94
|
+
**Android:**
|
|
95
|
+
1. Open Dev Menu
|
|
96
|
+
2. Settings > JS Dev Mode → **OFF**
|
|
97
|
+
|
|
98
|
+
**iOS (React Native CLI):**
|
|
99
|
+
```bash
|
|
100
|
+
# Clear Metro cache if needed; this is not a production/release switch
|
|
101
|
+
npx react-native start --reset-cache
|
|
102
|
+
# Then run a Release scheme/build from Xcode or your CI
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Expo:**
|
|
106
|
+
```bash
|
|
107
|
+
# Start Metro without dev mode
|
|
108
|
+
npx expo start --no-dev --minify
|
|
109
|
+
# For accurate measurements, use EAS Build for release testing
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Code Examples
|
|
113
|
+
|
|
114
|
+
### Identify FPS Drop Source
|
|
115
|
+
|
|
116
|
+
If **UI FPS drops but JS FPS is fine:**
|
|
117
|
+
- Native rendering issue
|
|
118
|
+
- Too many views/complex layouts
|
|
119
|
+
- Heavy native animations
|
|
120
|
+
|
|
121
|
+
If **JS FPS drops but UI FPS is fine:**
|
|
122
|
+
- JavaScript computation blocking
|
|
123
|
+
- Expensive React re-renders
|
|
124
|
+
- Look for `longRunningFunction` patterns
|
|
125
|
+
|
|
126
|
+
If **Both drop:**
|
|
127
|
+
- Mixed issue, start with JS profiling
|
|
128
|
+
|
|
129
|
+
### Target Frame Budgets
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
// 60 FPS = 16.6ms per frame
|
|
133
|
+
const FRAME_BUDGET_60 = 16.6;
|
|
134
|
+
|
|
135
|
+
// 120 FPS = 8.3ms per frame
|
|
136
|
+
const FRAME_BUDGET_120 = 8.3;
|
|
137
|
+
|
|
138
|
+
// If your function takes longer, it will drop frames
|
|
139
|
+
const longRunningFunction = () => {
|
|
140
|
+
let i = 0;
|
|
141
|
+
while (i < 1000000000) { // This blocks for seconds!
|
|
142
|
+
i++;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Interpreting Results
|
|
148
|
+
|
|
149
|
+
| FPS Range | User Perception | Action |
|
|
150
|
+
|-----------|-----------------|--------|
|
|
151
|
+
| 55-60 | Smooth | Acceptable |
|
|
152
|
+
| 45-55 | Slight stutter | Investigate |
|
|
153
|
+
| 30-45 | Noticeable jank | Optimize required |
|
|
154
|
+
| < 30 | Very choppy | Critical fix needed |
|
|
155
|
+
|
|
156
|
+
## Flashlight CI Integration
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Export measurements to JSON
|
|
160
|
+
flashlight measure --output results.json
|
|
161
|
+
|
|
162
|
+
# Compare builds
|
|
163
|
+
flashlight compare baseline.json current.json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Common Pitfalls
|
|
167
|
+
|
|
168
|
+
- **Measuring in dev mode**: Results will be artificially slow
|
|
169
|
+
- **Not using real device**: Simulators don't reflect real performance
|
|
170
|
+
- **Ignoring UI thread**: React Native has two threads - JS issues don't always show on UI thread
|
|
171
|
+
- **Single measurement**: Run multiple times, FPS varies
|
|
172
|
+
|
|
173
|
+
## Related Skills
|
|
174
|
+
|
|
175
|
+
- [js-profile-react.md](./js-profile-react.md) - Find what's causing FPS drops
|
|
176
|
+
- [js-animations-reanimated.md](./js-animations-reanimated.md) - Fix animation-related drops
|
|
177
|
+
- [js-bottomsheet.md](./js-bottomsheet.md) - Measure bottom sheet gesture and snap performance
|
|
178
|
+
- [js-lists-flatlist-flashlist.md](./js-lists-flatlist-flashlist.md) - Fix scroll-related drops
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hunt JS Memory Leaks
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
tags: memory, leaks, profiling, cleanup
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: Hunt JS Memory Leaks
|
|
8
|
+
|
|
9
|
+
Find and fix JavaScript memory leaks using the React Native DevTools Memory tab, with `agent-device react-devtools` for related component context.
|
|
10
|
+
|
|
11
|
+
## Quick Pattern
|
|
12
|
+
|
|
13
|
+
**Incorrect (listener not cleaned up):**
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const sub = EventEmitter.addListener('event', handler);
|
|
18
|
+
// Missing cleanup!
|
|
19
|
+
}, []);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Correct (proper cleanup):**
|
|
23
|
+
|
|
24
|
+
```jsx
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const sub = EventEmitter.addListener('event', handler);
|
|
27
|
+
return () => sub.remove();
|
|
28
|
+
}, []);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## When to Use
|
|
32
|
+
|
|
33
|
+
- App memory usage grows over time
|
|
34
|
+
- App crashes after extended use
|
|
35
|
+
- Navigating between screens increases memory
|
|
36
|
+
- Suspecting event listeners or timers not cleaned up
|
|
37
|
+
|
|
38
|
+
## Prerequisites
|
|
39
|
+
|
|
40
|
+
- React Native DevTools Memory tab or exported memory profile available
|
|
41
|
+
- `agent-device react-devtools` for related component ownership/render debugging
|
|
42
|
+
- App running in development mode
|
|
43
|
+
|
|
44
|
+
## Step-by-Step Instructions
|
|
45
|
+
|
|
46
|
+
React Native DevTools supports heap snapshots, allocation instrumentation on timeline, and allocation sampling. Use allocation timeline to isolate leaks; use allocation sampling for lower-overhead long-running allocation profiling. Use `agent-device react-devtools` when you need token-efficient component tree, props, state, hooks, ownership, or render-cause context while investigating the leak.
|
|
47
|
+
|
|
48
|
+
`agent-device react-devtools` does not replace the Memory tab. Use it only for related component context; heap snapshots and allocation timelines require the React Native DevTools Memory UI or an exported memory profile.
|
|
49
|
+
|
|
50
|
+
### 1. Open Memory Profiler
|
|
51
|
+
|
|
52
|
+
1. Open the React Native DevTools Memory tab or load an exported memory profile
|
|
53
|
+
2. Select **"Allocation instrumentation on timeline"**
|
|
54
|
+
|
|
55
|
+
### 2. Record Memory Allocations
|
|
56
|
+
|
|
57
|
+
1. Click **"Start"** at the bottom
|
|
58
|
+
2. Perform actions that might leak (navigate, trigger events, etc.)
|
|
59
|
+
3. Wait 10-30 seconds
|
|
60
|
+
4. Click **"Stop"**
|
|
61
|
+
|
|
62
|
+
### 3. Analyze the Timeline
|
|
63
|
+
|
|
64
|
+
**Key indicators:**
|
|
65
|
+
- **Blue bars** = Memory allocated
|
|
66
|
+
- **Gray bars** = Memory freed (garbage collected)
|
|
67
|
+
- **Blue bars that stay blue** = Potential leak!
|
|
68
|
+
|
|
69
|
+
### 4. Investigate Leaking Objects
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+
The Memory tab shows:
|
|
74
|
+
- **Timeline** (top): Blue bars = allocations, select time range to filter
|
|
75
|
+
- **Summary view** (bottom): Lists constructors with allocation counts
|
|
76
|
+
|
|
77
|
+
**Key columns:**
|
|
78
|
+
- **Constructor**: Object type (e.g., `JSObject`, `Function`, `(string)`)
|
|
79
|
+
- **Count**: Number of instances
|
|
80
|
+
- **Shallow Size**: Memory of the object itself
|
|
81
|
+
- **Retained Size**: Memory freed if object is deleted (including references)
|
|
82
|
+
|
|
83
|
+
**Red flag**: Large retained size % with small shallow size % = closures or references holding large objects.
|
|
84
|
+
|
|
85
|
+
**To investigate:**
|
|
86
|
+
1. Click on a blue spike in the timeline
|
|
87
|
+
2. Look at the Constructor list below
|
|
88
|
+
3. Check **Shallow size** vs **Retained size**
|
|
89
|
+
4. Expand constructors to see individual allocations
|
|
90
|
+
5. Click to see the exact source location
|
|
91
|
+
|
|
92
|
+
### 5. Verify the Fix
|
|
93
|
+
|
|
94
|
+
After fixing, re-profile the same flow. Memory should return to a stable baseline after GC and repeated interactions; some recent allocations can remain live legitimately.
|
|
95
|
+
|
|
96
|
+
## Code Examples
|
|
97
|
+
|
|
98
|
+
### Common Leak Patterns
|
|
99
|
+
|
|
100
|
+
**1. Listeners Not Cleaned Up:**
|
|
101
|
+
|
|
102
|
+
```jsx
|
|
103
|
+
// BAD: Memory leak
|
|
104
|
+
const BadEventComponent = () => {
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const subscription = EventEmitter.addListener('myEvent', handleEvent);
|
|
107
|
+
// Missing cleanup!
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
return <Text>Listening...</Text>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// GOOD: Proper cleanup
|
|
114
|
+
const GoodEventComponent = () => {
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const subscription = EventEmitter.addListener('myEvent', handleEvent);
|
|
117
|
+
return () => subscription.remove(); // Cleanup!
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
return <Text>Listening...</Text>;
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**2. Timers Not Cleared:**
|
|
125
|
+
|
|
126
|
+
```jsx
|
|
127
|
+
// BAD: Memory leak
|
|
128
|
+
const BadTimerComponent = () => {
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const timer = setInterval(() => {
|
|
131
|
+
setCount(prev => prev + 1);
|
|
132
|
+
}, 1000);
|
|
133
|
+
// Missing cleanup!
|
|
134
|
+
}, []);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// GOOD: Proper cleanup
|
|
138
|
+
const GoodTimerComponent = () => {
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
const timer = setInterval(() => {
|
|
141
|
+
setCount(prev => prev + 1);
|
|
142
|
+
}, 1000);
|
|
143
|
+
return () => clearInterval(timer); // Cleanup!
|
|
144
|
+
}, []);
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Other common sources are closures that retain large objects and module-level arrays/maps that only grow. Confirm these through retained-size paths before refactoring them.
|
|
149
|
+
|
|
150
|
+
## Memory Profiler Metrics
|
|
151
|
+
|
|
152
|
+
| Metric | Meaning |
|
|
153
|
+
|--------|---------|
|
|
154
|
+
| **Shallow size** | Memory held by the object itself |
|
|
155
|
+
| **Retained size** | Memory freed if object is deleted (includes references) |
|
|
156
|
+
|
|
157
|
+
**Large retained size with small shallow size** = Object holding references to other large objects (common in closures).
|
|
158
|
+
|
|
159
|
+
## Common Pitfalls
|
|
160
|
+
|
|
161
|
+
- **Not forcing GC**: GC runs periodically. Allocate something else to trigger collection before concluding there's a leak.
|
|
162
|
+
- **Over-reading allocation colors**: Persisting allocations are suspects, not proof. Confirm with retained objects and repeated flows.
|
|
163
|
+
- **Missing useEffect cleanup**: Most common React Native leak source.
|
|
164
|
+
|
|
165
|
+
## Related Skills
|
|
166
|
+
|
|
167
|
+
- [native-memory-leaks.md](./native-memory-leaks.md) - Native-side memory leaks
|
|
168
|
+
- [js-profile-react.md](./js-profile-react.md) - General profiling
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Profile React Performance
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
tags: profiling, devtools, re-renders, flamegraph
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: Profile React Performance
|
|
8
|
+
|
|
9
|
+
Identify unnecessary re-renders and performance bottlenecks in React Native apps using React Native DevTools through `agent-device react-devtools`.
|
|
10
|
+
|
|
11
|
+
## Quick Command
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
agent-device react-devtools status
|
|
15
|
+
agent-device react-devtools wait --connected
|
|
16
|
+
agent-device react-devtools profile start
|
|
17
|
+
agent-device react-devtools profile stop
|
|
18
|
+
agent-device react-devtools profile slow --limit 5
|
|
19
|
+
agent-device react-devtools profile rerenders --limit 5
|
|
20
|
+
agent-device react-devtools profile timeline --limit 20
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Drive the target interaction with normal `agent-device` commands between `profile start` and `profile stop`. For targeted audits, profile the exact flow under review. Baseline output should include commit timeline, re-render counts, slow components, and a breakdown of the heaviest commit.
|
|
24
|
+
|
|
25
|
+
## When to Use
|
|
26
|
+
|
|
27
|
+
- App feels sluggish or janky during interactions
|
|
28
|
+
- Need to identify which components re-render unnecessarily
|
|
29
|
+
- Investigating slow list scrolling or form inputs
|
|
30
|
+
- Before applying memoization or state management changes
|
|
31
|
+
|
|
32
|
+
## Prerequisites
|
|
33
|
+
|
|
34
|
+
- React Native DevTools connection available through `agent-device react-devtools`
|
|
35
|
+
- App running in development mode
|
|
36
|
+
- React DevTools version compatible with the app's React and React Native versions
|
|
37
|
+
- For release-build profiling, [`@callstack/inspector`](https://github.com/callstackincubator/inspector#inspector) installed and connected first
|
|
38
|
+
|
|
39
|
+
> **Note**: Prefer `agent-device react-devtools` over the visual DevTools UI for token-efficient React profiling and debugging. Use the visual UI or exported profiler JSON only when the CLI output is insufficient. Record concrete commit times, render counts, and component names.
|
|
40
|
+
|
|
41
|
+
Manual fallback when `agent-device` is unavailable: open React Native DevTools from Metro (`j`) or the Dev Menu, use the Profiler tab, and record the same interaction. Keep this as fallback only; agent runs should prefer the CLI summaries above.
|
|
42
|
+
|
|
43
|
+
## Step-by-Step Instructions
|
|
44
|
+
|
|
45
|
+
### 1. Connect React Native DevTools
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
agent-device react-devtools status
|
|
49
|
+
agent-device react-devtools wait --connected
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If `status` reports the helper is not running, start it first:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
agent-device react-devtools start
|
|
56
|
+
agent-device react-devtools wait --connected
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Release Builds
|
|
60
|
+
|
|
61
|
+
React Native release builds do not expose the same profiling path by default. Before using `agent-device react-devtools` against a release app, wire in `@callstack/inspector`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install @callstack/inspector
|
|
65
|
+
npx inspector start
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Import `@callstack/inspector` as the first module in the app entrypoint, wrap Metro config with `withInspector(config, true)`, then build and run the app in release mode. For Expo, use a release build from prebuild/dev-client flow; Expo Go is not a release-build profiling target.
|
|
69
|
+
|
|
70
|
+
### 2. Record a Profiling Session
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
agent-device react-devtools profile start
|
|
74
|
+
agent-device react-devtools profile stop
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Drive the exact interaction or navigation flow under review between those two commands.
|
|
78
|
+
|
|
79
|
+
For AI-agent workflows, treat this as a required sequence:
|
|
80
|
+
|
|
81
|
+
1. Run `agent-device react-devtools status`.
|
|
82
|
+
2. Run `agent-device react-devtools wait --connected`.
|
|
83
|
+
3. Start profiling immediately before the audited interaction.
|
|
84
|
+
4. Drive the flow with normal `agent-device` commands.
|
|
85
|
+
5. Stop profiling.
|
|
86
|
+
6. Inspect slow components, re-render counts, and commit timing before proposing fixes.
|
|
87
|
+
|
|
88
|
+
### 3. Analyze Results
|
|
89
|
+
|
|
90
|
+

|
|
91
|
+
|
|
92
|
+
Use bounded CLI summaries first:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
agent-device react-devtools profile slow --limit 5
|
|
96
|
+
agent-device react-devtools profile rerenders --limit 5
|
|
97
|
+
agent-device react-devtools profile timeline --limit 20
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Then drill into a specific component:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
agent-device react-devtools profile report @c5
|
|
104
|
+
agent-device react-devtools get component @c5
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Use the component ref printed by `profile slow`, `profile rerenders`, or `get tree`; `@c5` is only an example.
|
|
108
|
+
|
|
109
|
+
Use the visual flame graph or exported profiler JSON only when the bounded CLI summaries do not answer the question.
|
|
110
|
+
|
|
111
|
+
### 4. Profile JavaScript CPU
|
|
112
|
+
|
|
113
|
+
For non-React CPU issues, use platform CPU profilers or `agent-device perf` instead of React DevTools render profiling.
|
|
114
|
+
|
|
115
|
+
## Interpreting Results
|
|
116
|
+
|
|
117
|
+
| Symptom | Likely Cause | Solution |
|
|
118
|
+
|---------|--------------|----------|
|
|
119
|
+
| Many yellow components | Cascading re-renders | Add memoization or use React Compiler |
|
|
120
|
+
| "Props changed" on callbacks | Inline functions recreated | Use `useCallback` |
|
|
121
|
+
| "Parent component rendered" | State too high in tree | Move state down or use atomic state |
|
|
122
|
+
| Long JS thread block | Heavy computation | Move to background or use `useDeferredValue` |
|
|
123
|
+
|
|
124
|
+
Only propose callback or dependency-array changes when the profiler or a reproducible bug shows they matter. Do not infer stale closures from a snippet alone.
|
|
125
|
+
|
|
126
|
+
## Common Pitfalls
|
|
127
|
+
|
|
128
|
+
- **Using one build type for every question**: Use `agent-device react-devtools` in development to identify render causes, commit patterns, and expensive components. Validate timing-sensitive FPS/CPU improvements in production or release-like builds.
|
|
129
|
+
- **Not using production builds**: Some issues only appear with minified code
|
|
130
|
+
- **Ignoring "Why did this render?"**: This tells you exactly what to fix
|
|
131
|
+
- **Using component tree depth or count as the main baseline**: These are secondary context, not the core performance signal
|
|
132
|
+
|
|
133
|
+
## Related Skills
|
|
134
|
+
|
|
135
|
+
- [js-react-compiler.md](./js-react-compiler.md) - Automatic memoization
|
|
136
|
+
- [js-atomic-state.md](./js-atomic-state.md) - Reduce re-renders with Jotai/Zustand
|
|
137
|
+
- [js-bottomsheet.md](./js-bottomsheet.md) - Profile bottom sheet callback-driven re-renders
|
|
138
|
+
- [js-measure-fps.md](./js-measure-fps.md) - Quantify frame rate impact
|