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

TypeError: Cannot read property 'left' of undefined #71

Closed nnieto closed 7 years ago

nnieto commented 8 years ago

I have a problem with I try to use a repeater o when I try to create the view via code

TypeError: Cannot read property 'left' of undefined File: "/data/data/org.nativescript.wosapp/files/app/tns_modules/nativescript-slides/nativescript-slides.js, line: 268, column: 17

StackTrace: Frame: function:'SlideContainer.positionPanels', file:'/data/data/org.nativescript.wosapp/files/app/tns_modules/nativescript-slides/nativescript-slides.js', line: 268, column: 18 Frame: function:'', file:'/data/data/org.nativescript.wosapp/files/app/tns_modules/nativescript-slides/nativescript-slides.js', line: 197, column: 23 Frame: function:'Observable.notify', file:'/data/data/org.nativescript.wosapp/files/app/tns_modules/data/observable/observable.js', line: 158, column: 23 Frame: function:'Observable._emit', file:'/data/data/org.nativescript.wosapp/files/app/tns_modules/data/observable/observable.js', line: 177, column: 18 Frame: function:'View.onLoaded', file:'/data/data/org.nativescript.wosapp/files/app/tns_modules/ui/core/view-common.js',

Slawardi commented 8 years ago

I have experienced the same problem, using ngFor.

jeado commented 8 years ago

I have same issue.

I am using Angular 2. EXCEPTION: Error in app.component.html:16:4 caused by: undefined is not an object (evaluating 'panel.left') ORIGINAL EXCEPTION: undefined is not an object (evaluating 'panel.left') ORIGINAL STACKTRACE: positionPanels@file:///app/tns_modules/nativescript-slides/nativescript-slides.js:261:18 file:///app/tns_modules/nativescript-slides/nativescript-slides.js:190:37

JoshDSommer commented 8 years ago

Thank you all for the feedback, Have any of you had any luck getting this to work? I checked the demo app inside of the project id I'm not seeing it happening in the dynamic example.

{N} version 2.3, iOS and android.

if any of you could post an example of how you have the slides setup that would help as well. Thanks everyone.

nnieto commented 8 years ago

`

` This is my configuration, Maybe is an issue wiith my code, a bad use on repeater with listview Sorry, for the bad format, I dont kwon how to keep format on code.
terreb commented 8 years ago

If you want to get this error in the sample example just comment whole onSlideContainerLoaded function. This error happens when some initialization logic in the plugin starts to execute, but slides have not been added at this point. In my opinion this is wrong and normally this should work in the way that slides can be added anytime and empty slider (without slides) should not lead to an exception.

aboalwi commented 8 years ago

Same Issue here JS: EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'left' of undefined JS: ORIGINAL STACKTRACE: JS: Error: Uncaught (in promise): TypeError: Cannot read property 'left' of undefined JS: at resolvePromise (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:416:31) JS: at /data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:393:13 JS: at ZoneDelegate.invoke (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:28) JS: at Object.NgZoneImpl.inner.inner.fork.onInvoke (/data/data/org.nativescript.coupons/files/app/tns_modules/@angular/core/bundles/core.umd.js:6220:41) JS: at ZoneDelegate.invoke (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:189:34) JS: at Zone.run (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:43) JS: at /data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:57 JS: at ZoneDelegate.invokeTask (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37) JS: at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (/data/data/org.nativescript.coupons/files/app/tns_modules/@angular/core/bundles/core.umd.js:6211:41) JS: at ZoneDelegate.invokeTask (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:42) JS: Unhandled Promise rejection: Cannot read property 'left' of undefined ; Zone: angular ; Task: Promise.then ; Value: TypeError: Cannot read property 'left' of undefined TypeError: Cannot read property 'left' of undefined JS: at SlideContainer.positionPanels (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-slides/nativescript-slides.js:272:18) JS: at SlideContainer.onLayoutLoaded (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-slides/nativescript-slides.js:188:18) JS: at Object.callback (/data/data/org.nativescript.coupons/files/app/tns_modules/nativescript-slides/nativescript-slides.js:225:19) JS: at SlideContainer.Observable.notify (/data/data/org.nativescript.coupons/files/app/tns_modules/data/observable/observable.js:149:23) JS: at SlideContainer.Observable._emit (/data/data/org.nativescript.coupons/files/app/tns_modules/data/observable/observable.js:168:18) JS: at SlideContainer.View.onLoaded (/data/data/org.nativescript.coupons/files/app/tns_modules/ui/core/view-common.js:611:14) JS: at SlideContainer.View.onLoaded (/data/data/org.nativescript.coupons/files/app/tns_modules/ui/core/view.js:82:35) JS: at eachChild (/data/data/org.nativescript.coupons/files/app/tns_modules/ui/core/view-common.js:616:23) JS: at ProxyViewContainer.LayoutBase._eachChildView (/data/data/org.nativescript.coupons/files/app/tns_modules/ui/layouts/layout-base-common.js:146:22) JS: at ProxyViewContainer.View._loadEachChildView (/data/data/org.nativescript.coupons/files/app/tns_modules/ui/core/view-common.js:619:18) JS: Error: Uncaught (in promise): TypeError: Cannot read property 'left' of undefined

aboalwi commented 8 years ago

Well this solved it for me issues/42

terreb commented 8 years ago

@aboalwi Are you saying that if no slides are added it works for you and doesn't throw that exception?

aboalwi commented 8 years ago

@terreb No. Btw, i had an issue with ListView before , when i put a timer inside with ngFor it never updates Replaced it with StackLayout and works great. i don't even know why =)