mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
parent
4a28d47b41
commit
44f83e44b9
@ -7,6 +7,7 @@ import { Blurhash } from 'react-native-blurhash'
|
|||||||
import attachmentAspectRatio from './aspectRatio'
|
import attachmentAspectRatio from './aspectRatio'
|
||||||
import AttachmentAltText from './AltText'
|
import AttachmentAltText from './AltText'
|
||||||
import { Platform } from 'expo-modules-core'
|
import { Platform } from 'expo-modules-core'
|
||||||
|
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
total: number
|
total: number
|
||||||
@ -23,6 +24,8 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
video,
|
video,
|
||||||
gifv = false
|
gifv = false
|
||||||
}) => {
|
}) => {
|
||||||
|
const { reduceMotionEnabled } = useAccessibility()
|
||||||
|
|
||||||
const videoPlayer = useRef<Video>(null)
|
const videoPlayer = useRef<Video>(null)
|
||||||
const [videoLoading, setVideoLoading] = useState(false)
|
const [videoLoading, setVideoLoading] = useState(false)
|
||||||
const [videoLoaded, setVideoLoaded] = useState(false)
|
const [videoLoaded, setVideoLoaded] = useState(false)
|
||||||
@ -57,7 +60,7 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
resizeMode={videoResizeMode}
|
resizeMode={videoResizeMode}
|
||||||
{...(gifv
|
{...(gifv
|
||||||
? {
|
? {
|
||||||
shouldPlay: true,
|
shouldPlay: reduceMotionEnabled ? false : true,
|
||||||
isMuted: true,
|
isMuted: true,
|
||||||
isLooping: true,
|
isLooping: true,
|
||||||
source: { uri: video.url }
|
source: { uri: video.url }
|
||||||
@ -70,10 +73,10 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
onFullscreenUpdate={event => {
|
onFullscreenUpdate={event => {
|
||||||
if (event.fullscreenUpdate === VideoFullscreenUpdate.PLAYER_DID_DISMISS) {
|
if (event.fullscreenUpdate === VideoFullscreenUpdate.PLAYER_DID_DISMISS) {
|
||||||
Platform.OS === 'android' && setVideoResizeMode(ResizeMode.COVER)
|
Platform.OS === 'android' && setVideoResizeMode(ResizeMode.COVER)
|
||||||
if (!gifv) {
|
if (gifv && !reduceMotionEnabled) {
|
||||||
videoPlayer.current?.pauseAsync()
|
|
||||||
} else {
|
|
||||||
videoPlayer.current?.playAsync()
|
videoPlayer.current?.playAsync()
|
||||||
|
} else {
|
||||||
|
videoPlayer.current?.pauseAsync()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@ -103,7 +106,7 @@ const AttachmentVideo: React.FC<Props> = ({
|
|||||||
video.blurhash ? (
|
video.blurhash ? (
|
||||||
<Blurhash blurhash={video.blurhash} style={{ width: '100%', height: '100%' }} />
|
<Blurhash blurhash={video.blurhash} style={{ width: '100%', height: '100%' }} />
|
||||||
) : null
|
) : null
|
||||||
) : !gifv ? (
|
) : !gifv || (gifv && reduceMotionEnabled) ? (
|
||||||
<Button
|
<Button
|
||||||
round
|
round
|
||||||
overlay
|
overlay
|
||||||
|
@ -6,8 +6,7 @@ import { ScreenTabsScreenProps, TabLocalStackParamList } from '@utils/navigation
|
|||||||
import usePopToTop from '@utils/navigation/usePopToTop'
|
import usePopToTop from '@utils/navigation/usePopToTop'
|
||||||
import { useListsQuery } from '@utils/queryHooks/lists'
|
import { useListsQuery } from '@utils/queryHooks/lists'
|
||||||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
import layoutAnimation from '@utils/styles/layoutAnimation'
|
import React, { useState } from 'react'
|
||||||
import React, { useEffect, useState } from 'react'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import * as DropdownMenu from 'zeego/dropdown-menu'
|
import * as DropdownMenu from 'zeego/dropdown-menu'
|
||||||
import TabShared from './Shared'
|
import TabShared from './Shared'
|
||||||
@ -19,9 +18,6 @@ const TabLocal = React.memo(
|
|||||||
const { t } = useTranslation('screenTabs')
|
const { t } = useTranslation('screenTabs')
|
||||||
|
|
||||||
const { data: lists } = useListsQuery({})
|
const { data: lists } = useListsQuery({})
|
||||||
useEffect(() => {
|
|
||||||
layoutAnimation()
|
|
||||||
}, [lists?.length])
|
|
||||||
|
|
||||||
const [queryKey, setQueryKey] = useState<QueryKeyTimeline>(['Timeline', { page: 'Following' }])
|
const [queryKey, setQueryKey] = useState<QueryKeyTimeline>(['Timeline', { page: 'Following' }])
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { LayoutAnimation } from 'react-native'
|
import { AccessibilityInfo, LayoutAnimation } from 'react-native'
|
||||||
|
|
||||||
|
const layoutAnimation = async () => {
|
||||||
|
const disable = await AccessibilityInfo.isReduceMotionEnabled()
|
||||||
|
if (disable) return
|
||||||
|
|
||||||
const layoutAnimation = () =>
|
|
||||||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||||
|
}
|
||||||
|
|
||||||
export default layoutAnimation
|
export default layoutAnimation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user