Reviewed By: sahrens

Differential Revision: D5732809

fbshipit-source-id: b8241120188b2b64af12249b2f00a43bea3b58a4
This commit is contained in:
Eli White 2017-08-30 11:45:10 -07:00 коммит произвёл Facebook Github Bot
Родитель 1f9fc0ee3a
Коммит dd92dba3da
5 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -38,7 +38,7 @@ class MissingNativeEventEmitterShim extends EventEmitter {
}
// EventEmitter
addListener(eventType: string, listener: Function, context: ?Object): EmitterSubscription {
addListener(eventType: string, listener: Function, context: ?Object) {
this.throwMissingNativeModule();
}

Просмотреть файл

@ -394,7 +394,9 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
_clearSubscriptions(): void {
(this._subscriptions || []).forEach(sub => {
sub.remove();
if (sub) {
sub.remove();
}
});
this._subscriptions = [];
}

Просмотреть файл

@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EmitterSubscription
* @noflow
* @flow
*/
'use strict';

Просмотреть файл

@ -18,6 +18,8 @@ const EventHolder = require('EventHolder');
const invariant = require('fbjs/lib/invariant');
const keyOf = require('fbjs/lib/keyOf');
import type EmitterSubscription from 'EmitterSubscription';
const TYPES_KEY = keyOf({__types: true});
/**
@ -79,7 +81,7 @@ const EventEmitterMixin = {
return this.__getEventEmitter().emitAndHold(eventType, a, b, c, d, e, _);
},
addListener: function(eventType, listener, context) {
addListener: function(eventType, listener, context): EmitterSubscription {
return this.__getEventEmitter().addListener(eventType, listener, context);
},

Просмотреть файл

@ -67,8 +67,8 @@ class KeyboardSpacerIOS extends Component<Props, State> {
this._unRegisterEvents();
}
_keyboardWillShowSubscription: { remove: Function };
_keyboardWillHideSubscription: { remove: Function };
_keyboardWillShowSubscription: { +remove: Function };
_keyboardWillHideSubscription: { +remove: Function };
_registerEvents = () => {
this._keyboardWillShowSubscription = Keyboard.addListener(