Skip to content

Commit 328a975

Browse files
huntiemeta-codesync[bot]
authored andcommitted
Remove Touchable (base) from public API
Summary: Replaces D110483989 / #57419. **Impact** One of the only known consumers is in Uniwind, and this is a nonsense call site that will be removed in [incoming]. https://github.com/uni-stack/uniwind/blob/6b498f2ada673d2b92915c79a703286078b953c2/packages/uniwind/types.d.ts#L40 Changelog: [General][Breaking] - The `Touchable` root export is removed. For any consumers of the `Touchable` type, please use `ViewProps`. Differential Revision: D111022549
1 parent 783946b commit 328a975

4 files changed

Lines changed: 16 additions & 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<<0ef11b701c83f2414d61f7ec37c78df1>>
7+
* @generated SignedSource<<0d6ccb57cc35f5518f7a83a709927f2f>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -398,16 +398,6 @@ declare const staggerImpl: (
398398
time: number,
399399
animations: Array<CompositeAnimation>,
400400
) => CompositeAnimation
401-
declare const States: {
402-
ERROR: "ERROR"
403-
NOT_RESPONDER: "NOT_RESPONDER"
404-
RESPONDER_ACTIVE_LONG_PRESS_IN: "RESPONDER_ACTIVE_LONG_PRESS_IN"
405-
RESPONDER_ACTIVE_LONG_PRESS_OUT: "RESPONDER_ACTIVE_LONG_PRESS_OUT"
406-
RESPONDER_ACTIVE_PRESS_IN: "RESPONDER_ACTIVE_PRESS_IN"
407-
RESPONDER_ACTIVE_PRESS_OUT: "RESPONDER_ACTIVE_PRESS_OUT"
408-
RESPONDER_INACTIVE_PRESS_IN: "RESPONDER_INACTIVE_PRESS_IN"
409-
RESPONDER_INACTIVE_PRESS_OUT: "RESPONDER_INACTIVE_PRESS_OUT"
410-
}
411401
declare const subtract: typeof $$AnimatedImplementation.subtract
412402
declare const subtractImpl: (
413403
a: AnimatedNode_default | number,
@@ -449,7 +439,6 @@ declare const ToastAndroid_default: {
449439
yOffset: number,
450440
) => void
451441
}
452-
declare const Touchable: typeof TouchableImpl_default
453442
declare const Touchable_default: (
454443
props: TouchableOpacityProps & {
455444
ref?: React.Ref<TouchableOpacityInstance>
@@ -461,33 +450,6 @@ declare const TouchableHighlight_default: (
461450
ref?: React.Ref<TouchableHighlightInstance>
462451
},
463452
) => React.ReactNode
464-
declare const TouchableImpl_default: {
465-
Mixin: typeof TouchableMixinImpl
466-
renderDebugView: ($$PARAM_0$$: {
467-
color: ColorValue
468-
hitSlop?: EdgeInsetsProp
469-
}) => null | React.ReactNode
470-
}
471-
declare const TouchableMixinImpl: {
472-
withoutDefaultFocusAndBlur: {}
473-
componentDidMount: () => void
474-
componentWillUnmount: () => void
475-
touchableGetInitialState: () => {
476-
touchable: {
477-
responderID: GestureResponderEvent["currentTarget"] | undefined
478-
touchState: TouchableState | undefined
479-
}
480-
}
481-
touchableHandleBlur: (e: BlurEvent) => void
482-
touchableHandleFocus: (e: FocusEvent) => void
483-
touchableHandleResponderGrant: (e: GestureResponderEvent) => void
484-
touchableHandleResponderMove: (e: GestureResponderEvent) => void
485-
touchableHandleResponderRelease: (e: GestureResponderEvent) => void
486-
touchableHandleResponderTerminate: (e: GestureResponderEvent) => void
487-
touchableHandleResponderTerminationRequest: () => any
488-
touchableHandleStartShouldSetResponder: () => any
489-
touchableLongPressCancelsPress: () => boolean
490-
}
491453
declare const TouchableOpacity: typeof Touchable_default
492454
declare const UIManager: typeof UIManager_default
493455
declare const UIManager_default: UIManagerJSInterface
@@ -5224,7 +5186,6 @@ declare type TimingAnimationConfig = Readonly<
52245186
}
52255187
>
52265188
declare type ToastAndroid = typeof ToastAndroid
5227-
declare type Touchable = typeof Touchable
52285189
declare type TouchableHighlight = typeof TouchableHighlight
52295190
declare type TouchableHighlightBaseProps = {
52305191
readonly activeOpacity?: number
@@ -5329,15 +5290,6 @@ declare type TouchableOpacityTVProps = {
53295290
readonly nextFocusRight?: number
53305291
readonly nextFocusUp?: number
53315292
}
5332-
declare type TouchableState =
5333-
| typeof States.ERROR
5334-
| typeof States.NOT_RESPONDER
5335-
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN
5336-
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT
5337-
| typeof States.RESPONDER_ACTIVE_PRESS_IN
5338-
| typeof States.RESPONDER_ACTIVE_PRESS_OUT
5339-
| typeof States.RESPONDER_INACTIVE_PRESS_IN
5340-
| typeof States.RESPONDER_INACTIVE_PRESS_OUT
53415293
declare function TouchableWithoutFeedback(
53425294
props: TouchableWithoutFeedbackProps,
53435295
): React.ReactNode
@@ -6019,7 +5971,6 @@ export {
60195971
TextProps, // 58466ea1
60205972
TextStyle, // b62b8399
60215973
ToastAndroid, // 88a8969a
6022-
Touchable, // c15da0a2
60235974
TouchableHighlight, // 20ba0199
60245975
TouchableHighlightInstance, // b510c0eb
60255976
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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ module.exports = {
149149
get TextInput() {
150150
return require('./Libraries/Components/TextInput/TextInput').default;
151151
},
152-
get Touchable() {
153-
return require('./Libraries/Components/Touchable/Touchable').default;
154-
},
155152
get TouchableHighlight() {
156153
return require('./Libraries/Components/Touchable/TouchableHighlight')
157154
.default;
@@ -412,6 +409,21 @@ module.exports = {
412409
// #endregion
413410
} as ReactNativePublicAPI;
414411

412+
// `Touchable` has been removed from the public API types, but remains
413+
// re-exported at runtime here because of a hanging `react-native-svg` call
414+
// site (fbsource).
415+
// TODO(huntie): Remove this re-export once `react-native-svg` is updated.
416+
/* $FlowFixMe[prop-missing] This is intentional: `Touchable` is a value-only
417+
* re-export that is absent from the public API types. */
418+
/* $FlowFixMe[invalid-export] This is intentional: `Touchable` is a value-only
419+
* re-export that is absent from the public API types. */
420+
Object.defineProperty(module.exports, 'Touchable', {
421+
configurable: true,
422+
get() {
423+
return require('./Libraries/Components/Touchable/Touchable').default;
424+
},
425+
});
426+
415427
if (__DEV__) {
416428
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
417429
* attempting to access InteractionManager. */

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)