Skip to content

Commit 91db93b

Browse files
committed
rename property
also includes readme updates and fixes for property not being set. this is release 1.3.1
1 parent dd0e051 commit 91db93b

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ the `<Slides:SlideContainer>` element also has a property called `velocityScroll
7676
the `<Slides:SlideContainer>` element also has a property called `interval` which is a integer value and the value is in milliseconds. The suggested use case would be for a Image Carousel or something of that nature which can change the image for every fixed intervals. In unloaded function call `page.getViewById("your_id").stopSlideshow()` to unregister it (your_id is the id given to `<Slides:SlideContainer>`), it can be restarted with `startSlidShow`.
7777

7878
#### Angular 2 compatibility
79-
To use the slides with Angular2 and the `registerElement` from `nativescript-angular` you will want to set the `SlideContainer`'s property of `ng2` to `true`. Then in your angular component in the `ngAfterViewInit`. you will want to have an instance of your slide container to call the function `constructView()`.
79+
To use the slides with Angular2 and the `registerElement` from `nativescript-angular` you will want to set the `SlideContainer`'s property of `angular` to `true`. Then in your angular component in the `ngAfterViewInit`. you will want to have an instance of your slide container to call the function `constructView()`.
8080

8181
#### Android Optional Attributes
8282
- `androidTranslucentStatusBar`: boolean - If true, the Android status bar will be translucent on devices that support it. (Android sdk >= 19).

demo/app/main-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:Slides="nativescript-slides" loaded="pageLoaded">
22

33
<GridLayout rows="* auto">
4-
<Slides:SlideContainer id="slides" ng2="true" row="0">
4+
<Slides:SlideContainer id="slides" row="0">
55
<Slides:Slide class="slide-1">
66
<Label text="This is Panel 1" />
77
</Slides:Slide>

nativescript-slides.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export declare class SlideContainer extends AbsoluteLayout {
1919
private _androidTranslucentStatusBar;
2020
private _androidTranslucentNavBar;
2121
private timer_reference;
22-
private _ng2;
22+
private _angular;
2323
hasNext: boolean;
2424
hasPrevious: boolean;
2525
interval: number;
@@ -28,12 +28,12 @@ export declare class SlideContainer extends AbsoluteLayout {
2828
androidTranslucentNavBar: boolean;
2929
velocityScrolling: boolean;
3030
pageWidth: number;
31-
ng2: boolean;
31+
angular: boolean;
3232
android: any;
3333
ios: any;
3434
constructor();
3535
private setupDefaultValues();
36-
constructView(): void;
36+
constructView(constructor?: boolean): void;
3737
private carousel(isenabled, time);
3838
private rebindSlideShow();
3939
stopSlideshow(): void;

nativescript-slides.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class SlideContainer extends AbsoluteLayout {
4242
private _androidTranslucentStatusBar: boolean;
4343
private _androidTranslucentNavBar: boolean;
4444
private timer_reference: number;
45-
private _ng2: boolean;
45+
private _angular: boolean;
4646

4747
get hasNext(): boolean {
4848
return !!this.currentPanel.right;
@@ -94,12 +94,12 @@ export class SlideContainer extends AbsoluteLayout {
9494
return this._pageWidth;
9595
}
9696

97-
get ng2(): boolean {
98-
return this._ng2;
97+
get angular(): boolean {
98+
return this._angular;
9999
}
100100

101-
set ng2(value: boolean) {
102-
this._ng2 = value;
101+
set angular(value: boolean) {
102+
this._angular = value;
103103
}
104104

105105
get android(): any {
@@ -112,43 +112,46 @@ export class SlideContainer extends AbsoluteLayout {
112112

113113
constructor() {
114114
super();
115-
this.constructView();
115+
this.setupDefaultValues();
116+
// if being used in an ng2 app we want to prevent it from excuting the constructView
117+
// until it is called manually in ngAfterViewInit.
118+
119+
this.constructView(true);
120+
116121
}
117122

118123
private setupDefaultValues(): void {
119124
this._loaded = false;
120125
if (this._loop == null) {
121126
this.loop = false;
122127
}
128+
123129
this.transitioning = false;
124130

125131
this._pageWidth = Platform.screen.mainScreen.widthDIPs;
126132

127133
if (this._interval == null) {
128-
this._interval = 0;
134+
this.interval = 0;
129135
}
130136

131137
if (this._velocityScrolling == null) {
132138
this._velocityScrolling = false;
133139
}
134-
if (this._ng2 == null) {
135-
this._ng2 = false;
140+
if (this._angular == null) {
141+
this.angular = false;
136142
}
137143

138144
}
139145

140-
public constructView(): void {
141-
this.setupDefaultValues();
142-
// if being used in an ng2 app we want to prevent it from excuting the constructView
143-
// until it is called manually in ngAfterViewInit.
144-
if (this.ng2) {
145-
return;
146-
}
146+
public constructView(constructor: boolean = false): void {
147+
147148

148149
this.on(AbsoluteLayout.loadedEvent, (data: any) => {
149150
if (!this._loaded) {
150151
this._loaded = true;
151-
152+
if (this.angular === true && constructor === true) {
153+
return;
154+
}
152155
// Android Translucent bars API >= 19 only
153156
if (this.androidTranslucentStatusBar === true || this._androidTranslucentNavBar === true && app.android && Platform.device.sdkVersion >= '19') {
154157
let window = app.android.startActivity.getWindow();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-slides",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "NativeScript Slides plugin.",
55
"main": "nativescript-slides.js",
66
"nativescript": {

0 commit comments

Comments
 (0)