【小竅門】reactnative穫取寬高的方法

2016-06-22 11:09:00
hainuo
原創 1935
首先引入 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;}```小竅門 結束嘍
發錶評論
叄 乘 陸 =
評論通過審核後顯示。