Nativescript-angular: BY using Nativescript animations Showing Error: ERROR TypeError: Cannot read property 'length' of undefined

Created on 21 Jun 2017  路  12Comments  路  Source: NativeScript/nativescript-angular

I used the below Css Animation

.view {
    animation-name: example;
    animation-duration: 1;
    animation-timing-function: ease-in;
   animation-fill-mode: forwards;
}
@keyframes example {
    from { transform: translate(0, 0); }
    to { transform: translate(0, 100); }
}

I referred this class in my view but shown Error : ERROR TypeError: Cannot read property 'length' of undefined

question

Most helpful comment

Its working fine @jogboms. I tried with following code. This also works fine @JaganJonnala .

app.component.html

`




`

app.css
.login-page-animate{ animation-name: rotate; animation-duration: 2; } @keyframes rotate { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }

All 12 comments

@JaganJonnala I am trying to reproduce the issue using this project but with no success at this point (everything works fine on my side).

Can you please post the XML layout used to style and also clarify on what platform you are experiencing this error (Android or iOS).

@NickIliev
Android

And I am using Nativescript with angular 2
class name used in Html file i mean view

@JaganJonnala the actual HTML code involved would help a lot.

<StackLayout class="view"> <Label text="Medicines" class="c-white"></Label> </StackLayout>

Just given that class name which i have used to animation to the StackLayout as class

@JaganJonnala I actually experience this same issue but in a different way. When I do exactly what you do, It works but when I split the functionality of the animation-* properties into different classes, it produces this very same error.

I am also facing same problem. Any updates regarding this issue @JaganJonnala & @jogboms ?

HTML

<FlexboxLayout #label1 (loaded)="animate(label1,150)" style="margin-top:120-dip;" flexDirection="column" flexWrap="nowrap">
                                <StackLayout class="foodRow">
                                    <Image src="~/images/icon.png" style="width:65%;height:65%"></Image>
                                </StackLayout>
                                <Label text="Butchery" #label12 (loaded)="animate(label12,650,-5)" textWrap="true" style="margin-top:5;color:white;text-align:center"></Label>
                            </FlexboxLayout>

View-Model - TypeScript

animate(label: Label, durationTime: number, ynumber?: number) { // >> animation-animating-properties-code ynumber = ynumber || -100; label.animate({ translate: { x: 0, y: ynumber }, duration: durationTime, curve: AnimationCurve.easeInOut }).then(() => { }).catch((e) => { console.log(e.message); }); }

I have Used llike this @kumaran-dena

@kumaran-dena I actually just ignored the animation property that was causing the error.

I was tried this. Now its working fine.Thank you @JaganJonnala.

Its working fine @jogboms. I tried with following code. This also works fine @JaganJonnala .

app.component.html

`




`

app.css
.login-page-animate{ animation-name: rotate; animation-duration: 2; } @keyframes rotate { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }

I have the same problem and I cannot understand how you solved it. What is the problem? What did you change?

It would be nice if anything in the documents would just works without crashing the app.

@erkanarslan here's a Playground example.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

triniwiz picture triniwiz  路  3Comments

Sulman633 picture Sulman633  路  3Comments

vakrilov picture vakrilov  路  3Comments

sunpasup picture sunpasup  路  3Comments

samuelvisscher picture samuelvisscher  路  3Comments