JoshDSommer / nativescript-slides

A NativeScript plugin that is for Intro Tutorials, Image Carousels or any other slide functionality
Other
70 stars 32 forks source link

changedEvent stops working after if pageIndication is not set. #44

Closed lillebak closed 8 years ago

lillebak commented 8 years ago

Hi

I noticed while using your plugin that the changedEvent stopped working after pageIndication was set to false. I looked further into the code and discovered that there is no check if pageIndication is turned on or off before the active page indicator is being set.

I guess the fix looks something similar to this, where i just added an if in the beginning that checks the pageIndication first:

    setActivePageIndicator(index: number) {
        if (this.pageIndicators) {
            this._footer.eachLayoutChild((view: View) => {
                if (view instanceof Label) {
                    view.opacity = 0.4;
                    view.className = 'slide-indicator-inactive';
                }
            });
            let activeIndicator = this._footer.getChildAt(index);
            activeIndicator.className = 'slide-indicator-active';
            activeIndicator.opacity = 0.9;
        }
    }

BR / Lillebak

andrewlo commented 8 years ago

This PR also fixes this https://github.com/TheOriginalJosh/nativescript-slides/pull/45

JoshDSommer commented 8 years ago

PR #45 has been published to npm version 1.7.1 thanks guys!