This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Daniel Rakh
Posted Aug 19 - Read on Facebook

Hey...is there any update on the snapToPage() bug in the Page Component? Or can someone at least guide me on a good way to hack around it? I'd really appreciate it : )

12 Comments

Jordan Robert Dobson

There was a post recently by JL Flores Mena that explained getting around a few of these issue... you should dig that up. I'm like almost 100% positive that a hack is mentioned in there.

Chris Camargo

Daniel, do you mean the issue where calling snapToPage() from a layer inside your PageComponent appears to prevent it from firing?

Daniel Rakh

Thanks Jordan I scoured the group for anything related to this and I haven't found anything that solves my particular issue. Chris my issue is that when I have a page component and I dynamically add a page when say a button is clicked. I want the component to snap to that newly added page. The problem is that when I call snapToPage(newPg, true) it seems that it goes back to the first page before it scrolls and snaps to the new page. It becomes more noticeable when you have more pages.

Daniel Rakh

I'm mobile right now but I'll share the code as soon as I have a chance to sit down. Appreciate your help gentlemen.

Jordan Robert Dobson

You might have to use a small delay... or use _.defer -> DoWork()

Jordan Robert Dobson

I bet you the new page isn't registered by the time you hit snapToPage?

Daniel Rakh

I think so also but then again I logged the current page before the snap call and it seems right? All of this is new to me so I'm not well versed on how to debug. Prob doing something wrong. Trying to figure it out as I go along heh.

Daniel Rakh
Jordan Robert Dobson

I'll try to take a look tomorrow if someone doesn't get to it before me. :)

JL Flores Mena

Hey all, sorry for being late to this conversation. Jordan, thanks for sharing my previous post, but I think Daniel's issue here is a different one. Hey Daniel here's my fix with comments http://share.framerjs.com/jmnzi5epi7ld/
I'd say that this wasn't a bug in the Page Component, the issue you had is that you weren't keeping track of the CurrentPage, so, Framer always thought you were on page 1, hence triggering that animation from 1 to newPage. Please let me know if this helps!

Daniel Rakh

Awesome. Thank you!

Read the entire post on Facebook