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

NativeScript 3.0.0 support #94

Closed toddanglin closed 7 years ago

toddanglin commented 7 years ago

I use this plug-in quite a bit, so I'm starting to work with it in NativeScript 3.0.0. Unfortunately, it appears there are problems with the plugin that are preventing it from rendering correctly in 3.0.0.

I've cloned the plugin repo and upgraded the plugin and demo project to the latest 3.0.0-rc builds. When running the demo, the app loads, but the slides demo views are empty.

Will try to patch, but opening an issue to track the discussion and see if anyone else has done any work to make this work in the latest {N}.

JoshDSommer commented 7 years ago

Thanks for the heads up @toddanglin! I'll start looking into this next chance I get.

toddanglin commented 7 years ago

I have a feeling that the problem is either:

A) Related to the new layout positioning units, OR B) Some of the changes to View/ViewBase (especially as it relates to iterating child views)

If I can get the demo app working locally with 3.0.0, I'll share my findings.

JoshDSommer commented 7 years ago

@toddanglin Awesome thank you.

toddanglin commented 7 years ago

Well...hope you have better luck than I did trying to figure-out why this isn't working in 3.0. Tested on iOS and Android and get similar results -- blank slide on load.

After updating package dependencies to 3.0.0 bits, there are no "obvious" errors. I can see slides load and transition, but the active slide seems to "disappear" after it is scrolled in to view. Not sure if there is some aggressive view "unloading" making this happen or not.

Slide logic should not be impacted, so I've got to assume it's something different in how the AbsoluteLayout and StackLayout containers are loading/interacting.

NOTE: I did have to start setting the slideWidth property on the host page loaded event for the setting to get recognized by the SlideContainer. If I relied on the slideWidth XML property, the value was ignored.

JoshDSommer commented 7 years ago

@toddanglin I created a new branch called 3.0. if you wouldn't mind making a PR to that so I could possibly see the rout you took I would appreciate it.

toddanglin commented 7 years ago

I can make a PR update to the demo to show you how I'm getting the dimensions to the plugin properly, but everything I've done in the plugin itself has been throw-away. Still not 100% sure why slides are visible during animation, but "disappear" after translating.

Going to try to create a simple scratch project and see if the problem is reproducible outside the context of this plugin. May help isolate the issue.

toddanglin commented 7 years ago

OKAY. Tracked it down. There is an odd behavior with the translateX stuff.

In the current RC, an element is moved 2x further when you set translateX than you'd expect. So if you set left: 1000...to get that element back to "0", you need to do this: ele.style.translateX = -500...not -1000 as you'd expect. Weird.

Add to the "weirdness"...the Animation API translate behaves differently, too. It will only smoothly animate 50% of the translateX value, and then "jump" to the final translateX coordinates.

AND...if you use the Animation API to translateX, then ele.style.translateX (or ele.translateX) stop working.

So, yeah. Here is a repo with a simple project that demonstrates the errors. Going to create new issues on NativeScript project to hopefully get these bugs looked at ASAP: https://github.com/toddanglin/layoutTest

toddanglin commented 7 years ago

Here is issue created to track bug: https://github.com/NativeScript/NativeScript/issues/4035

toddanglin commented 7 years ago

@TheOriginalJosh I think we can actually discard this branch.

I re-tested this plugin using the latest nightly 3.0.0 builds and it seems to work fine with no changes (v2.2.8)! Seems RC1 had a bug with translate that has since been fixed, so this plugin should work fine with the next RC and/or the final 3.0.0 release. 👍

JoshDSommer commented 7 years ago

@toddanglin That is awesome news! I was working on it last night with RC1 and was having.... not a so great time. Thanks for everything @toddanglin.

toddanglin commented 7 years ago

Yeah! I bet. Those were pretty confusing bugs.

A fresh update to the {N} 3.0.0 RC was published today (rc.2). This plugin should work for anyone installing the latest RC.