Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nnieto opened this issue Sep 11, 2016 · 9 comments
Closed

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

nnieto opened this issue Sep 11, 2016 · 9 comments
Labels

Comments

@nnieto
Copy link

nnieto commented Sep 11, 2016

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
Copy link

I have experienced the same problem, using ngFor.

@jeado
Copy link

jeado commented Sep 18, 2016

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
Copy link
Owner

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
Copy link
Author

nnieto commented Sep 23, 2016

<ListView> <ListView.itemTemplate> <StackLayout orientation="vertical" indexName="{{ indexName }}" paddingTop="11"> <AbsoluteLayout width="100%" height="234px"> <StackLayout left="0" top="0" width="100%" height="100%" orientation="vertical" class="workoutItemList"> <StackLayout width="100%" height="178px"> <Slides:SliderContainer> <Repeater items="{{options}}"> <Repeater.itemTemplate> <Slides:Slide> <GridLayout> <IC:WebImage stretch="aspectFill" src="{{photo_url}}" left="0" top="0"> </IC:WebImage> <StackLayout left="0" right="0" class="slide" width = "100%" height = "100%" color = "#FFF"> <StackLayout width = "100%" height = "100%" padding = "50" backgroundColor = "#b21c1e22"> <Label marginTop = "12" horizontalAlignment = "center" textWrap = "true" textAlign="center" text="{{name}}"/> <StackLayout class="hr"></StackLayout> <StackLayout orientation = "horizontal" width = "100%" marginTop = "8" horizontalAlignment = "center"> <Label text="{{calories}}"/> <Image marginLeft = "36" width = "14" height = "14" src = "~/resources/images/duration.png" /> <Label marginLeft = "5" text = "{{duration}}"/> </StackLayout> </StackLayout> </StackLayout> </GridLayout> </Slides:Slide> </Repeater.itemTemplate> </Repeater> </Slides:SliderContainer> </StackLayout> <DockLayout paddingTop="9" paddingBottom="9" stretchLastChild="false" orientation="vertical" horizontalAlignment="left" width="90%"> <Label dock="left" text="{{name}}" textWrap="true" class="session-title"/> </DockLayout> </StackLayout> </AbsoluteLayout> </StackLayout> </ListView.itemTemplate> </ListView>
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
Copy link

terreb commented Sep 27, 2016

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
Copy link

aboalwi commented Oct 13, 2016

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
Copy link

aboalwi commented Oct 13, 2016

Well this solved it for me issues/42

@terreb
Copy link

terreb commented Oct 13, 2016

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

@aboalwi
Copy link

aboalwi commented Oct 13, 2016

@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 =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants