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

What is Framer? Join the Community
Return to index
Joshua Bradley
Posted Jun 16 - Read on Facebook

I'm unable to get Device.contentScale to work on actual devices. This makes it a bit impractical for demonstrating prototypes to clients, as devices that don't match the width of my sketch artboards won't display using the full screen width.

This kind of thing:
artboardWidth = 750
Framer.Device.contentScale = (Screen.width / artboardWidth)

Works great in the Framer editor preview panel, but not at all when previewing on a device (whether in a Framer iOS/Android app or on a mobile browser).

Am I missing something obvious here?

4 Comments

Kevyn Arnott

Framer.Device.contentScale is based on the device frame not the device. As you can imagine, switching frames on a device could lead to a lot of unintended misalignment & errors. That's why when you open the prototype on a device the frame won't change, and the .contentScale will remain the same. As far as solutions for this go, I wrote this module https://github.com/k-vyn/framer-material-kit that has all the device information for both iOS & Android in it, so when you have the module included you can call m.device.scale value, and that'll give you an accurate scale on the device. If you just need iOS device information, you can use this module https://github.com/k-vyn/framer-ios-kit and call ios.scale value.

Joshua Bradley

Great- thanks for this, I'll check them out

Joshua Bradley

Hi Kevyn Arnott, thanks for this- the scope of your project is awesome, I can see it being very useful in lots of ways to lots of people. However, I'm still new to Framer's abstractions, so perhaps you could help me a little more. I see how I can retrieve the device scale and other details with your module, and I see from your documentation that you discuss a 'Real device override' which sounds great, but without any examples (I also couldn't find any reference to it in the demo file), I'm not sure how I'd implement something like that. If you could point me in the right direction I'd be grateful.

Jordan Robert Dobson

You can set any layer width you want to Screen.width or adjust the scale too.

Honestly though I'd avoid this approach and just draw your layers in framer.

Read the entire post on Facebook