A HOC to make your React-Native components aware of their width
and height
npm i --save react-native-measureme
import React from 'react';
import {View} from 'react-native';
const SizeAwareComponent = React.createClass({
render(){
//this component knows its render width and height through
//this.props.width & this.props.height
<View style={{width:this.props.width, height:this.props.height}} />
}
});
module.exports = require('react-native-measureme')(SizeAwareComponent);
PRs highly appreciated
MIT License