Skip to content

Commit 8a59153

Browse files
javachefacebook-github-bot
authored andcommitted
Remove $TEMPORARY$object types
Summary: This was left over from an old codemod. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D41154548 fbshipit-source-id: 0b5fb3e78491b66ebaf13555f80e0265a25dc7d8
1 parent 1453ef1 commit 8a59153

File tree

14 files changed

+72
-65
lines changed

14 files changed

+72
-65
lines changed

Libraries/Components/Touchable/Touchable.flow.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,30 @@ import * as React from 'react';
9999
* }
100100
*/
101101

102-
// Default amount "active" region protrudes beyond box
102+
/**
103+
* Touchable states.
104+
*/
105+
106+
const States = {
107+
NOT_RESPONDER: 'NOT_RESPONDER', // Not the responder
108+
RESPONDER_INACTIVE_PRESS_IN: 'RESPONDER_INACTIVE_PRESS_IN', // Responder, inactive, in the `PressRect`
109+
RESPONDER_INACTIVE_PRESS_OUT: 'RESPONDER_INACTIVE_PRESS_OUT', // Responder, inactive, out of `PressRect`
110+
RESPONDER_ACTIVE_PRESS_IN: 'RESPONDER_ACTIVE_PRESS_IN', // Responder, active, in the `PressRect`
111+
RESPONDER_ACTIVE_PRESS_OUT: 'RESPONDER_ACTIVE_PRESS_OUT', // Responder, active, out of `PressRect`
112+
RESPONDER_ACTIVE_LONG_PRESS_IN: 'RESPONDER_ACTIVE_LONG_PRESS_IN', // Responder, active, in the `PressRect`, after long press threshold
113+
RESPONDER_ACTIVE_LONG_PRESS_OUT: 'RESPONDER_ACTIVE_LONG_PRESS_OUT', // Responder, active, out of `PressRect`, after long press threshold
114+
ERROR: 'ERROR',
115+
};
116+
117+
type State =
118+
| typeof States.NOT_RESPONDER
119+
| typeof States.RESPONDER_INACTIVE_PRESS_IN
120+
| typeof States.RESPONDER_INACTIVE_PRESS_OUT
121+
| typeof States.RESPONDER_ACTIVE_PRESS_IN
122+
| typeof States.RESPONDER_ACTIVE_PRESS_OUT
123+
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN
124+
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT
125+
| typeof States.ERROR;
103126

104127
/**
105128
* By convention, methods prefixed with underscores are meant to be @private,
@@ -200,9 +223,12 @@ interface TouchableMixinType {
200223
* @return {object} State object to be placed inside of
201224
* `this.state.touchable`.
202225
*/
203-
touchableGetInitialState: () => $TEMPORARY$object<{|
204-
touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>,
205-
|}>;
226+
touchableGetInitialState: () => {
227+
touchable: {
228+
touchState: ?State,
229+
responderID: ?PressEvent['currentTarget'],
230+
},
231+
};
206232

207233
// ==== Hooks to Gesture Responder system ====
208234
/**

Libraries/Components/Touchable/Touchable.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,12 @@ const TouchableMixin = {
396396
* @return {object} State object to be placed inside of
397397
* `this.state.touchable`.
398398
*/
399-
touchableGetInitialState: function (): $TEMPORARY$object<{|
400-
touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>,
401-
|}> {
399+
touchableGetInitialState: function (): {
400+
touchable: {
401+
touchState: ?State,
402+
responderID: ?PressEvent['currentTarget'],
403+
},
404+
} {
402405
return {
403406
touchable: {touchState: undefined, responderID: null},
404407
};

Libraries/Core/ReactNativeVersionCheck.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,7 @@ exports.checkVersions = function checkVersions(): void {
4040
};
4141

4242
function _formatVersion(
43-
version:
44-
| {major: number, minor: number, patch: number, prerelease: ?number}
45-
| {major: number, minor: number, patch: number, prerelease: ?string}
46-
| $TEMPORARY$object<{
47-
major: number,
48-
minor: number,
49-
patch: number,
50-
prerelease: null,
51-
}>,
43+
version: (typeof Platform)['constants']['reactNativeVersion'],
5244
): string {
5345
return (
5446
`${version.major}.${version.minor}.${version.patch}` +

Libraries/Interaction/PanResponder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ const PanResponder: PanResponderType = {
399399
* accordingly. (numberActiveTouches) may not be totally accurate unless you
400400
* are the responder.
401401
*/
402-
create(config: PanResponderConfig): $TEMPORARY$object<{|
402+
create(config: PanResponderConfig): {
403403
getInteractionHandle: () => ?number,
404404
panHandlers: PanHandlers,
405-
|}> {
405+
} {
406406
const interactionState = {
407407
handle: (null: ?number),
408408
};

Libraries/Lists/__tests__/VirtualizedSectionList-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ describe('VirtualizedSectionList', () => {
168168
describe('scrollToLocation', () => {
169169
const ITEM_HEIGHT = 100;
170170

171-
const createVirtualizedSectionList = (
172-
props: void | $TEMPORARY$object<{stickySectionHeadersEnabled: boolean}>,
173-
) => {
171+
const createVirtualizedSectionList = (props?: {
172+
stickySectionHeadersEnabled: boolean,
173+
}) => {
174174
const component = ReactTestRenderer.create(
175175
<VirtualizedSectionList
176176
sections={[

Libraries/LogBox/UI/LogBoxInspector.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ const headerTitleMap = {
9292
component: 'Render Error',
9393
};
9494

95-
function LogBoxInspectorBody(
96-
props: $TEMPORARY$object<{log: LogBoxLog, onRetry: () => void}>,
97-
) {
95+
function LogBoxInspectorBody(props: {log: LogBoxLog, onRetry: () => void}) {
9896
const [collapsed, setCollapsed] = React.useState(true);
9997

10098
React.useEffect(() => {

Libraries/LogBox/UI/LogBoxInspectorStackFrame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import LogBoxButton from './LogBoxButton';
1919
import * as LogBoxStyle from './LogBoxStyle';
2020
import * as React from 'react';
2121

22-
type Props = $ReadOnly<{|
22+
type Props = $ReadOnly<{
2323
frame: StackFrame,
2424
onPress?: ?(event: PressEvent) => void,
25-
|}>;
25+
}>;
2626

2727
function LogBoxInspectorStackFrame(props: Props): React.Node {
2828
const {frame, onPress} = props;

Libraries/LogBox/UI/LogBoxNotification.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import LogBoxMessage from './LogBoxMessage';
2121
import * as LogBoxStyle from './LogBoxStyle';
2222
import * as React from 'react';
2323

24-
type Props = $ReadOnly<{|
24+
type Props = $ReadOnly<{
2525
log: LogBoxLog,
2626
totalLogCount: number,
2727
level: 'warn' | 'error',
2828
onPressOpen: () => void,
2929
onPressDismiss: () => void,
30-
|}>;
30+
}>;
3131

3232
function LogBoxLogNotification(props: Props): React.Node {
3333
const {totalLogCount, level, log} = props;
@@ -56,9 +56,7 @@ function LogBoxLogNotification(props: Props): React.Node {
5656
);
5757
}
5858

59-
function CountBadge(
60-
props: $TEMPORARY$object<{count: number, level: 'error' | 'warn'}>,
61-
) {
59+
function CountBadge(props: {count: number, level: 'error' | 'warn'}) {
6260
return (
6361
<View style={countStyles.outside}>
6462
{/* $FlowFixMe[incompatible-type] (>=0.114.0) This suppression was added
@@ -73,7 +71,7 @@ function CountBadge(
7371
);
7472
}
7573

76-
function Message(props: $TEMPORARY$object<{message: MessageType}>) {
74+
function Message(props: {message: MessageType}) {
7775
return (
7876
<View style={messageStyles.container}>
7977
<Text numberOfLines={1} style={messageStyles.text}>
@@ -89,7 +87,7 @@ function Message(props: $TEMPORARY$object<{message: MessageType}>) {
8987
);
9088
}
9189

92-
function DismissButton(props: $TEMPORARY$object<{onPress: () => void}>) {
90+
function DismissButton(props: {onPress: () => void}) {
9391
return (
9492
<View style={dismissStyles.container}>
9593
<LogBoxButton

Libraries/ReactNative/getCachedComponentWithDebugName.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
* @format
99
*/
1010

11-
import type {AbstractComponent, Node} from 'react';
11+
import type {AbstractComponent} from 'react';
1212

13-
type NoopComponent = AbstractComponent<{children: Node}>;
13+
import * as React from 'react';
14+
15+
type NoopComponent = AbstractComponent<{children: React.Node}>;
1416

1517
const cache: Map<
1618
string, // displayName
@@ -23,9 +25,7 @@ export default function getCachedComponentWithDisplayName(
2325
let ComponentWithDisplayName = cache.get(displayName);
2426

2527
if (!ComponentWithDisplayName) {
26-
ComponentWithDisplayName = ({
27-
children,
28-
}: $TEMPORARY$object<{children: Node}>) => children;
28+
ComponentWithDisplayName = ({children}: {children: React.Node}) => children;
2929
// $FlowFixMe[prop-missing]
3030
ComponentWithDisplayName.displayName = displayName;
3131
cache.set(displayName, ComponentWithDisplayName);

Libraries/Utilities/__tests__/useRefEffect-test.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,10 @@ import {act, create} from 'react-test-renderer';
2020
function TestView({
2121
childKey = null,
2222
effect,
23-
}:
24-
| $FlowFixMe
25-
| $TEMPORARY$object<{
26-
childKey: $TEMPORARY$string<'bar'>,
27-
effect: () => () => void,
28-
}>
29-
| $TEMPORARY$object<{childKey: $TEMPORARY$string<'foo'>, effect: () => void}>
30-
| $TEMPORARY$object<{
31-
childKey: $TEMPORARY$string<'foo'>,
32-
effect: () => () => void,
33-
}>) {
23+
}: {
24+
childKey: ?string,
25+
effect: () => (() => void) | void,
26+
}) {
3427
const ref = useRefEffect(effect);
3528
return <View key={childKey} ref={ref} testID={childKey} />;
3629
}

0 commit comments

Comments
 (0)