Текст номер строк реагирует нативно
<Text numberOfLines={2} ellipsizeMode='tail'>
long string
</Text>
foloinfo
<Text numberOfLines={2} ellipsizeMode='tail'>
long string
</Text>
const NUM_OF_LINES = 5;
const SOME_LONG_TEXT_BLOCK = 'Lorem ipsum ...';
function SomeComponent () {
const [ showMore, setShowMore ] = useState(false);
const onTextLayout = useCallback(e => {
setShowMore(e.nativeEvent.lines.length > NUM_OF_LINES);
}, []);
return (
<Text numberOfLines={NUM_OF_LINES} onTextLayout={onTextLayout}>
{SOME_LONG_TEXT_BLOCK}
</Text>
);
}