From 0eb5b98663ef1242013f0795ab0bbd1361b18d86 Mon Sep 17 00:00:00 2001 From: Ahmad Hamed Date: Sun, 29 Oct 2017 22:24:25 +0200 Subject: [PATCH] apply/destroy carousel in launcher plugin when it's active/inactive --- .../components/carouselLight/carouselLight.js | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/buildfire/components/carouselLight/carouselLight.js b/scripts/buildfire/components/carouselLight/carouselLight.js index 99b71ab5..e1523d72 100644 --- a/scripts/buildfire/components/carouselLight/carouselLight.js +++ b/scripts/buildfire/components/carouselLight/carouselLight.js @@ -64,23 +64,27 @@ buildfire.components.carousel.view.prototype = { var self = this; + function validateLauncherCarousel() { + buildfire.getContext(function (err, result) { + if (result && result.device && result.device.platform && result.device.platform.toLowerCase() == 'ios') { + buildfire.navigation.onAppLauncherActive(function () { + self._applySlider(); + }, true); + buildfire.navigation.onAppLauncherInactive(function () { + self._destroySlider(); + }, true); + } + }); + } + if (this.config.items && this.config.items.length > 0) { this._renderHTMLItems(function () { self._applySlider(); - - buildfire.getContext(function (err, result) { - if (result && result.device && result.device.platform && result.device.platform.toLowerCase() == 'ios') { - buildfire.navigation.onAppLauncherActive(function () { - self._applySlider(); - }, true); - buildfire.navigation.onAppLauncherInactive(function () { - self._destroySlider(); - }, true); - } - }); + validateLauncherCarousel(); }); } else{ self._applySlider(); + validateLauncherCarousel(); } }, _destroySlider: function () {