DEV Community

skptricks
skptricks

Posted on

4

React Native Calculate View Dimensions dynamically on Button click

Source : React Native Calculate View Dimensions dynamically on Button click

This tutorial explains how can we calculate view dimensions dynamically on button click in react native. This is sometime very important in order to make the user interface responsive with respect to different size of screen. In this example we are using ref attribute in order to get the dimension. Parent view is consist of ref props named as containerView and child view is consist of ref props named as innerView. we are going to calculate the dimensions ( X, Y, Width, Height ) of child view with respect to parent view's dimensions dynamically on button click with the help of measureLayout function.

React Native Calculate View Dimensions dynamically on Button click

Click here to read more...

Sentry mobile image

App store rankings love fast apps - mobile vitals can help you get there

Slow startup times, UI hangs, and frozen frames frustrate users—but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read full post →

Top comments (0)

nextjs tutorial video

📺 Youtube Tutorial Series

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay