1
0
mirror of https://github.com/tooot-app/app synced 2025-02-18 04:40:57 +01:00

Small fixes

This commit is contained in:
Zhiyuan Zheng 2021-03-27 00:47:14 +01:00
parent 516bb1e67d
commit 80e23d8a31
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
3 changed files with 21 additions and 9 deletions

View File

@ -235,7 +235,7 @@ const ParseHTML = React.memo(
const [expanded, setExpanded] = useState(false)
const onTextLayout = useCallback(({ nativeEvent }) => {
if (nativeEvent.lines.length >= numberOfLines) {
if (nativeEvent.lines.length >= numberOfLines + 5) {
setExpandAllow(true)
}
}, [])
@ -245,7 +245,9 @@ const ParseHTML = React.memo(
<Text
children={children}
onTextLayout={onTextLayout}
numberOfLines={expanded ? 999 : numberOfLines}
numberOfLines={
expandAllow ? (expanded ? 999 : numberOfLines) : undefined
}
/>
{expandAllow ? (
<Pressable

View File

@ -1,7 +1,7 @@
import Button from '@components/Button'
import { StyleConstants } from '@utils/styles/constants'
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 { Blurhash } from 'react-native-blurhash'
import attachmentAspectRatio from './aspectRatio'
@ -54,6 +54,12 @@ const AttachmentVideo: React.FC<Props> = ({
})
}, [videoLoaded, videoPosition])
useEffect(() => {
if (gifv) {
videoPlayer.current?.setIsLoopingAsync(true)
}
}, [])
return (
<View
style={[
@ -68,10 +74,14 @@ const AttachmentVideo: React.FC<Props> = ({
height: '100%',
opacity: sensitiveShown ? 0 : 1
}}
resizeMode='cover'
usePoster
posterSource={{ uri: video.preview_url }}
posterStyle={{ resizeMode: 'cover' }}
{...(gifv
? { shouldPlay: true, source: { uri: video.url } }
: {
resizeMode: 'cover',
posterSource: { uri: video.preview_url },
posterStyle: { resizeMode: 'cover' }
})}
useNativeControls={false}
onFullscreenUpdate={event => {
if (event.fullscreenUpdate === 3) {
@ -94,7 +104,7 @@ const AttachmentVideo: React.FC<Props> = ({
}}
/>
) : null
) : (
) : !gifv ? (
<Button
round
overlay
@ -104,7 +114,7 @@ const AttachmentVideo: React.FC<Props> = ({
onPress={playOnPress}
loading={videoLoading}
/>
)}
) : null}
</Pressable>
</View>
)

View File

@ -229,7 +229,7 @@ const TimelinePoll: React.FC<Props> = ({
style={styles.optionContainer}
onPress={() => {
analytics('timeline_shared_vote_option_press')
haptics('Light')
!allOptions[index] && haptics('Light')
if (poll.multiple) {
setAllOptions(allOptions.map((o, i) => (i === index ? !o : o)))
} else {