Skip to content

Update types to respect Strict TS API#4319

Merged
m-bert merged 2 commits into
mainfrom
@mbert/typeeeees
Jul 20, 2026
Merged

Update types to respect Strict TS API#4319
m-bert merged 2 commits into
mainfrom
@mbert/typeeeees

Conversation

@m-bert

@m-bert m-bert commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Since React Native 0.87, Strict TS API is enabled by default . This PR brings necessary changes to resolve ts-errors on 0.87.

This PR also removes cursor: undefined; from iOS, but now it is a valid prop - this workaround was necessary on old arch

Test plan

yarn ts-check

Copilot AI review requested due to automatic review settings July 17, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates RNGH’s TypeScript types to align with React Native 0.87’s “Strict TS API” (enabled by default), reducing/avoiding TS errors while keeping runtime behavior unchanged.

Changes:

  • Adjusted event/detector component typings (e.g., Animated mapping shape, detector component unions, and animated wrapper typings).
  • Updated various ref-related types to use React.ComponentRef<typeof ...> where RN’s strict types require it.
  • Migrated codegen spec typings/imports to public react-native exports (e.g., CodegenTypes, HostComponent, codegenNativeComponent) and tightened several component prop typings.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react-native-gesture-handler/src/v3/types/EventTypes.ts Updates Animated event mapping typing to avoid RN strict typing breakages.
packages/react-native-gesture-handler/src/v3/detectors/VirtualDetector/InterceptingGestureDetector.tsx Narrows detector component typing to a shared native-component prop surface.
packages/react-native-gesture-handler/src/v3/detectors/NativeDetector.tsx Same detector component typing adjustment for strict TS compatibility.
packages/react-native-gesture-handler/src/v3/detectors/HostGestureDetector.web.tsx Fixes ref typing for View under strict TS (ComponentRef<typeof View>).
packages/react-native-gesture-handler/src/v3/detectors/common.ts Adds an explicit ComponentType annotation for the animated detector wrapper.
packages/react-native-gesture-handler/src/v3/components/Pressable.tsx Plumbs through ref typing to the underlying native button component.
packages/react-native-gesture-handler/src/v3/components/GestureComponents.tsx Tightens wrapper component typings (notably TextInput) for strict TS.
packages/react-native-gesture-handler/src/v3/components/GestureButtonsProps.ts Adjusts wrapper prop composition/omits to avoid strict TS conflicts.
packages/react-native-gesture-handler/src/v3/components/GestureButtons.tsx Fixes strict style typing (e.g., opacity + ViewStyle casts) and wrapper component typing.
packages/react-native-gesture-handler/src/specs/RNGestureHandlerRootViewNativeComponent.ts Updates codegen imports/types to public strict TS API (CodegenTypes, HostComponent).
packages/react-native-gesture-handler/src/specs/RNGestureHandlerDetectorNativeComponent.ts Same codegen strict TS API updates; uses CodegenTypes.* and HostComponent cast.
packages/react-native-gesture-handler/src/specs/RNGestureHandlerButtonNativeComponent.ts Same codegen strict TS API updates for the button component spec.
packages/react-native-gesture-handler/src/specs/NativeRNGestureHandlerModule.ts Updates TurboModule spec numeric types to CodegenTypes.*.
packages/react-native-gesture-handler/src/handlers/gestures/reanimatedWrapper.ts Broadens createAnimatedComponent arg type to ComponentType for strict TS.
packages/react-native-gesture-handler/src/components/touchables/TouchableNativeFeedback.android.tsx Tightens background factory return typing and casts ripple color to expected prop type.
packages/react-native-gesture-handler/src/components/touchables/TouchableHighlight.tsx Reworks style composition to satisfy strict TS style typing.
packages/react-native-gesture-handler/src/components/Text.tsx Aligns ref typing with strict TS (ComponentRef<typeof RNText>).
packages/react-native-gesture-handler/src/components/ReanimatedDrawerLayout.tsx Avoids passing backgroundColor: undefined by conditionally spreading the field.
packages/react-native-gesture-handler/src/components/Pressable/Pressable.tsx Plumbs through ref typing to the underlying native button (legacy Pressable).
packages/react-native-gesture-handler/src/components/GestureComponents.tsx Tightens wrapper typing for legacy drawer layout wrapper under strict TS.
packages/react-native-gesture-handler/src/components/GestureButtons.tsx Adjusts strict typings for button wrappers (style typing + ref plumbing).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.

@m-bert
m-bert requested a review from j-piasecki July 17, 2026 11:09
@m-bert
m-bert merged commit 7d2f321 into main Jul 20, 2026
4 checks passed
@m-bert
m-bert deleted the @mbert/typeeeees branch July 20, 2026 06:30
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.

3 participants