You can trigger an event onLayoutto measure an element:
measureView(event) {
console.log('event properties: ', event);
console.log('width: ', event.nativeEvent.layout.width)
}
<View onLayout={(event) => this.measureView(event)}>
As for the width and height as a percentage, you can get the width and height of the window and use them as follows:
var {
...
Dimensions
} = React
const width = Dimensions.get('window').width
const height = Dimensions.get('window').height
width: width * .8,
height: height / 4,
source
share