Skip to content

Commit afd44f2

Browse files
huntiefacebook-github-bot
authored andcommitted
Remove Touchable (base) from public API
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 / #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
1 parent a7959dd commit afd44f2

4 files changed

Lines changed: 1 addition & 72 deletions

File tree

packages/react-native/ReactNativeApi.d.ts

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<67eb674c33870c82986054f0cee48385>>
7+
* @generated SignedSource<<117357f08899828c66a83bdec1ee08f6>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -399,16 +399,6 @@ declare const staggerImpl: (
399399
time: number,
400400
animations: Array<CompositeAnimation>,
401401
) => CompositeAnimation
402-
declare const States: {
403-
ERROR: "ERROR"
404-
NOT_RESPONDER: "NOT_RESPONDER"
405-
RESPONDER_ACTIVE_LONG_PRESS_IN: "RESPONDER_ACTIVE_LONG_PRESS_IN"
406-
RESPONDER_ACTIVE_LONG_PRESS_OUT: "RESPONDER_ACTIVE_LONG_PRESS_OUT"
407-
RESPONDER_ACTIVE_PRESS_IN: "RESPONDER_ACTIVE_PRESS_IN"
408-
RESPONDER_ACTIVE_PRESS_OUT: "RESPONDER_ACTIVE_PRESS_OUT"
409-
RESPONDER_INACTIVE_PRESS_IN: "RESPONDER_INACTIVE_PRESS_IN"
410-
RESPONDER_INACTIVE_PRESS_OUT: "RESPONDER_INACTIVE_PRESS_OUT"
411-
}
412402
declare const subtract: typeof $$AnimatedImplementation.subtract
413403
declare const subtractImpl: (
414404
a: AnimatedNode_default | number,
@@ -452,7 +442,6 @@ declare const ToastAndroid_default: {
452442
yOffset: number,
453443
) => void
454444
}
455-
declare const Touchable: typeof TouchableImpl_default
456445
declare const Touchable_default: (
457446
props: TouchableOpacityProps & {
458447
ref?: React.Ref<TouchableOpacityInstance>
@@ -464,33 +453,6 @@ declare const TouchableHighlight_default: (
464453
ref?: React.Ref<TouchableHighlightInstance>
465454
},
466455
) => React.ReactNode
467-
declare const TouchableImpl_default: {
468-
Mixin: typeof TouchableMixinImpl
469-
renderDebugView: ($$PARAM_0$$: {
470-
color: ColorValue
471-
hitSlop?: EdgeInsetsProp
472-
}) => null | React.ReactNode
473-
}
474-
declare const TouchableMixinImpl: {
475-
withoutDefaultFocusAndBlur: {}
476-
componentDidMount: () => void
477-
componentWillUnmount: () => void
478-
touchableGetInitialState: () => {
479-
touchable: {
480-
responderID: GestureResponderEvent["currentTarget"] | undefined
481-
touchState: TouchableState | undefined
482-
}
483-
}
484-
touchableHandleBlur: (e: BlurEvent) => void
485-
touchableHandleFocus: (e: FocusEvent) => void
486-
touchableHandleResponderGrant: (e: GestureResponderEvent) => void
487-
touchableHandleResponderMove: (e: GestureResponderEvent) => void
488-
touchableHandleResponderRelease: (e: GestureResponderEvent) => void
489-
touchableHandleResponderTerminate: (e: GestureResponderEvent) => void
490-
touchableHandleResponderTerminationRequest: () => any
491-
touchableHandleStartShouldSetResponder: () => any
492-
touchableLongPressCancelsPress: () => boolean
493-
}
494456
declare const TouchableOpacity: typeof Touchable_default
495457
declare const UIManager: typeof UIManager_default
496458
declare const UIManager_default: UIManagerJSInterface
@@ -5353,7 +5315,6 @@ declare type TimingAnimationConfig = Readonly<
53535315
}
53545316
>
53555317
declare type ToastAndroid = typeof ToastAndroid
5356-
declare type Touchable = typeof Touchable
53575318
declare type TouchableHighlight = typeof TouchableHighlight
53585319
declare type TouchableHighlightBaseProps = {
53595320
readonly activeOpacity?: number
@@ -5460,15 +5421,6 @@ declare type TouchableOpacityTVProps = {
54605421
readonly nextFocusRight?: number
54615422
readonly nextFocusUp?: number
54625423
}
5463-
declare type TouchableState =
5464-
| typeof States.ERROR
5465-
| typeof States.NOT_RESPONDER
5466-
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN
5467-
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT
5468-
| typeof States.RESPONDER_ACTIVE_PRESS_IN
5469-
| typeof States.RESPONDER_ACTIVE_PRESS_OUT
5470-
| typeof States.RESPONDER_INACTIVE_PRESS_IN
5471-
| typeof States.RESPONDER_INACTIVE_PRESS_OUT
54725424
declare function TouchableWithoutFeedback(
54735425
props: TouchableWithoutFeedbackProps,
54745426
): React.ReactNode
@@ -6153,7 +6105,6 @@ export {
61536105
TextProps, // 58466ea1
61546106
TextStyle, // b62b8399
61556107
ToastAndroid, // 88a8969a
6156-
Touchable, // c15da0a2
61576108
TouchableHighlight, // 20ba0199
61586109
TouchableHighlightInstance, // b510c0eb
61596110
TouchableHighlightProps, // 337a9164

packages/react-native/__typetests__/index.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ import {
124124
// @ts-ignore
125125
SectionListData,
126126
ToastAndroid,
127-
Touchable,
128127
LayoutAnimation,
129128
processColor,
130129
experimental_LayoutConformance as LayoutConformance,
@@ -487,22 +486,6 @@ class Welcome extends React.Component<
487486

488487
export default Welcome;
489488

490-
// TouchableTest
491-
function TouchableTest() {
492-
function basicUsage() {
493-
return Touchable.renderDebugView({
494-
color: 'mediumspringgreen',
495-
hitSlop: {bottom: 5, top: 5},
496-
});
497-
}
498-
499-
function defaultHitSlop() {
500-
return Touchable.renderDebugView({
501-
color: 'red',
502-
});
503-
}
504-
}
505-
506489
export class TouchableHighlightTest extends React.Component {
507490
buttonRef = React.createRef<React.ComponentRef<typeof TouchableHighlight>>();
508491

packages/react-native/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ module.exports = {
138138
get TextInput() {
139139
return require('./Libraries/Components/TextInput/TextInput').default;
140140
},
141-
get Touchable() {
142-
return require('./Libraries/Components/Touchable/Touchable').default;
143-
},
144141
get TouchableHighlight() {
145142
return require('./Libraries/Components/Touchable/TouchableHighlight')
146143
.default;

packages/react-native/index.js.flow

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ export type {
175175
} from './Libraries/Components/TextInput/TextInput';
176176
export {default as TextInput} from './Libraries/Components/TextInput/TextInput';
177177

178-
export {default as Touchable} from './Libraries/Components/Touchable/Touchable';
179-
180178
export type {
181179
TouchableHighlightInstance,
182180
TouchableHighlightProps,

0 commit comments

Comments
 (0)