diff --git a/Examples/Movies/MovieCell.js b/Examples/Movies/MovieCell.js index e6a9b10782..341460e588 100644 --- a/Examples/Movies/MovieCell.js +++ b/Examples/Movies/MovieCell.js @@ -34,11 +34,14 @@ var MovieCell = React.createClass({ var criticsScore = this.props.movie.ratings.critics_score; return ( - + {/* $FlowIssue #7363964 - There's a bug in Flow where you cannot + * omit a property or set it to undefined if it's inside a shape, + * even if it isn't required */} + {/* $FlowIssue #7363964 - There's a bug in Flow where you cannot + * omit a property or set it to undefined if it's inside a shape, + * even if it isn't required */} + {/* $FlowIssue #7363964 - There's a bug in Flow where you cannot + * omit a property or set it to undefined if it's inside a shape, + * even if it isn't required */} ); } else { - ContentWrapper = ScrollView; + ContentWrapper = (ScrollView: ReactClass); wrapperProps.keyboardShouldPersistTaps = true; wrapperProps.keyboardDismissMode = 'interactive'; } diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 8d274bdc56..5700ff964b 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -299,7 +299,7 @@ var ScrollView = React.createClass({ onResponderRelease: this.scrollResponderHandleResponderRelease, onResponderReject: this.scrollResponderHandleResponderReject, }; - + var ScrollViewClass; if (Platform.OS === 'ios') { ScrollViewClass = RCTScrollView; diff --git a/Libraries/Network/NetInfo.js b/Libraries/Network/NetInfo.js index 47184d1819..c62cb209a8 100644 --- a/Libraries/Network/NetInfo.js +++ b/Libraries/Network/NetInfo.js @@ -147,7 +147,7 @@ var NetInfo = { eventName: ChangeEventName, handler: Function ): void { - _subscriptions[handler] = RCTDeviceEventEmitter.addListener( + _subscriptions[String(handler)] = RCTDeviceEventEmitter.addListener( DEVICE_REACHABILITY_EVENT, (appStateData) => { handler(appStateData.network_reachability); @@ -159,11 +159,11 @@ var NetInfo = { eventName: ChangeEventName, handler: Function ): void { - if (!_subscriptions[handler]) { + if (!_subscriptions[String(handler)]) { return; } - _subscriptions[handler].remove(); - _subscriptions[handler] = null; + _subscriptions[String(handler)].remove(); + _subscriptions[String(handler)] = null; }, fetch: function(): Promise { @@ -204,12 +204,12 @@ NetInfo.isConnected = { eventName: ChangeEventName, handler: Function ): void { - _isConnectedSubscriptions[handler] = (connection) => { + _isConnectedSubscriptions[String(handler)] = (connection) => { handler(_isConnected(connection)); }; NetInfo.addEventListener( eventName, - _isConnectedSubscriptions[handler] + _isConnectedSubscriptions[String(handler)] ); }, @@ -219,7 +219,7 @@ NetInfo.isConnected = { ): void { NetInfo.removeEventListener( eventName, - _isConnectedSubscriptions[handler] + _isConnectedSubscriptions[String(handler)] ); }, diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index 732d4c0294..fa2be650ab 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -66,14 +66,14 @@ class PushNotificationIOS { 'PushNotificationIOS only supports `notification` and `register` events' ); if (type === 'notification') { - _notifHandlers[handler] = RCTDeviceEventEmitter.addListener( + _notifHandlers[String(handler)] = RCTDeviceEventEmitter.addListener( DEVICE_NOTIF_EVENT, (notifData) => { handler(new PushNotificationIOS(notifData)); } ); } else if (type === 'register') { - _notifHandlers[handler] = RCTDeviceEventEmitter.addListener( + _notifHandlers[String(handler)] = RCTDeviceEventEmitter.addListener( NOTIF_REGISTER_EVENT, (registrationInfo) => { handler(registrationInfo.deviceToken); @@ -143,11 +143,11 @@ class PushNotificationIOS { type === 'notification' || type === 'register', 'PushNotificationIOS only supports `notification` and `register` events' ); - if (!_notifHandlers[handler]) { + if (!_notifHandlers[String(handler)]) { return; } - _notifHandlers[handler].remove(); - _notifHandlers[handler] = null; + _notifHandlers[String(handler)].remove(); + _notifHandlers[String(handler)] = null; } diff --git a/Libraries/ReactIOS/InspectorOverlay/resolveBoxStyle.js b/Libraries/ReactIOS/InspectorOverlay/resolveBoxStyle.js index e0bfb601c1..0c2857bd0e 100644 --- a/Libraries/ReactIOS/InspectorOverlay/resolveBoxStyle.js +++ b/Libraries/ReactIOS/InspectorOverlay/resolveBoxStyle.js @@ -20,7 +20,7 @@ * * If none are set, returns false. */ -function resolveBoxStyle(prefix: String, style: Object): ?Object { +function resolveBoxStyle(prefix: string, style: Object): ?Object { var res = {}; var subs = ['top', 'left', 'bottom', 'right']; var set = false; diff --git a/Libraries/ReactNative/createReactNativeComponentClass.js b/Libraries/ReactNative/createReactNativeComponentClass.js index 3940df0128..5d6d87cd8f 100644 --- a/Libraries/ReactNative/createReactNativeComponentClass.js +++ b/Libraries/ReactNative/createReactNativeComponentClass.js @@ -26,7 +26,7 @@ type ReactNativeBaseComponentViewConfig = { */ var createReactNativeComponentClass = function( viewConfig: ReactNativeBaseComponentViewConfig -): Function { // returning Function is lossy :/ +): ReactClass { var Constructor = function(element) { this._currentElement = element; @@ -39,7 +39,7 @@ var createReactNativeComponentClass = function( Constructor.prototype = new ReactNativeBaseComponent(viewConfig); Constructor.prototype.constructor = Constructor; - return Constructor; + return ((Constructor: any): ReactClass); }; module.exports = createReactNativeComponentClass; diff --git a/Libraries/Utilities/BridgeProfiling.js b/Libraries/Utilities/BridgeProfiling.js index e3c47907b0..c94d84fdd0 100644 --- a/Libraries/Utilities/BridgeProfiling.js +++ b/Libraries/Utilities/BridgeProfiling.js @@ -14,7 +14,7 @@ var GLOBAL = GLOBAL || this; var BridgeProfiling = { - profile(profileName: String, args?: any) { + profile(profileName: string, args?: any) { if (GLOBAL.__BridgeProfilingIsProfiling) { if (args) { try {