Component의 Layout 알아내기
View의 width, height, x, y 값을 알아야 할 때가 있다. 컴포넌트의 애니메이션 position 등에서 말이다.
이를 위해 onLayout
이벤트를 사용한다.
1
2
3
4
5
6
<View
onLayout={event => {
const { width, height, x, y } = event.nativeEvent.layout;
}}
>
...
Share on
Copy URL
Leave a comment