Clean-up $TEMPORARY$object in xplat/js/react-native-github

Reviewed By: panagosg7

Differential Revision: D16931667

fbshipit-source-id: d87e5ed02bf7f95005cf0f36c3cd127026189058
This commit is contained in:
Logan Daniels authored and Facebook Github Bot committed 2019-08-21 09:58:24 -07:00
1 parent 219e1972d6
commit 92073d4a71
30 files changed
+54 -68

No files matched your search

+1 -1
View File
@@ -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,
};
+1 -1
View File
@@ -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]);
+1 -1
View File
@@ -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 = [];
@@ -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,
@@ -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,
@@ -149,7 +149,7 @@ class SpringAnimation extends Animation {
stiffness: number,
toValue: any,
type: $TEMPORARY$string<'spring'>,
|}> {
|} {
return {
type: 'spring',
overshootClamping: this._overshootClamping,
@@ -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',
};
+2 -2
View File
@@ -111,7 +111,7 @@ type KeyboardEventListener = (e: KeyboardEvent) => void;
let Keyboard:
| NativeEventEmitter
| $TEMPORARY$object<{|
| {|
addListener: (
eventName: KeyboardEventName,
callback: KeyboardEventListener,
@@ -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.
@@ -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,
};
+1 -3
View File
@@ -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,
};
+2 -2
View File
@@ -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',
};
@@ -15,8 +15,8 @@ const ReactNativeViewConfig = {
uiViewClassName: 'RCTView',
baseModuleName: null,
Manager: 'ViewManager',
Commands: ({}: $TEMPORARY$object<{||}>),
Constants: ({}: $TEMPORARY$object<{||}>),
Commands: ({}: {...}),
Constants: ({}: {...}),
bubblingEventTypes: {
...ReactNativeViewViewConfigAndroid.bubblingEventTypes,
topBlur: {
@@ -25,8 +25,8 @@ export type ViewNativeComponentType = Class<
let NativeViewComponent;
let viewConfig:
| $TEMPORARY$object<{||}>
| $TEMPORARY$object<{|
| {...}
| {|
bubblingEventTypes?: $ReadOnly<{
[eventName: string]: $ReadOnly<{|
phasedRegistrationNames: $ReadOnly<{|
@@ -47,7 +47,7 @@ let viewConfig:
process?: (arg1: any) => any,
|}>,
},
|}>;
|};
// Only use the JS view config in DEV
if (__DEV__) {
+2 -2
View File
@@ -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,
@@ -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
+3 -3
View File
@@ -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,
};
@@ -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,
};
+2 -2
View File
@@ -170,7 +170,7 @@ class WindowedListView extends React.Component<Props, State> {
_scrollRef: ?ScrollView;
_viewabilityHelper: ViewabilityHelper;
static defaultProps: $TEMPORARY$object<{|
static defaultProps: {|
disableIncrementalRendering: boolean,
initialNumToRender: number,
maxNumToRender: number,
@@ -178,7 +178,7 @@ class WindowedListView extends React.Component<Props, State> {
recomputeRowsBatchingPeriod: number,
renderScrollComponent: (props: any) => React.Node,
viewablePercentThreshold: number,
|}> = {
|} = {
initialNumToRender: 10,
maxNumToRender: 30,
numToRenderAhead: 10,
+4 -9
View File
@@ -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,
};
@@ -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 {
+1 -1
View File
@@ -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,
};
+1 -1
View File
@@ -16,7 +16,7 @@ module.exports = {
);
return null;
},
getConstants: (): $TEMPORARY$object<{||}> => ({}),
getConstants: (): {...} => ({}),
getConstantsForViewManager: (viewManagerName: string) => {},
getDefaultEventTypes: (): Array<$FlowFixMe> => [],
playTouchSound: () => {},
@@ -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;
+2 -2
View File
@@ -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,
@@ -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;
@@ -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 {};
}
+3 -3
View File
@@ -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),
+1 -1
View File
@@ -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 = {
+1 -1
View File
@@ -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];
+2 -2
View File
@@ -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',
@@ -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,
@@ -70,14 +70,14 @@ const CustomSeparatorComponent = ({highlighted, text}) => (
class SectionListExample extends React.PureComponent<{}, $FlowFixMeState> {
state:
| any
| $TEMPORARY$object<{|
| {|
data: Array<Item>,
debug: boolean,
filterText: string,
inverted: boolean,
logViewable: boolean,
virtualized: boolean,
|}> = {
|} = {
data: genItemData(1000),
debug: false,
filterText: '',
@@ -72,9 +72,7 @@ class XHRExampleBinaryUpload extends React.Component<{}, $FlowFixMeState> {
Linking.openURL(url);
}
state:
| $FlowFixMe
| $TEMPORARY$object<{|type: $TEMPORARY$string<'Uint8Array'>|}> = {
state: $FlowFixMe | {|type: $TEMPORARY$string<'Uint8Array'>|} = {
type: 'Uint8Array',
};
+1 -1
View File
@@ -337,7 +337,7 @@ const APIExamples: Array<RNTesterExample> = [
},
];
const Modules: $TEMPORARY$object<{||}> = {};
const Modules: {...} = {};
APIExamples.concat(ComponentExamples).forEach(Example => {
Modules[Example.key] = Example.module;