I can give the height element of style numeric values such as 40
but these are required to be integers. How can I make my component to have a height of 100%
?
To add a full width button with flex-box in React Native, we can set the alignSelf style to 'stretch' . to add a Button with the alignSelf style set to 'stretch' to make the button stretch to the width of the screen.
To set a Div's height to cover the full screen in React, set its height to 100vh , e.g. <div style={{height: '100vh'}}>... </div> . When the height of the element is set to 100vh , it covers 100% of the viewport's height.
In react native application, to set the dimensions of a component, we use width and height properties. Remember, all the values of dimensions are unitless like we can't use height: 20px to set the height of a component instead of we just use height: 20 and react-native automatically set the pixels.
check out the flexbox doc. in the stylesheet, use:
flex:1,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With