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

@@ -16,14 +16,31 @@
*/
'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 ReactNative = Object.assign(Object.create(require('ReactNative')), {
var ReactNativeInternal = (require('ReactNative'): {
// render
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
ActivityIndicator: require('ActivityIndicator'),
ActivityIndicatorIOS: require('ActivityIndicatorIOS'),
@@ -118,6 +135,6 @@ var ReactNative = Object.assign(Object.create(require('ReactNative')), {
ColorPropType: require('ColorPropType'),
EdgeInsetsPropType: require('EdgeInsetsPropType'),
PointPropType: require('PointPropType'),
});
};
module.exports = ReactNative;