【小窍门】reactnative获取宽高的方法

2016-06-22 11:09:00
hainuo
原创 1879
首先引入 Dimensions```import {Demensions} from 'react-native';```然后是 获取数据```let window = { width: Dimensions.get('window').width, height: Dimensions.get('window').height,};```scroll 如何判断到滑动到底部``` let scrollH = e.nativeEvent.contentSize.height; let y = e.nativeEvent.contentOffset.y; let height = e.nativeEvent.layoutMeasurement.height;// console.log('handle scroll', scrollH, y, height); if (scrollH - height < y) this._onEndfresh();```view 如何得到 视图的宽高 ``` this._onlayout(e)}>... _onlayout(e){let height=e.nativeEvent.layout.height;let width = e.nativeEvent.layout.width;let x = e.nativeEvent.layout.x;let y = e.nativeEvent.layout.y;}```小窍门 结束喽
发表评论
玖 减 柒 =
评论通过审核后显示。