React Native学习-measure测量view的宽高值
2016-07-05 18:08
573 查看
measure()测量是根据view标签中的ref属性,使用方法如下:
with:宽;height:高;px:x轴方向距离左边多少像素;py:y轴方向距离上边多少像素;
根据项目需要,如果需要在页面加载完成后进行测量view,就需要使用setTimeout():
measureWatermarkerImage(){ this.refs.watermarkerImage.measure((a, b, width, height, px, py) => this.setState({watermarkerImageWidth: width}) ); }
with:宽;height:高;px:x轴方向距离左边多少像素;py:y轴方向距离上边多少像素;
根据项目需要,如果需要在页面加载完成后进行测量view,就需要使用setTimeout():
componentDidMount() { setTimeout(this.measureWatermarkerImage.bind(this)); };
相关文章推荐
- React Native教程 - 调用Web API
- 最快让你上手ReactiveCocoa之基础篇
- React学习总结(1)——开始
- windows 7下React Native环境配置
- ReactiveCocoa基础one
- RN入门
- 来自一个react SPA的总结--es6的应用
- React Native Changed the World? or Nothing.
- webpack -p压缩打包react报语法错误处理
- React与AngularJS到底那个更快...
- 在已有的项目中引入react native
- React Native之广告栏Banner实现
- windows下react-native android环境搭建注意事项
- Redux-Provider与connect
- npm + webpack +react
- React创建项目报错 Error: EACCES: permission denied, open '/Users/****/.babel.json'
- React学习笔记
- [React] Using the classnames library for conditional CSS
- [React] Creating a Stateless Functional Component
- 1. react-native-ios之----20分钟搭建环境