mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1453ef1a88
commit
8a59153bd7
@@ -99,7 +99,30 @@ import * as React from 'react';
|
||||
* }
|
||||
*/
|
||||
|
||||
// Default amount "active" region protrudes beyond box
|
||||
/**
|
||||
* Touchable states.
|
||||
*/
|
||||
|
||||
const States = {
|
||||
NOT_RESPONDER: 'NOT_RESPONDER', // Not the responder
|
||||
RESPONDER_INACTIVE_PRESS_IN: 'RESPONDER_INACTIVE_PRESS_IN', // Responder, inactive, in the `PressRect`
|
||||
RESPONDER_INACTIVE_PRESS_OUT: 'RESPONDER_INACTIVE_PRESS_OUT', // Responder, inactive, out of `PressRect`
|
||||
RESPONDER_ACTIVE_PRESS_IN: 'RESPONDER_ACTIVE_PRESS_IN', // Responder, active, in the `PressRect`
|
||||
RESPONDER_ACTIVE_PRESS_OUT: 'RESPONDER_ACTIVE_PRESS_OUT', // Responder, active, out of `PressRect`
|
||||
RESPONDER_ACTIVE_LONG_PRESS_IN: 'RESPONDER_ACTIVE_LONG_PRESS_IN', // Responder, active, in the `PressRect`, after long press threshold
|
||||
RESPONDER_ACTIVE_LONG_PRESS_OUT: 'RESPONDER_ACTIVE_LONG_PRESS_OUT', // Responder, active, out of `PressRect`, after long press threshold
|
||||
ERROR: 'ERROR',
|
||||
};
|
||||
|
||||
type State =
|
||||
| typeof States.NOT_RESPONDER
|
||||
| typeof States.RESPONDER_INACTIVE_PRESS_IN
|
||||
| typeof States.RESPONDER_INACTIVE_PRESS_OUT
|
||||
| typeof States.RESPONDER_ACTIVE_PRESS_IN
|
||||
| typeof States.RESPONDER_ACTIVE_PRESS_OUT
|
||||
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN
|
||||
| typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT
|
||||
| typeof States.ERROR;
|
||||
|
||||
/**
|
||||
* By convention, methods prefixed with underscores are meant to be @private,
|
||||
@@ -200,9 +223,12 @@ interface TouchableMixinType {
|
||||
* @return {object} State object to be placed inside of
|
||||
* `this.state.touchable`.
|
||||
*/
|
||||
touchableGetInitialState: () => $TEMPORARY$object<{|
|
||||
touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>,
|
||||
|}>;
|
||||
touchableGetInitialState: () => {
|
||||
touchable: {
|
||||
touchState: ?State,
|
||||
responderID: ?PressEvent['currentTarget'],
|
||||
},
|
||||
};
|
||||
|
||||
// ==== Hooks to Gesture Responder system ====
|
||||
/**
|
||||
|
||||
@@ -396,9 +396,12 @@ const TouchableMixin = {
|
||||
* @return {object} State object to be placed inside of
|
||||
* `this.state.touchable`.
|
||||
*/
|
||||
touchableGetInitialState: function (): $TEMPORARY$object<{|
|
||||
touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>,
|
||||
|}> {
|
||||
touchableGetInitialState: function (): {
|
||||
touchable: {
|
||||
touchState: ?State,
|
||||
responderID: ?PressEvent['currentTarget'],
|
||||
},
|
||||
} {
|
||||
return {
|
||||
touchable: {touchState: undefined, responderID: null},
|
||||
};
|
||||
|
||||
@@ -40,15 +40,7 @@ exports.checkVersions = function checkVersions(): void {
|
||||
};
|
||||
|
||||
function _formatVersion(
|
||||
version:
|
||||
| {major: number, minor: number, patch: number, prerelease: ?number}
|
||||
| {major: number, minor: number, patch: number, prerelease: ?string}
|
||||
| $TEMPORARY$object<{
|
||||
major: number,
|
||||
minor: number,
|
||||
patch: number,
|
||||
prerelease: null,
|
||||
}>,
|
||||
version: (typeof Platform)['constants']['reactNativeVersion'],
|
||||
): string {
|
||||
return (
|
||||
`${version.major}.${version.minor}.${version.patch}` +
|
||||
|
||||
@@ -399,10 +399,10 @@ const PanResponder: PanResponderType = {
|
||||
* accordingly. (numberActiveTouches) may not be totally accurate unless you
|
||||
* are the responder.
|
||||
*/
|
||||
create(config: PanResponderConfig): $TEMPORARY$object<{|
|
||||
create(config: PanResponderConfig): {
|
||||
getInteractionHandle: () => ?number,
|
||||
panHandlers: PanHandlers,
|
||||
|}> {
|
||||
} {
|
||||
const interactionState = {
|
||||
handle: (null: ?number),
|
||||
};
|
||||
|
||||
@@ -168,9 +168,9 @@ describe('VirtualizedSectionList', () => {
|
||||
describe('scrollToLocation', () => {
|
||||
const ITEM_HEIGHT = 100;
|
||||
|
||||
const createVirtualizedSectionList = (
|
||||
props: void | $TEMPORARY$object<{stickySectionHeadersEnabled: boolean}>,
|
||||
) => {
|
||||
const createVirtualizedSectionList = (props?: {
|
||||
stickySectionHeadersEnabled: boolean,
|
||||
}) => {
|
||||
const component = ReactTestRenderer.create(
|
||||
<VirtualizedSectionList
|
||||
sections={[
|
||||
|
||||
@@ -92,9 +92,7 @@ const headerTitleMap = {
|
||||
component: 'Render Error',
|
||||
};
|
||||
|
||||
function LogBoxInspectorBody(
|
||||
props: $TEMPORARY$object<{log: LogBoxLog, onRetry: () => void}>,
|
||||
) {
|
||||
function LogBoxInspectorBody(props: {log: LogBoxLog, onRetry: () => void}) {
|
||||
const [collapsed, setCollapsed] = React.useState(true);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
@@ -19,10 +19,10 @@ import LogBoxButton from './LogBoxButton';
|
||||
import * as LogBoxStyle from './LogBoxStyle';
|
||||
import * as React from 'react';
|
||||
|
||||
type Props = $ReadOnly<{|
|
||||
type Props = $ReadOnly<{
|
||||
frame: StackFrame,
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
|}>;
|
||||
}>;
|
||||
|
||||
function LogBoxInspectorStackFrame(props: Props): React.Node {
|
||||
const {frame, onPress} = props;
|
||||
|
||||
@@ -21,13 +21,13 @@ import LogBoxMessage from './LogBoxMessage';
|
||||
import * as LogBoxStyle from './LogBoxStyle';
|
||||
import * as React from 'react';
|
||||
|
||||
type Props = $ReadOnly<{|
|
||||
type Props = $ReadOnly<{
|
||||
log: LogBoxLog,
|
||||
totalLogCount: number,
|
||||
level: 'warn' | 'error',
|
||||
onPressOpen: () => void,
|
||||
onPressDismiss: () => void,
|
||||
|}>;
|
||||
}>;
|
||||
|
||||
function LogBoxLogNotification(props: Props): React.Node {
|
||||
const {totalLogCount, level, log} = props;
|
||||
@@ -56,9 +56,7 @@ function LogBoxLogNotification(props: Props): React.Node {
|
||||
);
|
||||
}
|
||||
|
||||
function CountBadge(
|
||||
props: $TEMPORARY$object<{count: number, level: 'error' | 'warn'}>,
|
||||
) {
|
||||
function CountBadge(props: {count: number, level: 'error' | 'warn'}) {
|
||||
return (
|
||||
<View style={countStyles.outside}>
|
||||
{/* $FlowFixMe[incompatible-type] (>=0.114.0) This suppression was added
|
||||
@@ -73,7 +71,7 @@ function CountBadge(
|
||||
);
|
||||
}
|
||||
|
||||
function Message(props: $TEMPORARY$object<{message: MessageType}>) {
|
||||
function Message(props: {message: MessageType}) {
|
||||
return (
|
||||
<View style={messageStyles.container}>
|
||||
<Text numberOfLines={1} style={messageStyles.text}>
|
||||
@@ -89,7 +87,7 @@ function Message(props: $TEMPORARY$object<{message: MessageType}>) {
|
||||
);
|
||||
}
|
||||
|
||||
function DismissButton(props: $TEMPORARY$object<{onPress: () => void}>) {
|
||||
function DismissButton(props: {onPress: () => void}) {
|
||||
return (
|
||||
<View style={dismissStyles.container}>
|
||||
<LogBoxButton
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {AbstractComponent, Node} from 'react';
|
||||
import type {AbstractComponent} from 'react';
|
||||
|
||||
type NoopComponent = AbstractComponent<{children: Node}>;
|
||||
import * as React from 'react';
|
||||
|
||||
type NoopComponent = AbstractComponent<{children: React.Node}>;
|
||||
|
||||
const cache: Map<
|
||||
string, // displayName
|
||||
@@ -23,9 +25,7 @@ export default function getCachedComponentWithDisplayName(
|
||||
let ComponentWithDisplayName = cache.get(displayName);
|
||||
|
||||
if (!ComponentWithDisplayName) {
|
||||
ComponentWithDisplayName = ({
|
||||
children,
|
||||
}: $TEMPORARY$object<{children: Node}>) => children;
|
||||
ComponentWithDisplayName = ({children}: {children: React.Node}) => children;
|
||||
// $FlowFixMe[prop-missing]
|
||||
ComponentWithDisplayName.displayName = displayName;
|
||||
cache.set(displayName, ComponentWithDisplayName);
|
||||
|
||||
@@ -20,17 +20,10 @@ import {act, create} from 'react-test-renderer';
|
||||
function TestView({
|
||||
childKey = null,
|
||||
effect,
|
||||
}:
|
||||
| $FlowFixMe
|
||||
| $TEMPORARY$object<{
|
||||
childKey: $TEMPORARY$string<'bar'>,
|
||||
effect: () => () => void,
|
||||
}>
|
||||
| $TEMPORARY$object<{childKey: $TEMPORARY$string<'foo'>, effect: () => void}>
|
||||
| $TEMPORARY$object<{
|
||||
childKey: $TEMPORARY$string<'foo'>,
|
||||
effect: () => () => void,
|
||||
}>) {
|
||||
}: {
|
||||
childKey: ?string,
|
||||
effect: () => (() => void) | void,
|
||||
}) {
|
||||
const ref = useRefEffect(effect);
|
||||
return <View key={childKey} ref={ref} testID={childKey} />;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,7 @@ export function createStringifySafeWithLimits(limits: {|
|
||||
maxArrayLimit = Number.POSITIVE_INFINITY,
|
||||
maxObjectKeysLimit = Number.POSITIVE_INFINITY,
|
||||
} = limits;
|
||||
const stack: Array<
|
||||
string | {+[string]: mixed} | {'...(truncated keys)...': number},
|
||||
> = [];
|
||||
const stack: Array<mixed> = [];
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
function replacer(key: string, value: mixed): mixed {
|
||||
@@ -47,10 +45,7 @@ export function createStringifySafeWithLimits(limits: {|
|
||||
return value;
|
||||
}
|
||||
|
||||
let retval:
|
||||
| string
|
||||
| {+[string]: mixed}
|
||||
| $TEMPORARY$object<{'...(truncated keys)...': number}> = value;
|
||||
let retval: mixed = value;
|
||||
if (Array.isArray(value)) {
|
||||
if (stack.length >= maxDepth) {
|
||||
retval = `[ ... array with ${value.length} values ... ]`;
|
||||
|
||||
@@ -22,9 +22,9 @@ export default function useWindowDimensions():
|
||||
useEffect(() => {
|
||||
function handleChange({
|
||||
window,
|
||||
}:
|
||||
| $FlowFixMe
|
||||
| $TEMPORARY$object<{window: DisplayMetrics | DisplayMetricsAndroid}>) {
|
||||
}: {
|
||||
window: DisplayMetrics | DisplayMetricsAndroid,
|
||||
}) {
|
||||
if (
|
||||
dimensions.width !== window.width ||
|
||||
dimensions.height !== window.height ||
|
||||
|
||||
@@ -80,10 +80,12 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
|
||||
}
|
||||
|
||||
_renderFilteredSections(
|
||||
filteredSections: Array<
|
||||
$TEMPORARY$object<{data: Array<T>, key: string, title: string}>,
|
||||
>,
|
||||
): ?React.Element<any> {
|
||||
filteredSections: $ReadOnlyArray<{
|
||||
data: Array<T>,
|
||||
key: string,
|
||||
title: string,
|
||||
}>,
|
||||
): React.Node {
|
||||
if (this.props.page === 'examples_page') {
|
||||
return (
|
||||
<ScrollView
|
||||
|
||||
@@ -19,11 +19,11 @@ const BookmarkTab = ({
|
||||
handleNavBarPress,
|
||||
isBookmarkActive,
|
||||
theme,
|
||||
}: $TEMPORARY$object<{
|
||||
}: {
|
||||
handleNavBarPress: (data: {screen: string}) => void,
|
||||
isBookmarkActive: boolean,
|
||||
theme: RNTesterTheme,
|
||||
}>) => (
|
||||
}) => (
|
||||
<View style={styles.centerBox}>
|
||||
<View
|
||||
style={[
|
||||
|
||||
Reference in New Issue
Block a user