React Native Set View Width Height in Fixed Dimensions Android iOS

How to apply custom height and width in pixels in react native android iOS application using custom style sheet on both parent and child View Fixed Dimensions.

Fixed height and width gives the View to a permanent area on screen no matter what screen size is. We can define fixed height using style. All we have to do is define View’s Height using height and Width using width in style. If will cover the screen according to given size because all dimensions in React Native are unitless with density independent pixels.

Contents in this project Set View Width Height in Fixed Dimensions :

  1. Start a fresh React Native project. If you don’t know how then read my this tutorial.
  2. Add StyleSheet and View component in import block.
  3. Add Singe View as parent view in render’s return block.
  4. Add Three different View inside the Parent View.
  5. Add inline Style for all three Children View.
  6. Add height and width in pixels in Style.
  7. Complete Source Code.

1. Start a fresh React Native project. If you don’t know how then read my this tutorial.

2. Add StyleSheet and View component in import block.

3. Add Singe View as parent view in render’s return block.

4. Add Three different View inside the Parent View.

5. Add inline Style for all three Children View.

6. Add height and width in pixels in Style.

7. Complete Source Code for index.android.js file :

Screenshot in iOS device :

Fixed Dimensions

Screenshot in Android device :