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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,23 +34,23 @@ export type AnnotationDragState = $Enum<{
/** /**
* Annotation is not being touched. * Annotation is not being touched.
*/ */
idle: string; idle: string,
/** /**
* Annotation dragging has began. * Annotation dragging has began.
*/ */
starting: string; starting: string,
/** /**
* Annotation is being dragged. * Annotation is being dragged.
*/ */
dragging: string; dragging: string,
/** /**
* Annotation dragging is being canceled. * Annotation dragging is being canceled.
*/ */
canceling: string; canceling: string,
/** /**
* Annotation dragging has ended. * Annotation dragging has ended.
*/ */
ending: string; ending: string,
}>; }>;
/** /**
@ -412,7 +412,7 @@ const MapView = React.createClass({
})); }));
} }
let result = { const result = {
...annotation, ...annotation,
tintColor: tintColor && processColor(tintColor), tintColor: tintColor && processColor(tintColor),
image, image,
@ -430,8 +430,8 @@ const MapView = React.createClass({
return result; return result;
}); });
overlays = overlays && overlays.map((overlay: Object) => { overlays = overlays && overlays.map((overlay: Object) => {
let {id, fillColor, strokeColor} = overlay; const {id, fillColor, strokeColor} = overlay;
let result = { const result = {
...overlay, ...overlay,
strokeColor: strokeColor && processColor(strokeColor), strokeColor: strokeColor && processColor(strokeColor),
fillColor: fillColor && processColor(fillColor), 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. // Translate prop and children into stuff that the native picker understands.
_stateFromProps = (props) => { _stateFromProps = (props) => {
var selectedIndex = 0; 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) { if (child.props.value === props.selectedValue) {
selectedIndex = index; selectedIndex = index;
} }
let childProps = { const childProps = {
value: child.props.value, value: child.props.value,
label: child.props.label, label: child.props.label,
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,8 +20,8 @@ var Touchable = require('Touchable');
type Event = Object; type Event = Object;
type State = { type State = {
animationID: ?number; animationID: ?number,
scale: Animated.Value; scale: Animated.Value,
}; };
var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; 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; type Event = Object;
export type ViewPagerScrollState = $Enum<{ export type ViewPagerScrollState = $Enum<{
idle: string; idle: string,
dragging: string; dragging: string,
settling: string; settling: string,
}>; }>;
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -84,86 +84,86 @@ type Props = {
* A simple array of data blobs that are passed to the renderRow function in * 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`. * 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 * Takes a data blob from the `data` array prop plus some meta info and should
* return a row. * return a row.
*/ */
renderRow: ( renderRow: (
rowData: any, sectionIdx: number, rowIdx: number, rowKey: string rowData: any, sectionIdx: number, rowIdx: number, rowKey: string
) => ?ReactElement<any>; ) => ?ReactElement<any>,
/** /**
* Rendered when the list is scrolled faster than rows can be rendered. * 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. * Always rendered at the bottom of all the rows.
*/ */
renderFooter?: () => ?ReactElement<any>; renderFooter?: () => ?ReactElement<any>,
/** /**
* Pipes through normal onScroll events from the underlying `ScrollView`. * 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. * 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 * Called when the viewability of rows changes, as defined by the
* `viewablePercentThreshold` prop. * `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". * 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. * 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. * 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 * 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 * `maxNumToRender` and the number of rows that can fit in one screen will
* determine how many rows to render above the viewport. * determine how many rows to render above the viewport.
*/ */
numToRenderAhead: number; numToRenderAhead: number,
/** /**
* Used to log perf events for async row rendering. * 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 * A function that returns the scrollable component in which the list rows
* are rendered. Defaults to returning a ScrollView with the given props. * 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. * 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. * 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 * 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. * 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 * 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`. * `renderScrollComponent` might change. It will be compared in `shouldComponentUpdate`.
*/ */
shouldUpdateToken?: string; shouldUpdateToken?: string,
}; };
type State = { type State = {
boundaryIndicatorHeight?: number; boundaryIndicatorHeight?: number,
firstRow: number; firstRow: number,
lastRow: number; lastRow: number,
}; };
class WindowedListView extends React.Component { class WindowedListView extends React.Component {
props: Props; props: Props;
@ -573,22 +573,22 @@ type CellProps = {
/** /**
* Row-specific data passed to renderRow and used in shouldComponentUpdate with === * Row-specific data passed to renderRow and used in shouldComponentUpdate with ===
*/ */
rowData: mixed; rowData: mixed,
rowKey: string; rowKey: string,
/** /**
* Renders the actual row contents. * Renders the actual row contents.
*/ */
renderRow: ( renderRow: (
rowData: mixed, sectionIdx: number, rowIdx: number, rowKey: string rowData: mixed, sectionIdx: number, rowIdx: number, rowKey: string
) => ?ReactElement<any>; ) => ?ReactElement<any>,
/** /**
* Index of the row, passed through to other callbacks. * Index of the row, passed through to other callbacks.
*/ */
rowIndex: number; rowIndex: number,
/** /**
* Used for marking async begin/end events for row rendering. * 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 * 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, * 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 * This is coordinated outside this component so the parent can syncronize this re-render with managing the
* placeholder sizing. * placeholder sizing.
*/ */
includeInLayout: boolean; includeInLayout: boolean,
/** /**
* Updates the parent with the latest layout. Only called when incremental rendering is done and triggers the parent * 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. * 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 * 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. * 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. * 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 { class CellRenderer extends React.Component {
props: CellProps; props: CellProps;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ var RCTSettingsManager = require('NativeModules').SettingsManager;
var invariant = require('fbjs/lib/invariant'); var invariant = require('fbjs/lib/invariant');
var subscriptions: Array<{keys: Array<string>; callback: ?Function}> = []; var subscriptions: Array<{keys: Array<string>, callback: ?Function}> = [];
var Settings = { var Settings = {
_settings: RCTSettingsManager && RCTSettingsManager.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? // 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 // https://github.com/facebook/react-native/commit/8dd8ad76579d7feef34c014d387bf02065692264
let map = {}; const map = {};
result.forEach(([key, value]) => map[key] = value); result.forEach(([key, value]) => map[key] = value);
const reqLength = getRequests.length; const reqLength = getRequests.length;
for (let i = 0; i < reqLength; i++) { for (let i = 0; i < reqLength; i++) {
const request = getRequests[i]; const request = getRequests[i];
const requestKeys = request.keys; 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.callback && request.callback(null, requestResult);
request.resolve && request.resolve(requestResult); request.resolve && request.resolve(requestResult);
} }

View File

@ -308,10 +308,10 @@ const Text = React.createClass({
}); });
type RectOffset = { type RectOffset = {
top: number; top: number,
left: number; left: number,
right: number; right: number,
bottom: number; bottom: number,
} }
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; 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'; import type { AlertType, AlertButtonStyle } from 'AlertIOS';
type Buttons = Array<{ type Buttons = Array<{
text?: string; text?: string,
onPress?: ?Function; onPress?: ?Function,
style?: AlertButtonStyle; style?: AlertButtonStyle,
}>; }>;
type Options = { type Options = {
@ -113,13 +113,13 @@ class AlertAndroid {
var buttonNegative = validButtons.pop(); var buttonNegative = validButtons.pop();
var buttonNeutral = validButtons.pop(); var buttonNeutral = validButtons.pop();
if (buttonNeutral) { if (buttonNeutral) {
config = {...config, buttonNeutral: buttonNeutral.text || '' } config = {...config, buttonNeutral: buttonNeutral.text || '' };
} }
if (buttonNegative) { if (buttonNegative) {
config = {...config, buttonNegative: buttonNegative.text || '' } config = {...config, buttonNegative: buttonNegative.text || '' };
} }
if (buttonPositive) { if (buttonPositive) {
config = {...config, buttonPositive: buttonPositive.text || '' } config = {...config, buttonPositive: buttonPositive.text || '' };
} }
DialogModuleAndroid.showAlert( DialogModuleAndroid.showAlert(
config, config,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ jest.unmock('groupByEveryN');
describe('groupByEveryN', () => { describe('groupByEveryN', () => {
var groupByEveryN = require('groupByEveryN'); var groupByEveryN = require('groupByEveryN');
it ('should group by with different n', () => { it('should group by with different n', () => {
expect(groupByEveryN([1, 2, 3, 4, 5, 6, 7, 8, 9], 1)) expect(groupByEveryN([1, 2, 3, 4, 5, 6, 7, 8, 9], 1))
.toEqual([[1], [2], [3], [4], [5], [6], [7], [8], [9]]); .toEqual([[1], [2], [3], [4], [5], [6], [7], [8], [9]]);
expect(groupByEveryN([1, 2, 3, 4, 5, 6, 7, 8, 9], 2)) expect(groupByEveryN([1, 2, 3, 4, 5, 6, 7, 8, 9], 2))
@ -25,7 +25,7 @@ describe('groupByEveryN', () => {
.toEqual([[1, 2, 3, 4], [5, 6, 7, 8], [9, null, null, null]]); .toEqual([[1, 2, 3, 4], [5, 6, 7, 8], [9, null, null, null]]);
}); });
it ('should fill with null', () => { it('should fill with null', () => {
expect(groupByEveryN([], 4)) expect(groupByEveryN([], 4))
.toEqual([]); .toEqual([]);
expect(groupByEveryN([1], 4)) expect(groupByEveryN([1], 4))

View File

@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
* *
*/ */
"use strict"; 'use strict';
jest.unmock('truncate'); jest.unmock('truncate');
@ -15,37 +15,37 @@ describe('truncate', () => {
var truncate = require('truncate'); var truncate = require('truncate');
it ('should truncate', () => { it('should truncate', () => {
expect(truncate('Hello, world.', 5)) expect(truncate('Hello, world.', 5))
.toBe('He...'); .toBe('He...');
}); });
it ('should not truncate', () => { it('should not truncate', () => {
expect(truncate('Hello, world.', 50)) expect(truncate('Hello, world.', 50))
.toBe('Hello, world.'); .toBe('Hello, world.');
}); });
it ('should not truncate more than minDelta chars.', () => { it('should not truncate more than minDelta chars.', () => {
expect(truncate('Hello, world.', 7, {minDelta: 10})) expect(truncate('Hello, world.', 7, {minDelta: 10}))
.toBe('Hello, world.'); .toBe('Hello, world.');
expect(truncate('Hello, world.', 7, {minDelta: 9})) expect(truncate('Hello, world.', 7, {minDelta: 9}))
.toBe('Hell...'); .toBe('Hell...');
}); });
it ('should break in the middle of words', () => { it('should break in the middle of words', () => {
expect(truncate('Hello, world. How are you?', 18, {breakOnWords: false})) expect(truncate('Hello, world. How are you?', 18, {breakOnWords: false}))
.toBe('Hello, world. H...'); .toBe('Hello, world. H...');
expect(truncate('Hello, world.\nHow are you?', 18, {breakOnWords: false})) expect(truncate('Hello, world.\nHow are you?', 18, {breakOnWords: false}))
.toBe('Hello, world.\nHo...'); .toBe('Hello, world.\nHo...');
}); });
it ('should break at word boundaries', () => { it('should break at word boundaries', () => {
expect(truncate('Hello, world. How are you?', 18, {breakOnWords: true})) expect(truncate('Hello, world. How are you?', 18, {breakOnWords: true}))
.toBe('Hello, world....'); .toBe('Hello, world....');
expect(truncate('Hello, world.\nHow are you?', 18, {breakOnWords: true})) expect(truncate('Hello, world.\nHow are you?', 18, {breakOnWords: true}))
.toBe('Hello, world....'); .toBe('Hello, world....');
}); });
it ('should uses custom elipses', () => { it('should uses custom elipses', () => {
expect(truncate('Hello, world.', 9, {elipsis: '&middot'})) expect(truncate('Hello, world.', 9, {elipsis: '&middot'}))
.toBe('He&middot'); .toBe('He&middot');
}); });
it ('shouldn\'t barf with weird input', () => { it('shouldn\'t barf with weird input', () => {
expect(truncate('Hello, world.', 0)) expect(truncate('Hello, world.', 0))
.toBe('Hello,...'); .toBe('Hello,...');
expect(truncate('Hello, world.', -132)) expect(truncate('Hello, world.', -132))

View File

@ -49,6 +49,6 @@ module.exports = function(promise: Promise<any>, callbacks: Array<Function>, typ
err => callback(err) err => callback(err)
); );
default: 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'; 'use strict';
type Inset = { type Inset = {
top: ?number; top: ?number,
left: ?number; left: ?number,
right: ?number; right: ?number,
bottom: ?number; bottom: ?number,
} }
var dummyInsets = { var dummyInsets = {

View File

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

View File

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