
위의 이미지와 같이 line 갯수가 많아지면 열기버튼을 눌러서 글을 더 볼 수 있고, line 갯수가 일정 수 이상이 안되면 더보기 버튼이 없어지게 만들어야 할때 <Text>의 onTextLayout을 이용하면 <Text> 컴포넌트안에 있는 line 갯수를 알 수 있다!
function getLineLength(event){
console.log(event.nativeEvent.lines.length)
}
<Text onTextLayout={getLineLength}>
text contents
</Text>
참고
Determine the Number of Lines a Text Component Takes Up in React Native