[Flow] Fix or suppress react-native github errors for Flow v0.12.0

This commit is contained in:
Gabe Levi
2015-06-10 13:42:41 -07:00
parent 5d154f1af4
commit b05e99a531
12 changed files with 37 additions and 22 deletions

View File

@@ -299,7 +299,7 @@ var ScrollView = React.createClass({
onResponderRelease: this.scrollResponderHandleResponderRelease,
onResponderReject: this.scrollResponderHandleResponderReject,
};
var ScrollViewClass;
if (Platform.OS === 'ios') {
ScrollViewClass = RCTScrollView;

View File

@@ -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)]
);
},

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -26,7 +26,7 @@ type ReactNativeBaseComponentViewConfig = {
*/
var createReactNativeComponentClass = function(
viewConfig: ReactNativeBaseComponentViewConfig
): Function { // returning Function is lossy :/
): ReactClass<any, any, any> {
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;

View File

@@ -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 {