Auto-fix lint errors

Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
This commit is contained in:
David Aurelio 2016-08-09 06:32:41 -07:00 committed by Facebook Github Bot 4
parent 8e2906ae89
commit 94666f16c7
58 changed files with 293 additions and 293 deletions

View File

@ -1036,8 +1036,8 @@ class AnimatedInterpolation extends AnimatedWithChildren {
return value;
}
if (/deg$/.test(value)) {
let degrees = parseFloat(value, 10) || 0;
let radians = degrees * Math.PI / 180.0;
const degrees = parseFloat(value, 10) || 0;
const radians = degrees * Math.PI / 180.0;
return radians;
} else {
// Assume radians
@ -1346,7 +1346,7 @@ class AnimatedStyle extends AnimatedWithChildren {
__getNativeConfig(): Object {
var styleConfig = {};
for (let styleKey in this._style) {
for (const styleKey in this._style) {
if (this._style[styleKey] instanceof Animated) {
styleConfig[styleKey] = this._style[styleKey].__getNativeTag();
}
@ -1475,7 +1475,7 @@ class AnimatedProps extends Animated {
__getNativeConfig(): Object {
var propsConfig = {};
for (let propKey in this._props) {
for (const propKey in this._props) {
var value = this._props[propKey];
if (value instanceof Animated) {
propsConfig[propKey] = value.__getNativeTag();

View File

@ -18,12 +18,12 @@ var normalizeColor = require('normalizeColor');
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
export type InterpolationConfigType = {
inputRange: Array<number>;
outputRange: (Array<number> | Array<string>);
easing?: ((input: number) => number);
extrapolate?: ExtrapolateType;
extrapolateLeft?: ExtrapolateType;
extrapolateRight?: ExtrapolateType;
inputRange: Array<number>,
outputRange: (Array<number> | Array<string>),
easing?: ((input: number) => number),
extrapolate?: ExtrapolateType,
extrapolateLeft?: ExtrapolateType,
extrapolateRight?: ExtrapolateType,
};
var linear = (t) => t;

View File

@ -31,9 +31,9 @@ var runCount = 1;
type ComponentProvider = () => ReactClass<any>;
type AppConfig = {
appKey: string;
component?: ComponentProvider;
run?: Function;
appKey: string,
component?: ComponentProvider,
run?: Function,
};
/**

View File

@ -159,7 +159,7 @@ class AppState extends NativeEventEmitter {
this._eventHandlers[type].get(handler).remove();
this._eventHandlers[type].delete(handler);
}
};
}
AppState = new AppState();

View File

@ -26,10 +26,10 @@ const GRAY = '#999999';
type IndicatorSize = number | 'small' | 'large';
type DefaultProps = {
animating: boolean;
color: any;
hidesWhenStopped: boolean;
size: IndicatorSize;
animating: boolean,
color: any,
hidesWhenStopped: boolean,
size: IndicatorSize,
}
/**

View File

@ -22,7 +22,7 @@ const View = require('View');
const requireNativeComponent = require('requireNativeComponent');
type DefaultProps = {
mode: 'date' | 'time' | 'datetime';
mode: 'date' | 'time' | 'datetime',
};
type Event = Object;

View File

@ -62,7 +62,7 @@ class DatePickerAndroid {
* when using the `minDate` and `maxDate` options.
*/
static async open(options: Object): Promise<Object> {
let optionsMs = options;
const optionsMs = options;
if (optionsMs) {
_toMillis(options, 'date');
_toMillis(options, 'minDate');

View File

@ -22,26 +22,26 @@ const View = require('View');
import type EmitterSubscription from 'EmitterSubscription';
type Rect = {
x: number;
y: number;
width: number;
height: number;
x: number,
y: number,
width: number,
height: number,
};
type ScreenRect = {
screenX: number;
screenY: number;
width: number;
height: number;
screenX: number,
screenY: number,
width: number,
height: number,
};
type KeyboardChangeEvent = {
startCoordinates?: ScreenRect;
endCoordinates: ScreenRect;
duration?: number;
easing?: string;
startCoordinates?: ScreenRect,
endCoordinates: ScreenRect,
duration?: number,
easing?: string,
};
type LayoutEvent = {
nativeEvent: {
layout: Rect;
layout: Rect,
}
};

View File

@ -34,23 +34,23 @@ export type AnnotationDragState = $Enum<{
/**
* Annotation is not being touched.
*/
idle: string;
idle: string,
/**
* Annotation dragging has began.
*/
starting: string;
starting: string,
/**
* Annotation is being dragged.
*/
dragging: string;
dragging: string,
/**
* Annotation dragging is being canceled.
*/
canceling: string;
canceling: string,
/**
* Annotation dragging has ended.
*/
ending: string;
ending: string,
}>;
/**
@ -412,7 +412,7 @@ const MapView = React.createClass({
}));
}
let result = {
const result = {
...annotation,
tintColor: tintColor && processColor(tintColor),
image,
@ -430,8 +430,8 @@ const MapView = React.createClass({
return result;
});
overlays = overlays && overlays.map((overlay: Object) => {
let {id, fillColor, strokeColor} = overlay;
let result = {
const {id, fillColor, strokeColor} = overlay;
const result = {
...overlay,
strokeColor: strokeColor && processColor(strokeColor),
fillColor: fillColor && processColor(fillColor),

View File

@ -79,11 +79,11 @@ class PickerAndroid extends React.Component {
// Translate prop and children into stuff that the native picker understands.
_stateFromProps = (props) => {
var selectedIndex = 0;
let items = ReactChildren.map(props.children, (child, index) => {
const items = ReactChildren.map(props.children, (child, index) => {
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}
let childProps = {
const childProps = {
value: child.props.value,
label: child.props.label,
};

View File

@ -104,11 +104,11 @@ var invariant = require('fbjs/lib/invariant');
var IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
type State = {
isTouching: boolean;
lastMomentumScrollBeginTime: number;
lastMomentumScrollEndTime: number;
observedScrollSinceBecomingResponder: boolean;
becameResponderWhileAnimating: boolean;
isTouching: boolean,
lastMomentumScrollBeginTime: number,
lastMomentumScrollEndTime: number,
observedScrollSinceBecomingResponder: boolean,
becameResponderWhileAnimating: boolean,
};
type Event = Object;
@ -366,7 +366,7 @@ var ScrollResponderMixin = {
* This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
*/
scrollResponderScrollTo: function(
x?: number | { x?: number; y?: number; animated?: boolean },
x?: number | { x?: number, y?: number, animated?: boolean },
y?: number,
animated?: boolean
) {
@ -397,7 +397,7 @@ var ScrollResponderMixin = {
* @platform ios
*/
scrollResponderZoomTo: function(
rect: { x: number; y: number; width: number; height: number; animated?: boolean },
rect: { x: number, y: number, width: number, height: number, animated?: boolean },
animated?: boolean // deprecated, put this inside the rect argument instead
) {
if (Platform.OS === 'android') {

View File

@ -20,8 +20,8 @@ var View = require('View');
var requireNativeComponent = require('requireNativeComponent');
type DefaultProps = {
values: Array<string>;
enabled: boolean;
values: Array<string>,
enabled: boolean,
};
var SEGMENTED_CONTROL_REFERENCE = 'segmentedcontrol';

View File

@ -140,7 +140,7 @@ var Slider = React.createClass({
},
render: function() {
let {style, onValueChange, onSlidingComplete, ...props} = this.props;
const {style, onValueChange, onSlidingComplete, ...props} = this.props;
props.style = [styles.slider, style];
props.onValueChange = onValueChange && ((event: Event) => {

View File

@ -131,7 +131,7 @@ var SliderIOS = React.createClass({
'future versions of React Native. Use the cross-platform Slider ' +
'as a drop-in replacement.');
let {style, onValueChange, onSlidingComplete, ...props} = this.props;
const {style, onValueChange, onSlidingComplete, ...props} = this.props;
props.style = [styles.slider, style];
props.onValueChange = onValueChange && ((event: Event) => {

View File

@ -52,7 +52,7 @@ export type StatusBarAnimation = $Enum<{
}>;
type DefaultProps = {
animated: boolean;
animated: boolean,
};
/**
@ -60,7 +60,7 @@ type DefaultProps = {
*/
function mergePropsStack(propsStack: Array<Object>, defaultValues: Object): Object {
return propsStack.reduce((prev, cur) => {
for (let prop in cur) {
for (const prop in cur) {
if (cur[prop] != null) {
prev[prop] = cur[prop];
}

View File

@ -21,8 +21,8 @@ var View = require('View');
var requireNativeComponent = require('requireNativeComponent');
type DefaultProps = {
value: boolean;
disabled: boolean;
value: boolean,
disabled: boolean,
};
/**

View File

@ -25,8 +25,8 @@ var requireNativeComponent = require('requireNativeComponent');
var SWITCH = 'switch';
type DefaultProps = {
value: boolean;
disabled: boolean;
value: boolean,
disabled: boolean,
};
type Event = Object;

View File

@ -20,8 +20,8 @@ var Touchable = require('Touchable');
type Event = Object;
type State = {
animationID: ?number;
scale: Animated.Value;
animationID: ?number,
scale: Animated.Value,
};
var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};

View File

@ -26,9 +26,9 @@ var VIEWPAGER_REF = 'viewPager';
type Event = Object;
export type ViewPagerScrollState = $Enum<{
idle: string;
dragging: string;
settling: string;
idle: string,
dragging: string,
settling: string,
}>;
/**

View File

@ -52,9 +52,9 @@ const NavigationType = keyMirror({
const JSNavigationScheme = 'react-js-navigation';
type ErrorEvent = {
domain: any;
code: any;
description: any;
domain: any,
code: any,
description: any,
}
type Event = Object;

View File

@ -50,10 +50,10 @@ function defaultGetSectionHeaderData(
type differType = (data1: any, data2: any) => bool;
type ParamType = {
rowHasChanged: differType;
getRowData?: ?typeof defaultGetRowData;
sectionHeaderHasChanged?: ?differType;
getSectionHeaderData?: ?typeof defaultGetSectionHeaderData;
rowHasChanged: differType,
getRowData?: ?typeof defaultGetRowData,
sectionHeaderHasChanged?: ?differType,
getSectionHeaderData?: ?typeof defaultGetSectionHeaderData,
}
/**

View File

@ -43,10 +43,10 @@ const {
} = ReactNative;
type Props = {
children?: ReactElement<any>;
style?: any;
textStyle?: any;
viewProps?: any;
children?: ReactElement<any>,
style?: any,
textStyle?: any,
viewProps?: any,
}
const NavigationHeaderTitle = ({ children, style, textStyle, viewProps }: Props) => (

View File

@ -1258,7 +1258,7 @@ var Navigator = React.createClass({
},
_renderNavigationBar: function() {
let { navigationBar } = this.props;
const { navigationBar } = this.props;
if (!navigationBar) {
return null;
}

View File

@ -84,12 +84,12 @@ export type Props = {
* Called when all the decendents have finished rendering and mounting
* recursively.
*/
onDone?: () => void;
onDone?: () => void,
/**
* Tags instances and associated tasks for easier debugging.
*/
name: string;
children?: any;
name: string,
children?: any,
};
type DefaultProps = {
name: string,
@ -176,11 +176,11 @@ class Incremental extends React.Component<DefaultProps, Props, State> {
}
export type Context = {
incrementalGroupEnabled: boolean;
incrementalGroupEnabled: boolean,
incrementalGroup: ?{
groupId: string;
incrementalCount: number;
};
groupId: string,
incrementalCount: number,
},
};
module.exports = Incremental;

View File

@ -30,12 +30,12 @@ import type {Context} from 'Incremental';
* See Incremental.js for more info.
*/
type Props = {
name: string;
disabled?: boolean;
onDone?: () => void;
onLayout?: (event: Object) => void;
style?: mixed;
children?: any;
name: string,
disabled?: boolean,
onDone?: () => void,
onLayout?: (event: Object) => void,
style?: mixed,
children?: any,
}
class IncrementalPresenter extends React.Component {
props: Props;

View File

@ -84,86 +84,86 @@ type Props = {
* A simple array of data blobs that are passed to the renderRow function in
* order. Note there is no dataSource like in the standard `ListView`.
*/
data: Array<{rowKey: string, rowData: any}>;
data: Array<{rowKey: string, rowData: any}>,
/**
* Takes a data blob from the `data` array prop plus some meta info and should
* return a row.
*/
renderRow: (
rowData: any, sectionIdx: number, rowIdx: number, rowKey: string
) => ?ReactElement<any>;
) => ?ReactElement<any>,
/**
* Rendered when the list is scrolled faster than rows can be rendered.
*/
renderWindowBoundaryIndicator?: () => ?ReactElement<any>;
renderWindowBoundaryIndicator?: () => ?ReactElement<any>,
/**
* Always rendered at the bottom of all the rows.
*/
renderFooter?: () => ?ReactElement<any>;
renderFooter?: () => ?ReactElement<any>,
/**
* Pipes through normal onScroll events from the underlying `ScrollView`.
*/
onScroll?: (event: Object) => void;
onScroll?: (event: Object) => void,
/**
* Called when the rows that are visible in the viewport change.
*/
onVisibleRowsChanged?: (firstIdx: number, count: number) => void;
onVisibleRowsChanged?: (firstIdx: number, count: number) => void,
/**
* Called when the viewability of rows changes, as defined by the
* `viewablePercentThreshold` prop.
*/
onViewableRowsChanged?: (viewableRows: Array<number>) => void;
onViewableRowsChanged?: (viewableRows: Array<number>) => void,
/**
* The percent of a row that must be visible to consider it "viewable".
*/
viewablePercentThreshold: number;
viewablePercentThreshold: number,
/**
* Number of rows to render on first mount.
*/
initialNumToRender: number;
initialNumToRender: number,
/**
* Maximum number of rows to render while scrolling, i.e. the window size.
*/
maxNumToRender: number;
maxNumToRender: number,
/**
* Number of rows to render beyond the viewport. Note that this combined with
* `maxNumToRender` and the number of rows that can fit in one screen will
* determine how many rows to render above the viewport.
*/
numToRenderAhead: number;
numToRenderAhead: number,
/**
* Used to log perf events for async row rendering.
*/
asyncRowPerfEventName?: string;
asyncRowPerfEventName?: string,
/**
* A function that returns the scrollable component in which the list rows
* are rendered. Defaults to returning a ScrollView with the given props.
*/
renderScrollComponent: (props: ?Object) => ReactElement<any>;
renderScrollComponent: (props: ?Object) => ReactElement<any>,
/**
* Use to disable incremental rendering when not wanted, e.g. to speed up initial render.
*/
disableIncrementalRendering: boolean;
disableIncrementalRendering: boolean,
/**
* This determines how frequently events such as scroll and layout can trigger a re-render.
*/
recomputeRowsBatchingPeriod: number;
recomputeRowsBatchingPeriod: number,
/**
* Called when rows will be mounted/unmounted. Mounted rows always form a contiguous block so it is expressed as a
* range of start plus count.
*/
onMountedRowsWillChange?: (firstIdx: number, count: number) => void;
onMountedRowsWillChange?: (firstIdx: number, count: number) => void,
/**
* Change this when you want to make sure the WindowedListView will re-render, for example when the result of
* `renderScrollComponent` might change. It will be compared in `shouldComponentUpdate`.
*/
shouldUpdateToken?: string;
shouldUpdateToken?: string,
};
type State = {
boundaryIndicatorHeight?: number;
firstRow: number;
lastRow: number;
boundaryIndicatorHeight?: number,
firstRow: number,
lastRow: number,
};
class WindowedListView extends React.Component {
props: Props;
@ -573,22 +573,22 @@ type CellProps = {
/**
* Row-specific data passed to renderRow and used in shouldComponentUpdate with ===
*/
rowData: mixed;
rowKey: string;
rowData: mixed,
rowKey: string,
/**
* Renders the actual row contents.
*/
renderRow: (
rowData: mixed, sectionIdx: number, rowIdx: number, rowKey: string
) => ?ReactElement<any>;
) => ?ReactElement<any>,
/**
* Index of the row, passed through to other callbacks.
*/
rowIndex: number;
rowIndex: number,
/**
* Used for marking async begin/end events for row rendering.
*/
asyncRowPerfEventName: ?string;
asyncRowPerfEventName: ?string,
/**
* Initially false to indicate the cell should be rendered "offscreen" with position: absolute so that incremental
* rendering doesn't cause things to jump around. Once onNewLayout is called after offscreen rendering has completed,
@ -597,21 +597,21 @@ type CellProps = {
* This is coordinated outside this component so the parent can syncronize this re-render with managing the
* placeholder sizing.
*/
includeInLayout: boolean;
includeInLayout: boolean,
/**
* Updates the parent with the latest layout. Only called when incremental rendering is done and triggers the parent
* to re-render this row with includeInLayout true.
*/
onNewLayout: (params: {rowKey: string, layout: Object}) => void;
onNewLayout: (params: {rowKey: string, layout: Object}) => void,
/**
* Used to track when rendering is in progress so the parent can avoid wastedful re-renders that are just going to be
* invalidated once the cell finishes.
*/
onProgressChange: (progress: {rowKey: string; inProgress: boolean}) => void;
onProgressChange: (progress: {rowKey: string, inProgress: boolean}) => void,
/**
* Used to invalidate the layout so the parent knows it needs to compensate for the height in the placeholder size.
*/
onWillUnmount: (rowKey: string) => void;
onWillUnmount: (rowKey: string) => void,
};
class CellRenderer extends React.Component {
props: CellProps;

View File

@ -24,10 +24,10 @@ var subscriptions = [];
var updatesEnabled = false;
type GeoOptions = {
timeout: number;
maximumAge: number;
enableHighAccuracy: bool;
distanceFilter: number;
timeout: number,
maximumAge: number,
enableHighAccuracy: bool,
distanceFilter: number,
}
/**

View File

@ -19,33 +19,33 @@ type ImageCropData = {
* image's coordinate space.
*/
offset: {
x: number;
y: number;
};
x: number,
y: number,
},
/**
* The size (dimensions) of the cropped image, specified in the original
* image's coordinate space.
*/
size: {
width: number;
height: number;
};
width: number,
height: number,
},
/**
* (Optional) size to scale the cropped image to.
*/
displaySize?: ?{
width: number;
height: number;
};
width: number,
height: number,
},
/**
* (Optional) the resizing mode to use when scaling the image. If the
* `displaySize` param is not specified, this has no effect.
*/
resizeMode?: ?$Enum<{
contain: string;
cover: string;
stretch: string;
}>;
contain: string,
cover: string,
stretch: string,
}>,
};
class ImageEditor {

View File

@ -12,5 +12,5 @@
'use strict';
export type ImageSource = {
uri: string;
uri: string,
};

View File

@ -22,7 +22,7 @@ var ElementBox = require('ElementBox');
var PropTypes = React.PropTypes;
type EventLike = {
nativeEvent: Object;
nativeEvent: Object,
};
class InspectorOverlay extends React.Component {

View File

@ -14,8 +14,8 @@
const performanceNow = require('performanceNow');
type Handler = {
onIterate?: () => void;
onStall: (params: {lastInterval: number}) => string;
onIterate?: () => void,
onStall: (params: {lastInterval: number}) => string,
};
/**

View File

@ -17,8 +17,8 @@ let _cachedDevServerURL: ?string;
const FALLBACK = 'http://localhost:8081/';
type DevServerInfo = {
url: string;
bundleLoadedFromServer: boolean;
url: string,
bundleLoadedFromServer: boolean,
};
/**

View File

@ -12,9 +12,9 @@
'use strict';
export type StackFrame = {
file: string;
lineNumber: number;
column: number;
file: string,
lineNumber: number,
column: number,
};
var stacktraceParser = require('stacktrace-parser');

View File

@ -47,12 +47,12 @@ var animChecker = createStrictShapeTypeChecker({
});
type Anim = {
duration?: number;
delay?: number;
springDamping?: number;
initialVelocity?: number;
type?: $Enum<typeof TypesEnum>;
property?: $Enum<typeof PropertiesEnum>;
duration?: number,
delay?: number,
springDamping?: number,
initialVelocity?: number,
type?: $Enum<typeof TypesEnum>,
property?: $Enum<typeof PropertiesEnum>,
}
var configChecker = createStrictShapeTypeChecker({
@ -63,10 +63,10 @@ var configChecker = createStrictShapeTypeChecker({
});
type Config = {
duration: number;
create?: Anim;
update?: Anim;
delete?: Anim;
duration: number,
create?: Anim,
update?: Anim,
delete?: Anim,
}
function configureNext(config: Config, onAnimationDidEnd?: Function) {

View File

@ -16,13 +16,13 @@ type FormDataNameValuePair = [string, FormDataValue];
type Headers = {[name: string]: string};
type FormDataPart = {
string: string;
headers: Headers;
string: string,
headers: Headers,
} | {
uri: string;
headers: Headers;
name?: string;
type?: string;
uri: string,
headers: Headers,
name?: string,
type?: string,
};
/**

View File

@ -23,37 +23,37 @@ const NetInfoEventEmitter = new NativeEventEmitter(RCTNetInfo);
const DEVICE_CONNECTIVITY_EVENT = 'networkStatusDidChange';
type ChangeEventName = $Enum<{
change: string;
change: string,
}>;
type ReachabilityStateIOS = $Enum<{
cell: string;
none: string;
unknown: string;
wifi: string;
cell: string,
none: string,
unknown: string,
wifi: string,
}>;
type ConnectivityStateAndroid = $Enum<{
NONE: string;
MOBILE: string;
WIFI: string;
MOBILE_MMS: string;
MOBILE_SUPL: string;
MOBILE_DUN: string;
MOBILE_HIPRI: string;
WIMAX: string;
BLUETOOTH: string;
DUMMY: string;
ETHERNET: string;
MOBILE_FOTA: string;
MOBILE_IMS: string;
MOBILE_CBS: string;
WIFI_P2P: string;
MOBILE_IA: string;
MOBILE_EMERGENCY: string;
PROXY: string;
VPN: string;
UNKNOWN: string;
NONE: string,
MOBILE: string,
WIFI: string,
MOBILE_MMS: string,
MOBILE_SUPL: string,
MOBILE_DUN: string,
MOBILE_HIPRI: string,
WIMAX: string,
BLUETOOTH: string,
DUMMY: string,
ETHERNET: string,
MOBILE_FOTA: string,
MOBILE_IMS: string,
MOBILE_CBS: string,
WIFI_P2P: string,
MOBILE_IA: string,
MOBILE_EMERGENCY: string,
PROXY: string,
VPN: string,
UNKNOWN: string,
}>;

View File

@ -14,9 +14,9 @@
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
export type ComponentInterface = ReactClass<any> | {
name?: string;
displayName?: string;
propTypes: Object;
name?: string,
displayName?: string,
propTypes: Object,
};
function verifyPropTypes(

View File

@ -16,7 +16,7 @@ var RCTSettingsManager = require('NativeModules').SettingsManager;
var invariant = require('fbjs/lib/invariant');
var subscriptions: Array<{keys: Array<string>; callback: ?Function}> = [];
var subscriptions: Array<{keys: Array<string>, callback: ?Function}> = [];
var Settings = {
_settings: RCTSettingsManager && RCTSettingsManager.settings,

View File

@ -263,13 +263,13 @@ var AsyncStorage = {
//
// Is there a way to avoid using the map but fix the bug in this breaking test?
// https://github.com/facebook/react-native/commit/8dd8ad76579d7feef34c014d387bf02065692264
let map = {};
const map = {};
result.forEach(([key, value]) => map[key] = value);
const reqLength = getRequests.length;
for (let i = 0; i < reqLength; i++) {
const request = getRequests[i];
const requestKeys = request.keys;
let requestResult = requestKeys.map(key => [key, map[key]]);
const requestResult = requestKeys.map(key => [key, map[key]]);
request.callback && request.callback(null, requestResult);
request.resolve && request.resolve(requestResult);
}

View File

@ -308,10 +308,10 @@ const Text = React.createClass({
});
type RectOffset = {
top: number;
left: number;
right: number;
bottom: number;
top: number,
left: number,
right: number,
bottom: number,
}
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};

View File

@ -18,9 +18,9 @@ var DialogModuleAndroid = require('NativeModules').DialogManagerAndroid;
import type { AlertType, AlertButtonStyle } from 'AlertIOS';
type Buttons = Array<{
text?: string;
onPress?: ?Function;
style?: AlertButtonStyle;
text?: string,
onPress?: ?Function,
style?: AlertButtonStyle,
}>;
type Options = {
@ -113,13 +113,13 @@ class AlertAndroid {
var buttonNegative = validButtons.pop();
var buttonNeutral = validButtons.pop();
if (buttonNeutral) {
config = {...config, buttonNeutral: buttonNeutral.text || '' }
config = {...config, buttonNeutral: buttonNeutral.text || '' };
}
if (buttonNegative) {
config = {...config, buttonNegative: buttonNegative.text || '' }
config = {...config, buttonNegative: buttonNegative.text || '' };
}
if (buttonPositive) {
config = {...config, buttonPositive: buttonPositive.text || '' }
config = {...config, buttonPositive: buttonPositive.text || '' };
}
DialogModuleAndroid.showAlert(
config,

View File

@ -21,19 +21,19 @@ export type AlertType = $Enum<{
/**
* Default alert with no inputs
*/
'default': string;
'default': string,
/**
* Plain text input alert
*/
'plain-text': string;
'plain-text': string,
/**
* Secure text input alert
*/
'secure-text': string;
'secure-text': string,
/**
* Login and password alert
*/
'login-password': string;
'login-password': string,
}>;
/**
@ -43,15 +43,15 @@ export type AlertButtonStyle = $Enum<{
/**
* Default button style
*/
'default': string;
'default': string,
/**
* Cancel button style
*/
'cancel': string;
'cancel': string,
/**
* Destructive button style
*/
'destructive': string;
'destructive': string,
}>;
/**
@ -65,15 +65,15 @@ type ButtonsArray = Array<{
/**
* Button label
*/
text?: string;
text?: string,
/**
* Callback function when button pressed
*/
onPress?: ?Function;
onPress?: ?Function,
/**
* Button style
*/
style?: AlertButtonStyle;
style?: AlertButtonStyle,
}>;
/**

View File

@ -17,7 +17,7 @@ var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
var DEVICE_BACK_EVENT = 'hardwareBackPress';
type BackPressEventName = $Enum<{
backPress: string;
backPress: string,
}>;
var _backPressSubscriptions = new Set();
@ -30,7 +30,7 @@ RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function() {
if (subscriptions[i]()) {
invokeDefault = false;
break;
};
}
}
if (invokeDefault) {

View File

@ -109,13 +109,13 @@ Error: ${e.message}`
: eval;
code = [
`__accept(`,
'__accept(',
`${id},`,
`function(global,require,module,exports){`,
'function(global,require,module,exports){',
`${code}`,
'\n},',
`${JSON.stringify(inverseDependencies)}`,
`);`,
');',
].join('');
injectFunction(code, sourceURLs[i]);

View File

@ -98,7 +98,7 @@ class MessageQueue {
console.log(`${info.type == TO_JS ? 'N->JS' : 'JS->N'} : ` +
`${info.module ? (info.module + '.') : ''}${info.method}` +
`(${JSON.stringify(info.args)})`);
}
};
} else if (spyOrToggle === false) {
MessageQueue.prototype.__spy = null;
} else {

View File

@ -18,8 +18,8 @@ var invariant = require('fbjs/lib/invariant');
var performanceNow = require('fbjs/lib/performanceNow');
type perfModule = {
start: () => void;
stop: () => void;
start: () => void,
stop: () => void,
}
var perfModules = [];

View File

@ -10,29 +10,29 @@
*/
'use strict';
var remoteModulesConfig = {
"RemoteModule1": {
"moduleID":0,
"methods":{
"remoteMethod1":{
"type":"remote",
"methodID":0
'RemoteModule1': {
'moduleID':0,
'methods':{
'remoteMethod1':{
'type':'remote',
'methodID':0
},
"remoteMethod2":{
"type":"remote",
"methodID":1
'remoteMethod2':{
'type':'remote',
'methodID':1
}
}
},
"RemoteModule2":{
"moduleID":1,
"methods":{
"remoteMethod1":{
"type":"remote",
"methodID":0
'RemoteModule2':{
'moduleID':1,
'methods':{
'remoteMethod1':{
'type':'remote',
'methodID':0
},
"remoteMethod2":{
"type":"remote",
"methodID":1
'remoteMethod2':{
'type':'remote',
'methodID':1
}
}
}
@ -42,29 +42,29 @@ var remoteModulesConfig = {
* These actually exist in the __tests__ folder.
*/
var localModulesConfig = {
"MessageQueueTestModule1": {
"moduleID":"MessageQueueTestModule1",
"methods":{
"testHook1":{
"type":"local",
"methodID":"testHook1"
'MessageQueueTestModule1': {
'moduleID':'MessageQueueTestModule1',
'methods':{
'testHook1':{
'type':'local',
'methodID':'testHook1'
},
"testHook2":{
"type":"local",
"methodID":"testHook2"
'testHook2':{
'type':'local',
'methodID':'testHook2'
}
}
},
"MessageQueueTestModule2": {
"moduleID":"MessageQueueTestModule2",
"methods": {
"runLocalCode":{
"type":"local",
"methodID":"runLocalCode"
'MessageQueueTestModule2': {
'moduleID':'MessageQueueTestModule2',
'methods': {
'runLocalCode':{
'type':'local',
'methodID':'runLocalCode'
},
"runLocalCode2":{
"type":"local",
"methodID":"runLocalCode2"
'runLocalCode2':{
'type':'local',
'methodID':'runLocalCode2'
}
}
}

View File

@ -64,7 +64,7 @@ describe('MessageQueue', function() {
it('should enqueue native calls', () => {
queue.__nativeCall(0, 1, [2]);
let flushedQueue = queue.flushedQueue();
const flushedQueue = queue.flushedQueue();
assertQueue(flushedQueue, 0, 0, 1, [2]);
});
@ -77,13 +77,13 @@ describe('MessageQueue', function() {
it('should generate native modules', () => {
queue.RemoteModules.RemoteModule1.remoteMethod1('foo');
let flushedQueue = queue.flushedQueue();
const flushedQueue = queue.flushedQueue();
assertQueue(flushedQueue, 0, 0, 0, ['foo']);
});
it('should store callbacks', () => {
queue.RemoteModules.RemoteModule1.remoteMethod2('foo', () => {}, () => {});
let flushedQueue = queue.flushedQueue();
const flushedQueue = queue.flushedQueue();
assertQueue(flushedQueue, 0, 0, 1, ['foo', 0, 1]);
});
@ -111,8 +111,8 @@ describe('MessageQueue', function() {
// First we're going to call into this (overriden) test hook pretending to
// be a remote module making a "local" invocation into JS.
let onFail = jasmine.createSpy();
let onSucc = jasmine.createSpy();
const onFail = jasmine.createSpy();
const onSucc = jasmine.createSpy();
MessageQueueTestModule1.testHook1 = function() {
// Then inside of this local module, we're going to fire off a remote
// request.
@ -173,7 +173,7 @@ describe('MessageQueue', function() {
var secondSuccCBID = resultingRemoteInvocations[2][1][3];
// Trigger init
queue.RemoteModules
queue.RemoteModules;
// Handle the first remote invocation by signaling failure.
// -------------------------------------------------------
queue.__invokeCallback(firstFailCBID, ['firstFailure']);

View File

@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
"use strict";
'use strict';
jest.unmock('truncate');

View File

@ -49,6 +49,6 @@ module.exports = function(promise: Promise<any>, callbacks: Array<Function>, typ
err => callback(err)
);
default:
throw new Error(`Type of callbacks not specified. Must be one of 'success-first', 'error-first', 'single-callback-value-first', or 'node'`);
throw new Error('Type of callbacks not specified. Must be one of \'success-first\', \'error-first\', \'single-callback-value-first\', or \'node\'');
}
};

View File

@ -12,10 +12,10 @@
'use strict';
type Inset = {
top: ?number;
left: ?number;
right: ?number;
bottom: ?number;
top: ?number,
left: ?number,
right: ?number,
bottom: ?number,
}
var dummyInsets = {

View File

@ -12,8 +12,8 @@
'use strict';
type Point = {
x: ?number;
y: ?number;
x: ?number,
y: ?number,
}
var dummyPoint = {x: undefined, y: undefined};

View File

@ -12,9 +12,9 @@
'use strict';
type truncateOptions = {
breakOnWords: boolean;
minDelta: number;
elipsis: string;
breakOnWords: boolean,
minDelta: number,
elipsis: string,
}
const defaultOptions = {