From cb9dd2cbb56b6f80c9196532e7616d41ceb3d0a6 Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 17 Aug 2026 15:17:32 +0200 Subject: [PATCH 1/2] fix(vendor): don't assume react-native ViewProps declares onFocusCapture --- .changeset/view-focus-capture-optional-rn-prop.md | 5 +++++ packages/react-native-lightning/src/exports/View.tsx | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/view-focus-capture-optional-rn-prop.md diff --git a/.changeset/view-focus-capture-optional-rn-prop.md b/.changeset/view-focus-capture-optional-rn-prop.md new file mode 100644 index 0000000..dd9f998 --- /dev/null +++ b/.changeset/view-focus-capture-optional-rn-prop.md @@ -0,0 +1,5 @@ +--- +'@plextv/react-native-lightning': patch +--- + +`View`'s `onFocusCapture` type no longer assumes `react-native`'s `ViewProps` declares the prop. react-native-tvos has it, plain react-native doesn't, so the indexed access was a hard `check:types` error for anyone on upstream react-native. Reads the prop only when it's actually present, so both forks typecheck. diff --git a/packages/react-native-lightning/src/exports/View.tsx b/packages/react-native-lightning/src/exports/View.tsx index 19ddde3..b1905b4 100644 --- a/packages/react-native-lightning/src/exports/View.tsx +++ b/packages/react-native-lightning/src/exports/View.tsx @@ -16,6 +16,12 @@ import { useLayoutHandler } from '../hooks/useLayoutHandler'; import type { NativeLightningViewElement } from '../types/NativeLightningViewElement'; import { isFocusActive, shouldRegisterFocus } from './focusableView'; +// react-native-tvos declares onFocusCapture on ViewProps, plain react-native +// doesn't. Generic so the indexed access stays deferred and compiles on both. +type FocusCaptureOf

= 'onFocusCapture' extends keyof P + ? P['onFocusCapture'] + : never; + type CombinedProps = Omit< RNViewProps & LightningViewElementProps & @@ -28,7 +34,7 @@ type CombinedProps = Omit< // intersecting them yields a signature no handler can satisfy. Accept either. onFocusCapture?: | FocusableProps['onFocusCapture'] - | RNViewProps['onFocusCapture']; + | FocusCaptureOf; // Directional-only focus catcher: reachable by a deliberate move but never // by restoration or the mount-time default (drawer edge guard). focusRestorationExcluded?: boolean; From 4e0d2e4230d3e7b84066b2946d66ba63b026f91a Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 17 Aug 2026 15:31:34 +0200 Subject: [PATCH 2/2] ci: run check:types on pull requests --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3308b8a..7427261 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,5 +34,8 @@ jobs: - name: Lint run: pnpm run lint + - name: Check types + run: pnpm run check:types + - name: Run unit tests run: pnpm run test