mirror of
https://github.com/tooot-app/app
synced 2025-04-23 22:57:23 +02:00
Small fixes
This commit is contained in:
parent
516bb1e67d
commit
80e23d8a31
@ -235,7 +235,7 @@ const ParseHTML = React.memo(
|
|||||||
const [expanded, setExpanded] = useState(false)
|
const [expanded, setExpanded] = useState(false)
|
||||||
|
|
||||||
const onTextLayout = useCallback(({ nativeEvent }) => {
|
const onTextLayout = useCallback(({ nativeEvent }) => {
|
||||||
if (nativeEvent.lines.length >= numberOfLines) {
|
if (nativeEvent.lines.length >= numberOfLines + 5) {
|
||||||
setExpandAllow(true)
|
setExpandAllow(true)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
@ -245,7 +245,9 @@ const ParseHTML = React.memo(
|
|||||||
<Text
|
<Text
|
||||||
children={children}
|
children={children}
|
||||||
onTextLayout={onTextLayout}
|
onTextLayout={onTextLayout}
|
||||||
numberOfLines={expanded ? 999 : numberOfLines}
|
numberOfLines={
|
||||||
|
expandAllow ? (expanded ? 999 : numberOfLines) : undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
{expandAllow ? (
|
{expandAllow ? (
|
||||||
<Pressable
|
<Pressable
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Button from '@components/Button'
|
import Button from '@components/Button'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import { Video } from 'expo-av'
|
import { Video } from 'expo-av'
|
||||||
import React, { useCallback, useRef, useState } from 'react'
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { Pressable, StyleSheet, View } from 'react-native'
|
import { Pressable, StyleSheet, View } from 'react-native'
|
||||||
import { Blurhash } from 'react-native-blurhash'
|
import { Blurhash } from 'react-native-blurhash'
|
||||||
import attachmentAspectRatio from './aspectRatio'
|
import attachmentAspectRatio from './aspectRatio'
|
||||||
@ -54,6 +54,12 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
})
|
})
|
||||||
}, [videoLoaded, videoPosition])
|
}, [videoLoaded, videoPosition])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (gifv) {
|
||||||
|
videoPlayer.current?.setIsLoopingAsync(true)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
@ -68,10 +74,14 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
opacity: sensitiveShown ? 0 : 1
|
opacity: sensitiveShown ? 0 : 1
|
||||||
}}
|
}}
|
||||||
resizeMode='cover'
|
|
||||||
usePoster
|
usePoster
|
||||||
posterSource={{ uri: video.preview_url }}
|
{...(gifv
|
||||||
posterStyle={{ resizeMode: 'cover' }}
|
? { shouldPlay: true, source: { uri: video.url } }
|
||||||
|
: {
|
||||||
|
resizeMode: 'cover',
|
||||||
|
posterSource: { uri: video.preview_url },
|
||||||
|
posterStyle: { resizeMode: 'cover' }
|
||||||
|
})}
|
||||||
useNativeControls={false}
|
useNativeControls={false}
|
||||||
onFullscreenUpdate={event => {
|
onFullscreenUpdate={event => {
|
||||||
if (event.fullscreenUpdate === 3) {
|
if (event.fullscreenUpdate === 3) {
|
||||||
@ -94,7 +104,7 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
) : (
|
) : !gifv ? (
|
||||||
<Button
|
<Button
|
||||||
round
|
round
|
||||||
overlay
|
overlay
|
||||||
@ -104,7 +114,7 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
onPress={playOnPress}
|
onPress={playOnPress}
|
||||||
loading={videoLoading}
|
loading={videoLoading}
|
||||||
/>
|
/>
|
||||||
)}
|
) : null}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
@ -229,7 +229,7 @@ const TimelinePoll: React.FC<Props> = ({
|
|||||||
style={styles.optionContainer}
|
style={styles.optionContainer}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
analytics('timeline_shared_vote_option_press')
|
analytics('timeline_shared_vote_option_press')
|
||||||
haptics('Light')
|
!allOptions[index] && haptics('Light')
|
||||||
if (poll.multiple) {
|
if (poll.multiple) {
|
||||||
setAllOptions(allOptions.map((o, i) => (i === index ? !o : o)))
|
setAllOptions(allOptions.map((o, i) => (i === index ? !o : o)))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user