Fix for #17348, Scrollable failing due to uglify-es

Summary:
Fixes https://github.com/facebook/react-native/issues/17348 - Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'this._subscribableSubscriptions.forEach')

Same existing tests applies, just added extra checks.

This patch fixes the issue https://github.com/facebook/react-native/issues/17348

 [ANDROID] [BUGFIX] [Subscribable] - Fix for https://github.com/facebook/react-native/issues/17348
 [IOS] [BUGFIX] [Subscribable] - Fix for https://github.com/facebook/react-native/issues/17348
Closes https://github.com/facebook/react-native/pull/17463

Reviewed By: sahrens

Differential Revision: D7062101

Pulled By: TheSavior

fbshipit-source-id: 1306f4695ffc8748f674de70740ded09e1e390f7
This commit is contained in:
Islam Magdy 2018-02-22 17:57:27 -08:00 коммит произвёл Facebook Github Bot
Родитель ef9d1fba23
Коммит b57a78c3de
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -28,7 +28,9 @@ Subscribable.Mixin = {
},
componentWillUnmount: function() {
this._subscribableSubscriptions.forEach(
// This null check is a fix for a broken version of uglify-es. Should be deleted eventually
// https://github.com/facebook/react-native/issues/17348
this._subscribableSubscriptions && this._subscribableSubscriptions.forEach(
(subscription) => subscription.remove()
);
this._subscribableSubscriptions = null;