mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 21:46:07 +08:00
Update FBSource to use Flow 0.22
Reviewed By: gabelevi Differential Revision: D3021265 fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
This commit is contained in:
committed by
Facebook Github Bot 2
parent
dc4d4863a2
commit
b473d496c4
21
.flowconfig
21
.flowconfig
@@ -42,10 +42,25 @@
|
|||||||
# Ignore Website
|
# Ignore Website
|
||||||
.*/website/.*
|
.*/website/.*
|
||||||
|
|
||||||
|
.*/node_modules/is-my-json-valid/test/.*\.json
|
||||||
|
.*/node_modules/iconv-lite/encodings/tables/.*\.json
|
||||||
|
.*/node_modules/y18n/test/.*\.json
|
||||||
|
.*/node_modules/spdx-license-ids/spdx-license-ids.json
|
||||||
|
.*/node_modules/spdx-exceptions/index.json
|
||||||
|
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
|
||||||
|
.*/node_modules/resolve/lib/core.json
|
||||||
|
.*/node_modules/jsonparse/samplejson/.*\.json
|
||||||
|
.*/node_modules/json5/test/.*\.json
|
||||||
|
.*/node_modules/ua-parser-js/test/.*\.json
|
||||||
|
.*/node_modules/builtin-modules/builtin-modules.json
|
||||||
|
.*/node_modules/binary-extensions/binary-extensions.json
|
||||||
|
.*/node_modules/url-regex/tlds.json
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
|
|
||||||
[libs]
|
[libs]
|
||||||
Libraries/react-native/react-native-interface.js
|
Libraries/react-native/react-native-interface.js
|
||||||
|
flow/
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
module.system=haste
|
module.system=haste
|
||||||
@@ -62,9 +77,9 @@ suppress_type=$FlowIssue
|
|||||||
suppress_type=$FlowFixMe
|
suppress_type=$FlowFixMe
|
||||||
suppress_type=$FixMe
|
suppress_type=$FixMe
|
||||||
|
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||||
|
|
||||||
[version]
|
[version]
|
||||||
0.21.0
|
0.22.0
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
export type Example = {
|
export type Example = {
|
||||||
title: string,
|
title: string,
|
||||||
render: () => ?ReactElement<any, any, any>,
|
render: () => ?ReactElement<any>,
|
||||||
description?: string,
|
description?: string,
|
||||||
platform?: string;
|
platform?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ var BoxOnlyExample = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
type ExampleClass = {
|
type ExampleClass = {
|
||||||
Component: ReactClass<any, any, any>,
|
Component: ReactClass<any>,
|
||||||
title: string,
|
title: string,
|
||||||
description: string,
|
description: string,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class UIExplorerExampleList extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeRenderable(example: any): ReactClass<any, any, any> {
|
function makeRenderable(example: any): ReactClass<any> {
|
||||||
return example.examples ?
|
return example.examples ?
|
||||||
createExamplePage(null, example) :
|
createExamplePage(null, example) :
|
||||||
example;
|
example;
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ var UIExplorerPage = React.createClass({
|
|||||||
var ContentWrapper;
|
var ContentWrapper;
|
||||||
var wrapperProps = {};
|
var wrapperProps = {};
|
||||||
if (this.props.noScroll) {
|
if (this.props.noScroll) {
|
||||||
ContentWrapper = (View: ReactClass<any, any, any>);
|
ContentWrapper = (View: ReactClass<any>);
|
||||||
} else {
|
} else {
|
||||||
ContentWrapper = (ScrollView: ReactClass<any, any, any>);
|
ContentWrapper = (ScrollView: ReactClass<any>);
|
||||||
wrapperProps.automaticallyAdjustContentInsets = !this.props.title;
|
wrapperProps.automaticallyAdjustContentInsets = !this.props.title;
|
||||||
wrapperProps.keyboardShouldPersistTaps = true;
|
wrapperProps.keyboardShouldPersistTaps = true;
|
||||||
wrapperProps.keyboardDismissMode = 'interactive';
|
wrapperProps.keyboardDismissMode = 'interactive';
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ var invariant = require('fbjs/lib/invariant');
|
|||||||
import type { Example, ExampleModule } from 'ExampleTypes';
|
import type { Example, ExampleModule } from 'ExampleTypes';
|
||||||
|
|
||||||
var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
var createExamplePage = function(title: ?string, exampleModule: ExampleModule)
|
||||||
: ReactClass<any, any, any> {
|
: ReactClass<any> {
|
||||||
invariant(!!exampleModule.examples, 'The module must have examples');
|
invariant(!!exampleModule.examples, 'The module must have examples');
|
||||||
|
|
||||||
var ExamplePage = React.createClass({
|
var ExamplePage = React.createClass({
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ function _flush(rootNode: AnimatedValue): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
findAnimatedStyles(rootNode);
|
findAnimatedStyles(rootNode);
|
||||||
|
/* $FlowFixMe(site=react_native) */
|
||||||
animatedStyles.forEach(animatedStyle => animatedStyle.update());
|
animatedStyles.forEach(animatedStyle => animatedStyle.update());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ if (__DEV__) {
|
|||||||
|
|
||||||
var runnables = {};
|
var runnables = {};
|
||||||
|
|
||||||
type ComponentProvider = () => ReactClass<any, any, any>;
|
type ComponentProvider = () => ReactClass<any>;
|
||||||
|
|
||||||
type AppConfig = {
|
type AppConfig = {
|
||||||
appKey: string;
|
appKey: string;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var React = require('React');
|
|||||||
var NavigationRootContainer = require('NavigationRootContainer');
|
var NavigationRootContainer = require('NavigationRootContainer');
|
||||||
|
|
||||||
function createNavigationContainer(
|
function createNavigationContainer(
|
||||||
Component: ReactClass<any, any, any>,
|
Component: ReactClass<any>,
|
||||||
): ReactClass {
|
): ReactClass {
|
||||||
class NavigationComponent extends React.Component {
|
class NavigationComponent extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const NavigationAbstractPanResponder = require('NavigationAbstractPanResponder')
|
|||||||
|
|
||||||
const clamp = require('clamp');
|
const clamp = require('clamp');
|
||||||
|
|
||||||
import {
|
import type {
|
||||||
NavigationActionCaller,
|
NavigationActionCaller,
|
||||||
NavigationLayout,
|
NavigationLayout,
|
||||||
NavigationPosition,
|
NavigationPosition,
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ const NetInfo = {
|
|||||||
eventName: ChangeEventName,
|
eventName: ChangeEventName,
|
||||||
handler: Function
|
handler: Function
|
||||||
): void {
|
): void {
|
||||||
|
/* $FlowFixMe(site=react_native) */
|
||||||
const listener = _isConnectedSubscriptions.get(handler);
|
const listener = _isConnectedSubscriptions.get(handler);
|
||||||
NetInfo.removeEventListener(
|
NetInfo.removeEventListener(
|
||||||
eventName,
|
eventName,
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ var AppContainer = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function renderApplication<D, P, S>(
|
function renderApplication<D, P, S>(
|
||||||
RootComponent: ReactClass<D, P, S>,
|
RootComponent: ReactClass<P>,
|
||||||
initialProps: P,
|
initialProps: P,
|
||||||
rootTag: any
|
rootTag: any
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ var AppContainer = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function renderApplication<D, P, S>(
|
function renderApplication<D, P, S>(
|
||||||
RootComponent: ReactClass<D, P, S>,
|
RootComponent: ReactClass<P>,
|
||||||
initialProps: P,
|
initialProps: P,
|
||||||
rootTag: any
|
rootTag: any
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||||
|
|
||||||
export type ComponentInterface = ReactClass<any, any, any> | {
|
export type ComponentInterface = ReactClass<any> | {
|
||||||
name?: string;
|
name?: string;
|
||||||
displayName?: string;
|
displayName?: string;
|
||||||
propTypes: Object;
|
propTypes: Object;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type ReactNativeBaseComponentViewConfig = {
|
|||||||
*/
|
*/
|
||||||
var createReactNativeComponentClass = function(
|
var createReactNativeComponentClass = function(
|
||||||
viewConfig: ReactNativeBaseComponentViewConfig
|
viewConfig: ReactNativeBaseComponentViewConfig
|
||||||
): ReactClass<any, any, any> {
|
): ReactClass<any> {
|
||||||
var Constructor = function(element) {
|
var Constructor = function(element) {
|
||||||
this._currentElement = element;
|
this._currentElement = element;
|
||||||
|
|
||||||
|
|||||||
31
flow/Map.js
Normal file
31
flow/Map.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
// @nolint
|
||||||
|
|
||||||
|
// These annotations are copy/pasted from the built-in Flow definitions for
|
||||||
|
// Native Map.
|
||||||
|
|
||||||
|
declare module "Map" {
|
||||||
|
// Use the name "MapPolyfill" so that we don't get confusing error
|
||||||
|
// messages about "Using Map instead of Map".
|
||||||
|
declare class MapPolyfill<K, V> {
|
||||||
|
@@iterator(): Iterator<[K, V]>;
|
||||||
|
constructor<Key, Value>(_: void): MapPolyfill<Key, Value>;
|
||||||
|
constructor<Key, Value>(_: null): MapPolyfill<Key, Value>;
|
||||||
|
constructor<Key, Value>(iterable: Array<[Key, Value]>): MapPolyfill<Key, Value>;
|
||||||
|
constructor<Key, Value>(iterable: Iterable<[Key, Value]>): MapPolyfill<Key, Value>;
|
||||||
|
clear(): void;
|
||||||
|
delete(key: K): boolean;
|
||||||
|
entries(): Iterator<[K, V]>;
|
||||||
|
forEach(callbackfn: (value: V, index: K, map: MapPolyfill<K, V>) => mixed, thisArg?: any): void;
|
||||||
|
get(key: K): V | void;
|
||||||
|
has(key: K): boolean;
|
||||||
|
keys(): Iterator<K>;
|
||||||
|
set(key: K, value: V): MapPolyfill<K, V>;
|
||||||
|
size: number;
|
||||||
|
values(): Iterator<V>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't "declare class exports" directly, otherwise in error messages our
|
||||||
|
// show up as "exports" instead of "Map" or "MapPolyfill".
|
||||||
|
declare var exports: typeof MapPolyfill;
|
||||||
|
}
|
||||||
26
flow/Set.js
Normal file
26
flow/Set.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
// @nolint
|
||||||
|
|
||||||
|
// These annotations are copy/pasted from the built-in Flow definitions for
|
||||||
|
// Native Set.
|
||||||
|
|
||||||
|
declare module "Set" {
|
||||||
|
// Use the name "SetPolyfill" so that we don't get confusing error
|
||||||
|
// messages about "Using Set instead of Set".
|
||||||
|
declare class SetPolyfill<T> {
|
||||||
|
@@iterator(): Iterator<T>;
|
||||||
|
add(value: T): SetPolyfill<T>;
|
||||||
|
clear(): void;
|
||||||
|
delete(value: T): boolean;
|
||||||
|
entries(): Iterator<[T, T]>;
|
||||||
|
forEach(callbackfn: (value: T, index: T, set: SetPolyfill<T>) => mixed, thisArg?: any): void;
|
||||||
|
has(value: T): boolean;
|
||||||
|
keys(): Iterator<T>;
|
||||||
|
size: number;
|
||||||
|
values(): Iterator<T>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't "declare class exports" directly, otherwise in error messages our
|
||||||
|
// show up as "exports" instead of "Set" or "SetPolyfill".
|
||||||
|
declare var exports: typeof SetPolyfill;
|
||||||
|
}
|
||||||
3
flow/react.js
vendored
Normal file
3
flow/react.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// temporary patches for React.Component and React.Element
|
||||||
|
declare var ReactComponent: typeof React$Component;
|
||||||
|
declare var ReactElement: typeof React$Element;
|
||||||
Reference in New Issue
Block a user