update flowification of react-native

Reviewed By: frantic, gabelevi

Differential Revision: D3436342

fbshipit-source-id: 7630eac4601d0768f57dc9fc945595039067eceb
This commit is contained in:
Basil Hosmer 2016-06-16 15:34:51 -07:00 committed by Facebook Github Bot 9
parent 92d6632d7a
commit b4a4c71a68
3 changed files with 27 additions and 68 deletions

View File

@ -1,71 +1,13 @@
[ignore] [ignore]
# We fork some components by platform. # We fork some components by platform.
.*/*.web.js
.*/*.android.js .*/*.android.js
# Some modules have their own node_modules with overlap # Ignore templates with `@flow` in header
.*/node_modules/node-haste/.*
# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*
# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/ErrorUtils.js
# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js
.*/__mocks__/.*
.*/__tests__/.*
.*/commoner/test/source/widget/share.js
# Ignore commoner tests
.*/node_modules/commoner/test/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
# Ignore jest
.*/node_modules/jest-cli/.*
# Ignore Website
.*/website/.*
# Ignore generators
.*/local-cli/generator.* .*/local-cli/generator.*
# Ignore BUCK generated folders # Ignore malformed json
.*\.buckd/
# Ignore RNPM
.*/local-cli/rnpm/.*
.*/node_modules/is-my-json-valid/test/.*\.json
.*/node_modules/iconv-lite/encodings/tables/.*\.json
.*/node_modules/y18n/test/.*\.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
.*/node_modules/joi/.*\.json
.*/node_modules/isemail/.*\.json
.*/node_modules/tr46/.*\.json
[include] [include]

View File

@ -59,7 +59,7 @@ import type {
type Props = { type Props = {
direction: NavigationGestureDirection, direction: NavigationGestureDirection,
navigationState: NavigationState, navigationState: NavigationState,
onNavigateBack: ?Function, onNavigateBack?: Function,
renderOverlay: ?NavigationSceneRenderer, renderOverlay: ?NavigationSceneRenderer,
renderScene: NavigationSceneRenderer, renderScene: NavigationSceneRenderer,
style: any, style: any,

View File

@ -16,14 +16,31 @@
*/ */
'use strict'; 'use strict';
// Export ReactNative, plus some native additions. // Export some ReactNative properties, plus native additions.
// //
// The use of Object.create/assign is to work around a Flow bug (#6560135).
// Once that is fixed, change this back to // Our ReactNative.js has had its types stripped, so here we
// need to enumerate and type the properties we need access to.
// //
// var ReactNative = {...require('React'), /* additions */} var ReactNativeInternal = (require('ReactNative'): {
// // render
var ReactNative = Object.assign(Object.create(require('ReactNative')), { render: (
element: ReactElement<any>,
mountInto: number,
callback?: ?(() => void)
) => ?ReactComponent<any, any, any>,
// findNodeHandle
findNodeHandle: (componentOrHandle: any) => ?number,
// NativeMethodsMixin
NativeMethodsMixin: Object
});
// export
var ReactNative = {
// from ReactNative internal
findNodeHandle: ReactNativeInternal.findNodeHandle,
render: ReactNativeInternal.render,
NativeMethodsMixin: ReactNativeInternal.NativeMethodsMixin,
// Components // Components
ActivityIndicator: require('ActivityIndicator'), ActivityIndicator: require('ActivityIndicator'),
ActivityIndicatorIOS: require('ActivityIndicatorIOS'), ActivityIndicatorIOS: require('ActivityIndicatorIOS'),
@ -118,6 +135,6 @@ var ReactNative = Object.assign(Object.create(require('ReactNative')), {
ColorPropType: require('ColorPropType'), ColorPropType: require('ColorPropType'),
EdgeInsetsPropType: require('EdgeInsetsPropType'), EdgeInsetsPropType: require('EdgeInsetsPropType'),
PointPropType: require('PointPropType'), PointPropType: require('PointPropType'),
}); };
module.exports = ReactNative; module.exports = ReactNative;