revert unnecessary gif changes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react'
|
import {useRef, useState} from 'react'
|
||||||
import {
|
import {
|
||||||
Pressable,
|
Pressable,
|
||||||
type StyleProp,
|
type StyleProp,
|
||||||
@@ -91,9 +91,9 @@ export function GifEmbed({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const autoplayDisabled = useAutoplayDisabled()
|
const autoplayDisabled = useAutoplayDisabled()
|
||||||
|
|
||||||
const playerRef = React.useRef<GifView>(null)
|
const playerRef = useRef<GifView>(null)
|
||||||
|
|
||||||
const [playerState, setPlayerState] = React.useState<{
|
const [playerState, setPlayerState] = useState<{
|
||||||
isPlaying: boolean
|
isPlaying: boolean
|
||||||
isLoaded: boolean
|
isLoaded: boolean
|
||||||
}>({
|
}>({
|
||||||
@@ -101,23 +101,18 @@ export function GifEmbed({
|
|||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const onPlayerStateChange = React.useCallback(
|
const onPlayerStateChange = (e: GifViewStateChangeEvent) => {
|
||||||
(e: GifViewStateChangeEvent) => {
|
setPlayerState(e.nativeEvent)
|
||||||
setPlayerState(e.nativeEvent)
|
}
|
||||||
},
|
|
||||||
[],
|
|
||||||
)
|
|
||||||
|
|
||||||
const onPress = React.useCallback(() => {
|
const onPress = () => {
|
||||||
playerRef.current?.toggleAsync()
|
void playerRef.current?.toggleAsync()
|
||||||
}, [])
|
}
|
||||||
|
|
||||||
let aspectRatio = 1
|
let aspectRatio = 1
|
||||||
if (params.dimensions) {
|
if (params.dimensions) {
|
||||||
const ratio = params.dimensions.width / params.dimensions.height
|
const ratio = params.dimensions.width / params.dimensions.height
|
||||||
if (!isNaN(ratio) && isFinite(ratio)) {
|
aspectRatio = clamp(ratio, 0.75, 4)
|
||||||
aspectRatio = clamp(ratio, 0.75, 4)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user