Community程式設計與開發github.com

React Native TV 最佳實務

審查 React Native TV 應用程式的焦點/D-pad 導航、10 英尺 UI 佈局、電視播放/DRM 整合、低記憶體電視效能以及電視無障礙性。在針對 react-native-tvos、Expo TV、Amazon Vega/Kepler 或 React Native Web TV 平台進行建置、除錯或審查,且問題涉及遙控器輸入、電視焦點、電視打包、電視硬體或電視播放限制時使用。

React Native TV 最佳實務 是什麼?

此技能為針對 Apple TV、Android TV、Fire TV、Amazon Vega/Kepler 以及基於網路的電視目標(如 Tizen 或 webOS)的 React Native 應用程式,提供電視專屬的審查指南。它專注於與一般 React Native 開發不同的電視專屬領域,包括遙控器/D-pad 輸入、焦點引擎、10 英尺 UI 佈局、平台打包、播放/DRM、低記憶體電視硬體以及電視無障礙性。技能內容組織成多個參考檔案,涵蓋從焦點管理、導航模式到效能最佳化、影片串流和無障礙性稽核等主題。它支援多種電視開發堆疊,並幫助開發者透過檢測目標堆疊(react-native-tvos、Expo TV、Amazon Vega/Kepler 或基於網路的電視),避免設定建議上的誤判。此技能對於處理電視應用程式中常見的導覽錯誤、效能瓶頸(尤其是在清單和動畫方面)、播放問題以及無障礙性問題至關重要。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/callstackincubator/agent-skills/tree/main/skills/react-native-tv-best-practices

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

React Native TV 最佳實務 是做什麼的?

概述

針對 Apple TV、Android TV、Fire TV、Amazon Vega/Kepler 以及 Tizen 或 webOS 等基於網路的電視目標,提供 React Native 應用程式的電視專屬審查指南。

僅在涉及電視差異時使用此技能:遙控器輸入、焦點引擎、10 英尺佈局、平台打包、播放/DRM、低記憶體電視硬體以及電視無障礙性。對於一般的 React Native 效能或架構問題,請使用 react-native-best-practices。

技能格式

參考檔案按主題前綴分組:

  • focus-*:焦點引擎、焦點引導、焦點事件效能
  • nav-*:D-pad 導航、返回/選單行為、鍵盤/搜尋輸入
  • design-*:10 英尺字體排印、佈局、色彩、焦點可見性
  • perf-*:啟動、記憶體、列表、動畫以及電視硬體的網路限制
  • video-*:播放架構、DRM/協定選擇、除錯
  • a11y-*:電視無障礙性實作與稽核檢查
  • setup-*:堆疊檢測、設定、架構、跨平台行為
  • test-* 和 release-*:測試涵蓋率、端到端測試以及 CI/發布工作流程

何時套用

當應用程式目標為電視平台,且工作涉及以下項目時,套用此技能:

  • 焦點移動、可見焦點、焦點還原或遙控器/D-pad 輸入
  • 電視佈局可讀性、過掃描/安全區域或 10 英尺 UI 密度
  • 電視播放器控制、資訊清單、DRM、解碼器支援或播放錯誤
  • 低記憶體電視硬體的效能(特別是影片或大型輪播)
  • 使用螢幕閱讀器、字幕、焦點順序或僅限遙控器互動的電視無障礙性
  • react-native-tvos、Expo TV、Amazon Vega/Kepler、Tizen 或 webOS 的平台設定

開始之前 — 識別電視堆疊

此技能涵蓋多種電視堆疊。在標記設定問題之前,請先檢測應用程式目標是哪個堆疊——在 Vega/Kepler 或基於網路的電視應用程式上要求 react-native-tvos、tvOS Podfile 或 Android TV 資訊清單,將導致誤判。

堆疊如何檢測設定期望
react-native-tvos (Apple TV, Android TV, Fire TV)"react-native": "npm:react-native-tvos@…" 在 package.json 中tvOS Podfile (platform :tvos);Android TV leanback/LEANBACK_LAUNCHER 資訊清單條目;電視模擬器
Expo + react-native-tvos上述條件 加上 @react-native-tvos/config-tv 在 app.json 中EXPO_TV=1 prebuild;react-native-tvos 版本必須與 Expo SDK 匹配;並非所有 Expo 功能/函式庫在電視上都可用
Amazon Vega / KeplerVega/Kepler SDK 與工具(@amazon-devices/* 依賴項、Kepler 資訊清單);無 react-native-tvosAmazon 的 Vega/Kepler 工具鏈——react-native-tvos、tvOS Podfile 和 Android TV 資訊清單不適用
基於網路的電視 (Tizen, webOS)網頁打包工具 (Rsbuild/webpack) + 平台打包;空間導航函式庫平台 SDK 打包;@noriginmedia/norigin-spatial-navigation 用於焦點

焦點、10 英尺設計、效能、無障礙性和播放器指南適用於所有這些堆疊——只有設定/建置期望是堆疊特定的。

審查規則

  • 在提出設定建議之前,先確定目標堆疊。
  • 優先使用自然的焦點順序和焦點引導,而不是命令式的焦點呼叫或廣泛的 nextFocus* 對應。
  • 將焦點遺失、焦點不可見以及損壞的返回/選單行為視為導航錯誤。
  • 在調整視覺細節之前,先在電視距離下檢查可讀性、安全區域和焦點狀態。
  • 在回報效能修復完成之前,先在支援度最弱的電視裝置上進行效能剖析。
  • 按層次區分播放失敗:資訊清單請求、DRM 授權交換、解碼器能力、播放器狀態和 React UI 控制。

優先級指南

優先級分類影響前綴
1焦點和 D-pad 導航嚴重focus-*, nav-*
2列表、動畫和輸入效能嚴重perf-*
3播放和 DRM 失敗高video-*
410 英尺可讀性和佈局高design-*
5電視無障礙性高a11y-*
6堆疊設定、測試和發布中setup-*, test-*, release-*

快速參考

  1. 從套件檔案、資訊清單、原生資料夾和平台工具中檢測電視堆疊。
  2. 使用遙控器或 D-pad 路徑重現導航,而不是滑鼠/觸控假設。
  3. 確認聚焦的元素始終可見、可到達,並且在模態框/路由之後還原。
  4. 在更改 React 控制之前,從網路/DRM 層向上檢查播放失敗。
  5. 在最弱的支援電視目標上測量列表、動畫、記憶體和啟動工作。

參考資料

焦點與導航

檔案影響描述
focus-management.md嚴重焦點引擎、焦點引導、nextFocus* 和焦點還原
focus-performance.md嚴重避免焦點事件處理導致的影格遺失
nav-directional.md嚴重跨電視平台的定向導航規則
nav-patterns.md嚴重全局/局部導航、模態框、分頁和返回行為
nav-keyboard.md中使用遙控器進行搜尋和文字輸入

設計

檔案影響描述
design-10foot.md高10 英尺審查啟發式
design-typography.md高電視字型大小與可讀性
design-layout.md高安全區域、間距、輪播和焦點空間
design-color.md中對比度與電視顯示色彩限制

效能

檔案影響描述
perf-overview.md高電視效能目標與剖析順序
perf-lists.md嚴重虛擬化行與大量海報的列表
perf-animations.md嚴重焦點與轉場動畫效能
perf-memory.md高低記憶體電視當機與圖片/影片壓力
perf-network.md高遙控器輸入、請求停滯與網路韌性

影片、無障礙性、設定、測試

檔案影響描述
video-streaming.md高電視平台協定/DRM 選擇
video-players.md高播放器選擇與自訂控制
video-debugging.md高資訊清單、DRM、編解碼器與播放除錯
a11y-overview.md中電視專屬的無障礙性差異
a11y-implementation.md高可存取的標籤、角色、即時區域與焦點
a11y-checklist.md中啟動無障礙性稽核清單
setup-getting-started.md中react-native-tvos 和 Expo TV 設定
setup-cross-platform.md中平台檢測與跨平台注意事項
setup-architecture.md中程式碼共享與專案結構
test-strategy.md中電視測試範圍與涵蓋率劃分
test-javascript.md中JS 層級的遙控器/焦點測試輔助工具
test-e2e.md中Appium 與電視端到端涵蓋率
release-cicd.md中CI、建置指紋辨識與發布檢查

問題 → 技能對應

症狀從此處開始
"焦點跳到錯誤的元素"focus-management.md → 除錯部分
"滾動列表時應用程式凍結"perf-lists.md → 虛擬化
"Fire TV 上動畫卡頓"perf-animations.md → Native driver
"電視上的文字太小"design-typography.md → 最小尺寸
"影片無法播放 / DRM 錯誤"video-streaming.md → DRM 部分
"螢幕閱讀器跳過元素"a11y-implementation.md → 角色與標籤
"返回按鈕運作不正常"nav-patterns.md → 返回導航
"鍵盤覆蓋內容"nav-keyboard.md → 內建 vs 自訂
"應用程式啟動超慢"perf-overview.md → 啟動時間
"圖片導致記憶體當機"perf-memory.md → 圖片最佳化
"CI 管線耗費數小時"release-cicd.md → 指紋辨識
"如何跨平台共享程式碼"setup-architecture.md → 程式碼共享

安全性(電視專屬)

一般的依賴項/輸入衛生規範適用於任何 RN 應用程式;值得特別指出的電視專屬差異如下:

  • 絕對不要將 FairPlay/Widevine/PlayReady 金鑰嵌入用戶端程式碼中——將授權伺服器視為信任邊界,並讓 DRM 權杖由伺服器發放。

Individual skills in this repo

This repo contains 15 individual skills — each has its own dedicated page.

agent-device

Automates interactions for Apple-platform apps (iOS, tvOS, macOS) and Android devices. Use when navigating apps, taking snapshots/screenshots, tapping, typing, scrolling, or extracting UI info across mobile, TV, and desktop targets.

assess-react-native-migration

Assesses whether and how an existing mobile product should migrate to React Native. Use when auditing one or more product repositories for migration readiness, including products whose iOS, Android, and other clients live in separate directories or repositories; choosing brownfield, greenfield, or a checkpoint-based path; defining a representative trial; or preparing a baseline and ROI decision before implementation. When product scope or material evidence is unavailable, grills the stakeholder with exactly one question per turn instead of sending a questionnaire.

callstackincubator/github

GitHub patterns using gh CLI for pull requests, stacked PRs, code review, branching strategies, and repository automation. Use when working with GitHub PRs, merging strategies, or repository management tasks.

callstackincubator/validate-skills

Validates skills in this repo against agentskills.io spec and Claude Code best practices. Use via /validate-skills command.

create-react-native-library

Scaffolds React Native libraries with create-react-native-library for standalone libraries or local native modules and views. Use when creating or working on React Native libraries or adding native functionality in an existing app.

dogfood

Systematically explore and test a mobile app on iOS/Android with agent-device to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", or "test this app" on mobile. Produces a structured report with reproducible evidence: screenshots, optional repro videos, and detailed steps for every issue.

github-actions

GitHub Actions workflow patterns for React Native iOS simulator and Android emulator cloud builds with downloadable artifacts. Use when setting up CI build pipelines or downloading GitHub Actions artifacts via gh CLI and GitHub API.

react-native-best-practices

Provides React Native performance optimization guidelines for FPS, TTI, bundle size, memory leaks, re-renders, and animations. Applies to tasks involving Hermes optimization, JS thread blocking, bridge overhead, FlashList, native modules, or debugging jank and frame drops.

react-native-brownfield-migration

Implements an accepted incremental brownfield migration from native iOS or Android to React Native or Expo using @callstack/react-native-brownfield. Use after the brownfield path has been selected, when setting up the integration, packaging XCFramework or AAR artifacts, or adding React Native surfaces to native hosts.

react-native-testing

Write tests using React Native Testing Library (RNTL) v13 and v14 (`@testing-library/react-native`). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React 18, sync render) and v14 (React 19+, async render). Triggers on: test files for React Native components, RNTL imports, mentions of "testing library", "write tests", "component tests", or "RNTL".

react-navigation

Provides React Navigation UI patterns for stacks, tabs, drawers etc. Use when building navigation UIs with React Navigation, configuring headers, bottom sheets or handling safe areas and insets.

upgrading-react-native

Upgrades React Native apps to newer versions by applying rn-diff-purge template diffs, updating package.json dependencies, migrating native iOS and Android configuration, resolving CocoaPods and Gradle changes, and handling breaking API updates. Use when upgrading React Native, bumping RN version, updating from RN 0.x to 0.y, or migrating Expo SDK alongside a React Native upgrade.

validate-skills

Validates skills in this repo against agentskills.io spec and Claude Code best practices. Use via /validate-skills command.

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

writing-user-docs

House style for user-facing documentation — voice, scope, structure, and what to leave out. Use this skill whenever writing, editing, or reviewing anything a user reads to learn how to use a tool — help center articles, getting-started guides, tutorials, feature docs, README usage sections, in-app help, release notes, or FAQ entries. Trigger it even when the request is phrased plainly — "document this feature", "write docs for X", "explain this to users", "write a README for this library", "turn these notes into a guide" — and even when no style guidelines are mentioned. Also use it to review existing docs for tone, bloat, or leaked implementation detail. Do not use it for internal engineering docs, architecture write-ups, RFCs, or code comments.

相關技能