Skip to content

Remove Touchable (base) from public API#57420

Open
huntie wants to merge 1 commit into
react:mainfrom
huntie:export-D110488985
Open

Remove Touchable (base) from public API#57420
huntie wants to merge 1 commit into
react:mainfrom
huntie:export-D110488985

Conversation

@huntie

@huntie huntie commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary:
Motivation

The public type for Touchable has zero overlap with its runtime value. This is an internal implementation object which is undocumented.

export interface Touchable {
onTouchStart?: ((event: GestureResponderEvent) => void) | undefined;
onTouchMove?: ((event: GestureResponderEvent) => void) | undefined;
onTouchEnd?: ((event: GestureResponderEvent) => void) | undefined;
onTouchCancel?: ((event: GestureResponderEvent) => void) | undefined;
onTouchEndCapture?: ((event: GestureResponderEvent) => void) | undefined;
}

const TouchableImpl = {
Mixin: TouchableMixinImpl,
/**
* Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
*/
renderDebugView: ({
color,
hitSlop,
}: {
color: ColorValue,
hitSlop?: EdgeInsetsProp,
...
}): null | React.Node => {
if (__DEV__) {
return <PressabilityDebugView color={color} hitSlop={hitSlop} />;
}
return null;
},
};
export default TouchableImpl;

Replaces D110483989 / #57419.

Impact

This is a breaking change with few open source consumers. The onTouchStart etc prop typings are part of ViewProps today, which is a suitable replacement.

Across projects I've been testing for the Strict TypeScript API rollout, the only load bearing consumer was Uniwind — where I've sent a PR to address this.

Changelog:
[General][Breaking] - The Touchable root export is removed. If you are extending Touchable as a type, please use ViewProps instead.

Differential Revision: D110488985

Summary:
**Motivation**

The public type for `Touchable` has zero overlap with its runtime value, and this API is undocumented.

https://www.internalfb.com/code/fbsource/[86267213ee84]/xplat/js/react-native-github/packages/react-native/Libraries/Components/Touchable/Touchable.d.ts?lines=18-24

https://www.internalfb.com/code/fbsource/[86267213ee84]/xplat/js/react-native-github/packages/react-native/Libraries/Components/Touchable/Touchable.js?lines=966-986

Replaces D110483989 / react#57419.

**Impact**

This API was undocumented, and any type usages will have disagreed under the manual types vs the Strict API.

- A load-bearing consumer of this was Uniwind, where types are fixed in uni-stack/uniwind#592.

Changelog:  
[General][Breaking] - The `Touchable` root export is removed. If you are extending `Touchable` as a type, please use `ViewProps` instead.

Differential Revision: D110488985
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 2, 2026
@meta-codesync

meta-codesync Bot commented Jul 2, 2026

Copy link
Copy Markdown

@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110488985.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: BREAKING

@huntie huntie added the JS API stabilization (1.0) Follow-up items from our JS API changes in 0.80 (deep imports deprecation and Strict TypeScript API) label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. JS API stabilization (1.0) Follow-up items from our JS API changes in 0.80 (deep imports deprecation and Strict TypeScript API) meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant