1
0
mirror of https://github.com/tooot-app/app synced 2025-04-23 14:47:21 +02:00

Fix Android expand

This commit is contained in:
Zhiyuan Zheng 2021-01-27 00:42:56 +01:00
parent 41bfeed56f
commit 6c6d563aae
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0

View File

@ -10,7 +10,7 @@ import { useTheme } from '@utils/styles/ThemeManager'
import { LinearGradient } from 'expo-linear-gradient' import { LinearGradient } from 'expo-linear-gradient'
import React, { useCallback, useState } from 'react' import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { Pressable, Text, View } from 'react-native' import { Platform, Pressable, Text, View } from 'react-native'
import HTMLView from 'react-native-htmlview' import HTMLView from 'react-native-htmlview'
// Prevent going to the same hashtag multiple times // Prevent going to the same hashtag multiple times
@ -214,12 +214,18 @@ const ParseHTML: React.FC<Props> = ({
const [expanded, setExpanded] = useState(false) const [expanded, setExpanded] = useState(false)
const onTextLayout = useCallback(({ nativeEvent }) => { const onTextLayout = useCallback(({ nativeEvent }) => {
if ( switch (Platform.OS) {
nativeEvent.lines && case 'ios':
nativeEvent.lines.length === numberOfLines + 1 if (nativeEvent.lines.length === numberOfLines + 1) {
) {
setExpandAllow(true) setExpandAllow(true)
} }
break
case 'android':
if (nativeEvent.lines.length > numberOfLines + 1) {
setExpandAllow(true)
}
break
}
}, []) }, [])
return ( return (