Skip to content

Commit 5d6776b

Browse files
EmersonBmeta-codesync[bot]
authored andcommitted
Revert D110488985: Remove Touchable (base) from public API
Differential Revision: D110488985 Original commit changeset: 394e3996bb45 Original Phabricator Diff: D110488985 fbshipit-source-id: c22ca419b749bceaa63f9978d2f9b2a37a8a383c
1 parent 0015d1e commit 5d6776b

4 files changed

Lines changed: 72 additions & 16 deletions

File tree

packages/react-native/ReactNativeApi.d.ts

Lines changed: 50 additions & 1 deletion
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<<e85dfe98c549ac9fff85a8d7b90b5fd3>>
7+
* @generated SignedSource<<637f1d0b012ebca68c9e020a52eb2803>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -403,6 +403,16 @@ declare const staggerImpl: (
403403
time: number,
404404
animations: Array<CompositeAnimation>,
405405
) => CompositeAnimation
406+
declare const States: {
407+
ERROR: "ERROR"
408+
NOT_RESPONDER: "NOT_RESPONDER"
409+
RESPONDER_ACTIVE_LONG_PRESS_IN: "RESPONDER_ACTIVE_LONG_PRESS_IN"
410+
RESPONDER_ACTIVE_LONG_PRESS_OUT: "RESPONDER_ACTIVE_LONG_PRESS_OUT"
411+
RESPONDER_ACTIVE_PRESS_IN: "RESPONDER_ACTIVE_PRESS_IN"
412+
RESPONDER_ACTIVE_PRESS_OUT: "RESPONDER_ACTIVE_PRESS_OUT"
413+
RESPONDER_INACTIVE_PRESS_IN: "RESPONDER_INACTIVE_PRESS_IN"
414+
RESPONDER_INACTIVE_PRESS_OUT: "RESPONDER_INACTIVE_PRESS_OUT"
415+
}
406416
declare const subtract: typeof $$AnimatedImplementation.subtract
407417
declare const subtractImpl: (
408418
a: AnimatedNode_default | number,
@@ -446,6 +456,7 @@ declare const ToastAndroid_default: {
446456
yOffset: number,
447457
) => void
448458
}
459+
declare const Touchable: typeof TouchableImpl_default
449460
declare const Touchable_default: (
450461
props: TouchableOpacityProps & {
451462
ref?: React.Ref<TouchableOpacityInstance>
@@ -457,6 +468,33 @@ declare const TouchableHighlight_default: (
457468
ref?: React.Ref<TouchableHighlightInstance>
458469
},
459470
) => React.ReactNode
471+
declare const TouchableImpl_default: {
472+
Mixin: typeof TouchableMixinImpl
473+
renderDebugView: ($$PARAM_0$$: {
474+
color: ColorValue
475+
hitSlop?: EdgeInsetsProp
476+
}) => null | React.ReactNode
477+
}
478+
declare const TouchableMixinImpl: {
479+
withoutDefaultFocusAndBlur: {}
480+
componentDidMount: () => void
481+
componentWillUnmount: () => void
482+
touchableGetInitialState: () => {
483+
touchable: {
484+
responderID: GestureResponderEvent["currentTarget"] | undefined
485+
touchState: TouchableState | undefined
486+
}
487+
}
488+
touchableHandleBlur: (e: BlurEvent) => void
489+
touchableHandleFocus: (e: FocusEvent) => void
490+
touchableHandleResponderGrant: (e: GestureResponderEvent) => void
491+
touchableHandleResponderMove: (e: GestureResponderEvent) => void
492+
touchableHandleResponderRelease: (e: GestureResponderEvent) => void
493+
touchableHandleResponderTerminate: (e: GestureResponderEvent) => void
494+
touchableHandleResponderTerminationRequest: () => any
495+
touchableHandleStartShouldSetResponder: () => any
496+
touchableLongPressCancelsPress: () => boolean
497+
}
460498
declare const TouchableOpacity: typeof Touchable_default
461499
declare const UIManager: typeof UIManager_default
462500
declare const UIManager_default: UIManagerJSInterface
@@ -5333,6 +5371,7 @@ declare type TimingAnimationConfig = Readonly<
53335371
}
53345372
>
53355373
declare type ToastAndroid = typeof ToastAndroid
5374+
declare type Touchable = typeof Touchable
53365375
declare type TouchableHighlight = typeof TouchableHighlight
53375376
declare type TouchableHighlightBaseProps = {
53385377
readonly activeOpacity?: number
@@ -5439,6 +5478,15 @@ declare type TouchableOpacityTVProps = {
54395478
readonly nextFocusRight?: number
54405479
readonly nextFocusUp?: number
54415480
}
5481+
declare type TouchableState =
5482+
| typeof States.ERROR
5483+
| typeof States.NOT_RESPONDER
5484+
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN
5485+
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT
5486+
| typeof States.RESPONDER_ACTIVE_PRESS_IN
5487+
| typeof States.RESPONDER_ACTIVE_PRESS_OUT
5488+
| typeof States.RESPONDER_INACTIVE_PRESS_IN
5489+
| typeof States.RESPONDER_INACTIVE_PRESS_OUT
54425490
declare function TouchableWithoutFeedback(
54435491
props: TouchableWithoutFeedbackProps,
54445492
): React.ReactNode
@@ -6126,6 +6174,7 @@ export {
61266174
TextProps, // 58466ea1
61276175
TextStyle, // b62b8399
61286176
ToastAndroid, // 88a8969a
6177+
Touchable, // c15da0a2
61296178
TouchableHighlight, // 20ba0199
61306179
TouchableHighlightInstance, // b510c0eb
61316180
TouchableHighlightProps, // 337a9164

packages/react-native/__typetests__/index.tsx

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

487488
export default Welcome;
488489

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+
489506
export class TouchableHighlightTest extends React.Component {
490507
buttonRef = React.createRef<React.ComponentRef<typeof TouchableHighlight>>();
491508

packages/react-native/index.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ 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+
},
152155
get TouchableHighlight() {
153156
return require('./Libraries/Components/Touchable/TouchableHighlight')
154157
.default;
@@ -409,21 +412,6 @@ module.exports = {
409412
// #endregion
410413
} as ReactNativePublicAPI;
411414

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-
427415
if (__DEV__) {
428416
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
429417
* attempting to access InteractionManager. */

packages/react-native/index.js.flow

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ 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+
178180
export type {
179181
TouchableHighlightInstance,
180182
TouchableHighlightProps,

0 commit comments

Comments
 (0)