Skip to content

Commit

Permalink
Clean-up $TEMPORARY$object in xplat/js/react-native-github
Browse files Browse the repository at this point in the history
Reviewed By: panagosg7

Differential Revision: D16931667

fbshipit-source-id: d87e5ed02bf7f95005cf0f36c3cd127026189058
  • Loading branch information
logandaniels authored and facebook-github-bot committed Aug 21, 2019
1 parent 219e197 commit 92073d4
Show file tree
Hide file tree
Showing 30 changed files with 54 additions and 68 deletions.
2 changes: 1 addition & 1 deletion IntegrationTests/AsyncStorageTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function testOptimizedMultiGet() {
}

class AsyncStorageTest extends React.Component<{}, $FlowFixMeState> {
state: any | $TEMPORARY$object<{|done: boolean, messages: string|}> = {
state: any | {|done: boolean, messages: string|} = {
messages: 'Initializing...',
done: false,
};
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/ImageCachePolicyTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type State = {
};

class ImageCachePolicyTest extends React.Component<Props, $FlowFixMeState> {
state: $FlowFixMe | $TEMPORARY$object<{||}> = {};
state: $FlowFixMe | {...} = {};

shouldComponentUpdate(nextProps: Props, nextState: State): boolean {
const results: Array<?boolean> = TESTS.map(x => nextState[x]);
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/AnimatedEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function attachNativeEvent(
viewRef: any,
eventName: string,
argMapping: Array<?Mapping>,
): $TEMPORARY$object<{|detach: () => void|}> {
): {|detach: () => void|} {
// Find animated values in `argMapping` and create an array representing their
// key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x'].
const eventMappings = [];
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/animations/DecayAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class DecayAnimation extends Animation {
this.__iterations = config.iterations ?? 1;
}

__getNativeAnimationConfig(): $TEMPORARY$object<{|
__getNativeAnimationConfig(): {|
deceleration: number,
iterations: number,
type: $TEMPORARY$string<'decay'>,
velocity: number,
|}> {
|} {
return {
type: 'decay',
deceleration: this._deceleration,
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/animations/SpringAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class SpringAnimation extends Animation {
invariant(this._mass > 0, 'Mass value must be greater than 0');
}

__getNativeAnimationConfig(): $TEMPORARY$object<{|
__getNativeAnimationConfig(): {|
damping: number,
initialVelocity: number,
iterations: number,
Expand All @@ -149,7 +149,7 @@ class SpringAnimation extends Animation {
stiffness: number,
toValue: any,
type: $TEMPORARY$string<'spring'>,
|}> {
|} {
return {
type: 'spring',
overshootClamping: this._overshootClamping,
Expand Down
4 changes: 1 addition & 3 deletions Libraries/Components/DatePicker/DatePickerIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ type Props = $ReadOnly<{|
* source of truth.
*/
class DatePickerIOS extends React.Component<Props> {
static DefaultProps: $TEMPORARY$object<{|
mode: $TEMPORARY$string<'datetime'>,
|}> = {
static DefaultProps: {|mode: $TEMPORARY$string<'datetime'>|} = {
mode: 'datetime',
};

Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/Keyboard/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type KeyboardEventListener = (e: KeyboardEvent) => void;

let Keyboard:
| NativeEventEmitter
| $TEMPORARY$object<{|
| {|
addListener: (
eventName: KeyboardEventName,
callback: KeyboardEventListener,
Expand All @@ -123,7 +123,7 @@ let Keyboard:
callback: KeyboardEventListener,
) => $FlowFixMe,
scheduleLayoutAnimation: (event: KeyboardEvent) => $FlowFixMe,
|}> = {
|} = {
/**
* The `addListener` function connects a JavaScript function to an identified native
* keyboard notification event.
Expand Down
5 changes: 1 addition & 4 deletions Libraries/Components/Keyboard/KeyboardAvoidingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ type State = {|
* adjusting its height, position, or bottom padding.
*/
class KeyboardAvoidingView extends React.Component<Props, State> {
static defaultProps: $TEMPORARY$object<{|
enabled: boolean,
keyboardVerticalOffset: number,
|}> = {
static defaultProps: {|enabled: boolean, keyboardVerticalOffset: number|} = {
enabled: true,
keyboardVerticalOffset: 0,
};
Expand Down
4 changes: 1 addition & 3 deletions Libraries/Components/Picker/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ class Picker extends React.Component<PickerProps> {

static Item: typeof PickerItem = PickerItem;

static defaultProps: $TEMPORARY$object<{|
mode: $TEMPORARY$string<'dialog'>,
|}> = {
static defaultProps: {|mode: $TEMPORARY$string<'dialog'>|} = {
mode: MODE_DIALOG,
};

Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/StatusBar/StatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ class StatusBar extends React.Component<Props> {
return newEntry;
}

static defaultProps: $TEMPORARY$object<{|
static defaultProps: {|
animated: boolean,
showHideTransition: $TEMPORARY$string<'fade'>,
|}> = {
|} = {
animated: false,
showHideTransition: 'fade',
};
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/View/ReactNativeViewViewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const ReactNativeViewConfig = {
uiViewClassName: 'RCTView',
baseModuleName: null,
Manager: 'ViewManager',
Commands: ({}: $TEMPORARY$object<{||}>),
Constants: ({}: $TEMPORARY$object<{||}>),
Commands: ({}: {...}),
Constants: ({}: {...}),
bubblingEventTypes: {
...ReactNativeViewViewConfigAndroid.bubblingEventTypes,
topBlur: {
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Components/View/ViewNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export type ViewNativeComponentType = Class<

let NativeViewComponent;
let viewConfig:
| $TEMPORARY$object<{||}>
| $TEMPORARY$object<{|
| {...}
| {|
bubblingEventTypes?: $ReadOnly<{
[eventName: string]: $ReadOnly<{|
phasedRegistrationNames: $ReadOnly<{|
Expand All @@ -47,7 +47,7 @@ let viewConfig:
process?: (arg1: any) => any,
|}>,
},
|}>;
|};

// Only use the JS view config in DEV
if (__DEV__) {
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Core/Timers/JSTimers.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function setSendIdleEvents(sendIdleEvents: boolean): void {
NativeTiming.setSendIdleEvents(sendIdleEvents);
}

let ExportedJSTimers: $TEMPORARY$object<{|
let ExportedJSTimers: {|
callIdleCallbacks: (frameTime: number) => any | void,
callImmediates: () => void,
callTimers: (timersToCall: Array<number>) => any | void,
Expand All @@ -512,7 +512,7 @@ let ExportedJSTimers: $TEMPORARY$object<{|
setImmediate: (func: any, ...args: any) => number,
setInterval: (func: any, duration: number, ...args: any) => number,
setTimeout: (func: any, duration: number, ...args: any) => number,
|}>;
|};
if (!NativeTiming) {
console.warn("Timing native module is not available, can't set timers.");
// $FlowFixMe: we can assume timers are generally available
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Experimental/Incremental.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ class Incremental extends React.Component<Props, State> {
_mounted: boolean;
_rendered: boolean;

static defaultProps: $TEMPORARY$object<{|name: string|}> = {
static defaultProps: {|name: string|} = {
name: '',
};

static contextTypes:
| any
| $TEMPORARY$object<{|
| {|
incrementalGroup: React$PropType$Primitive<any>,
incrementalGroupEnabled: React$PropType$Primitive<boolean>,
|}> = {
|} = {
incrementalGroup: PropTypes.object,
incrementalGroupEnabled: PropTypes.bool,
};
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Experimental/IncrementalPresenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class IncrementalPresenter extends React.Component<Props> {

static contextTypes:
| any
| $TEMPORARY$object<{|
| {|
incrementalGroup: React$PropType$Primitive<any>,
incrementalGroupEnabled: React$PropType$Primitive<boolean>,
|}> = {
|} = {
incrementalGroup: PropTypes.object,
incrementalGroupEnabled: PropTypes.bool,
};
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Experimental/WindowedListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ class WindowedListView extends React.Component<Props, State> {
_scrollRef: ?ScrollView;
_viewabilityHelper: ViewabilityHelper;

static defaultProps: $TEMPORARY$object<{|
static defaultProps: {|
disableIncrementalRendering: boolean,
initialNumToRender: number,
maxNumToRender: number,
numToRenderAhead: number,
recomputeRowsBatchingPeriod: number,
renderScrollComponent: (props: any) => React.Node,
viewablePercentThreshold: number,
|}> = {
|} = {
initialNumToRender: 10,
maxNumToRender: 30,
numToRenderAhead: 10,
Expand Down
13 changes: 4 additions & 9 deletions Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,12 @@ export type Props = $ReadOnly<{|
|}>;

class Modal extends React.Component<Props> {
static defaultProps: $TEMPORARY$object<{|
hardwareAccelerated: boolean,
visible: boolean,
|}> = {
static defaultProps: {|hardwareAccelerated: boolean, visible: boolean|} = {
visible: true,
hardwareAccelerated: false,
};

static contextTypes:
| any
| $TEMPORARY$object<{|rootTag: React$PropType$Primitive<number>|}> = {
static contextTypes: any | {|rootTag: React$PropType$Primitive<number>|} = {
rootTag: PropTypes.number,
};

Expand All @@ -162,11 +157,11 @@ class Modal extends React.Component<Props> {

static childContextTypes:
| any
| $TEMPORARY$object<{|virtualizedList: React$PropType$Primitive<any>|}> = {
| {|virtualizedList: React$PropType$Primitive<any>|} = {
virtualizedList: PropTypes.object,
};

getChildContext(): $TEMPORARY$object<{|virtualizedList: null|}> {
getChildContext(): {|virtualizedList: null|} {
// Reset the context so VirtualizedList doesn't get confused by nesting
// in the React tree that doesn't reflect the native component hierarchy.
return {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactNative/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AppContainer extends React.Component<Props, State> {

static childContextTypes:
| any
| $TEMPORARY$object<{|rootTag: React$PropType$Primitive<number>|}> = {
| {|rootTag: React$PropType$Primitive<number>|} = {
rootTag: PropTypes.number,
};

Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactNative/DummyUIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
);
return null;
},
getConstants: (): $TEMPORARY$object<{||}> => ({}),
getConstants: (): {...} => ({}),
getConstantsForViewManager: (viewManagerName: string) => {},
getDefaultEventTypes: (): Array<$FlowFixMe> => [],
playTouchSound: () => {},
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@

'use strict';

const invariant = require('invariant');

import type {
ReactNativeBaseComponentViewConfig,
ViewConfigGetter,
} from './ReactNativeTypes';

const invariant = require('invariant');

// Event configs
const customBubblingEventTypes: $TEMPORARY$object<{||}> = {};
const customDirectEventTypes: $TEMPORARY$object<{||}> = {};
const customBubblingEventTypes: {...} = {};
const customDirectEventTypes: {...} = {};

exports.customBubblingEventTypes = customBubblingEventTypes;
exports.customDirectEventTypes = customDirectEventTypes;
Expand Down
4 changes: 2 additions & 2 deletions Libraries/UTFSequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const deepFreezeAndThrowOnMutationInDev = require('./Utilities/deepFreezeAndThro
* - Source code should be limitted to ASCII.
* - Less chance of typos.
*/
const UTFSequence: $TEMPORARY$object<{|
const UTFSequence: {|
BOM: string,
BULLET: string,
BULLET_SP: string,
Expand All @@ -34,7 +34,7 @@ const UTFSequence: $TEMPORARY$object<{|
PIZZA: string,
TRIANGLE_LEFT: string,
TRIANGLE_RIGHT: string,
|}> = deepFreezeAndThrowOnMutationInDev({
|} = deepFreezeAndThrowOnMutationInDev({
BOM: '\ufeff', // byte order mark
BULLET: '\u2022', // bullet: &#8226;
BULLET_SP: '\u00A0\u2022\u00A0', // &nbsp;&#8226;&nbsp;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/verifyComponentAttributeEquivalence.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
export function getConfigWithoutViewProps(
viewConfig: ReactNativeBaseComponentViewConfig<>,
propName: string,
): $TEMPORARY$object<{||}> {
): {...} {
if (!viewConfig[propName]) {
return {};
}
Expand Down
6 changes: 3 additions & 3 deletions Libraries/YellowBox/UI/YellowBoxPressable.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type State = {|
|};

class YellowBoxPressable extends React.Component<Props, State> {
static defaultProps: $TEMPORARY$object<{|
backgroundColor: $TEMPORARY$object<{|default: string, pressed: string|}>,
|}> = {
static defaultProps: {|
backgroundColor: {|default: string, pressed: string|},
|} = {
backgroundColor: {
default: YellowBoxStyle.getBackgroundColor(0.95),
pressed: YellowBoxStyle.getHighlightColor(1),
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/EventHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class EventHolder {
holdEvent(
eventType: string,
...args: any
): $TEMPORARY$object<{|eventType: string, index: $FlowFixMeEmpty|}> {
): {|eventType: string, index: $FlowFixMeEmpty|} {
this._heldEvents[eventType] = this._heldEvents[eventType] || [];
const eventsOfType = this._heldEvents[eventType];
const key = {
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/components/ListExampleShared.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function getItemLayout(
data: any,
index: number,
horizontal?: boolean,
): $TEMPORARY$object<{|index: number, length: number, offset: number|}> {
): {|index: number, length: number, offset: number|} {
const [length, separator, header] = horizontal
? [HORIZ_WIDTH, 0, HEADER.width]
: [ITEM_HEIGHT, SEPARATOR_HEIGHT, HEADER.height];
Expand Down
4 changes: 2 additions & 2 deletions RNTester/js/components/TextLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ const React = require('react');
const {Picker, Text, View} = require('react-native');

class TextLegend extends React.Component<*, *> {
state: $TEMPORARY$object<{|
state: {|
alignment: $TEMPORARY$string<'left'>,
fontSize: number,
language: $TEMPORARY$string<'english'>,
textMetrics: Array<any>,
|}> = {
|} = {
textMetrics: [],
language: 'english',
alignment: 'left',
Expand Down
4 changes: 2 additions & 2 deletions RNTester/js/examples/MultiColumn/MultiColumnExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ class MultiColumnExample extends React.PureComponent<
> {
state:
| any
| $TEMPORARY$object<{|
| {|
data: Array<Item>,
filterText: string,
fixedHeight: boolean,
logViewable: boolean,
numColumns: number,
virtualized: boolean,
|}> = {
|} = {
data: genItemData(1000),
filterText: '',
fixedHeight: true,
Expand Down
Loading

0 comments on commit 92073d4

Please sign in to comment.