Skip to content

fix: don't assume react-native ViewProps declares onFocusCapture, gate check:types in CI - #118

Merged
RuudBurger merged 2 commits into
mainfrom
fix/view-focus-capture-optional-rn-prop
Aug 17, 2026
Merged

fix: don't assume react-native ViewProps declares onFocusCapture, gate check:types in CI#118
RuudBurger merged 2 commits into
mainfrom
fix/view-focus-capture-optional-rn-prop

Conversation

@RuudBurger

@RuudBurger RuudBurger commented Aug 17, 2026

Copy link
Copy Markdown
Member

Merging #117 left main failing check:types, which blocks the release job: the changesets action can't push changeset-release/main because the husky pre-push hook runs check:types and it exits 2. No version PR got created and nothing published.

../react-native-lightning/src/exports/View.tsx(31,19): error TS2339:
  Property 'onFocusCapture' does not exist on type 'ViewProps'
Failed: @plextv/react-native-lightning-components#check:types
husky - pre-push script failed (code 2)

The cause: View's CombinedProps reads RNViewProps['onFocusCapture']. react-native-tvos declares that prop on ViewProps (Libraries/Types/CoreEventTypes.d.ts), plain react-native doesn't. The change was written and typechecked against the Plex client, which aliases react-native to react-native-tvos, so it compiled there and not here.

Reads the prop only when it's present. Generic, so the indexed access stays deferred (a non-generic conditional doesn't narrow it and fails with TS2538 instead):

type FocusCaptureOf<P> = 'onFocusCapture' extends keyof P
  ? P['onFocusCapture']
  : never;

Both forks typecheck, and consumers on tvos keep the handler type they had.

Second commit closes the hole that let this through: PR CI ran lint + test but not check:types, so a type error couldn't fail a PR — it only surfaced later as a failed push inside the release job, reading as a git error rather than a type error. check:types now runs on pull requests, and this PR is the first run to exercise it (13/13 packages, ~23s).

Verified against a real install of this repo, not just in the abstract: check:types 13/13, lint 0 errors, test 728 passing across 62 files.

@RuudBurger
RuudBurger force-pushed the fix/view-focus-capture-optional-rn-prop branch from 0832128 to cb9dd2c Compare August 17, 2026 13:20
@RuudBurger
RuudBurger requested a review from DouweBos August 17, 2026 13:27
@RuudBurger RuudBurger changed the title fix: don't assume react-native ViewProps declares onFocusCapture fix: don't assume react-native ViewProps declares onFocusCapture, gate check:types in CI Aug 17, 2026
@RuudBurger
RuudBurger merged commit 765c1c7 into main Aug 17, 2026
2 checks passed
@RuudBurger
RuudBurger deleted the fix/view-focus-capture-optional-rn-prop branch August 17, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants