DEV Community

skptricks
skptricks

Posted on

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...

Top comments (0)