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

What is Framer? Join the Community
Return to index
Lennart Brandt
Posted Dec 29 - Read on Facebook

Hi everyone, I'm new to Framer and so far like the concept very much. I just wanted to experiment with Scroll Views but can't get them running.

As soon as I create a ScrollComponent I get the error message " undefined is not an object (evaluating 'layer.subLayers')".

Can someone help me?


Lennart Brandt

This is the Sketch file. Nothing special.

Andrew Nalband

Hey Lennart Brandt can you share your file so we can help you out? Just click the share button in the top right hand corner and paste the link it generates here

Jordan Robert Dobson

What happens when you:

print sketch.content


Sergey Voronov

try ScrollComponent.wrap(sketch.srollExample)

Lennart Brandt

Thank you all for the fast replies. Here's the file: Andrew Nalband

Andrew Nalband

Ok, Lennart Brandt a few things here.

First thing - "content" in the "wrap" section of the docs is an example that assumes you have a sketch layer named "content". For your example, your layer is called "scrollExample" so you want to use a line like this:

scroll = ScrollComponent.wrap sketch.scrollExample

Jorn van Dijk - heads up - using an example called "content" here might be confusing for folks, since a ScrollComponent has a "content" property.

Second thing - When you import from Sketch, anything outside of an artboard will actually get cropped. See this example to see how the extra boxes in your sketch file have been cropped:

In order to fix this, you want to structure your sketch file's artboard to be taller than an iPhone screen. Like so:

Andrew Nalband

Lennart Brandt - you probably also want to disable horizontal scrolling to get this working how you'd expect. Here is an example that disables horizontal scrolling and uses the larger artboard from my example above:

Andrew Nalband

Lennart Brandt here's an example of how to arrive at the same result without using sketch at all. I've added some comments here to explain what's going on. Let me know if you have any questions about this.

Read the entire post on Facebook