Getting rid of View and its styles!

Mehdi Parsaei
Jan 2, 2021

One of the annoying parts of React Native programming to me is, create many containers by View tag and attach many styles, isn’t it?

If your answer is Yes, join me, and if Not, continue your own way😋.

After writing a few apps by React Native, I decided to write a component, and call it Container.

It is really simple, but so useful, let’s have a look at it:

As you see I used “react-native-responsive-screen” to make it responsive.

Suppose you want to make a container that fills half of the page (Vertically and Horizontally) and put its children in the center:

<Container center widthPercentage={50} heightPercentage={50} />

Also, you can add more ability to it based on your needs.

If it was useful please leave a like and share it😊.

Thanks for reading, and good luck!

--

--

Mehdi Parsaei

Senior Android, React Native and Flutter Developer