[Video] `withRepeat` for spinner (#5141)

zio/stable
Hailey 2024-09-04 09:39:34 -07:00 committed by GitHub
parent 45bb2477d8
commit 12b4a250d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -27,6 +27,7 @@ import Animated, {
useAnimatedStyle, useAnimatedStyle,
useDerivedValue, useDerivedValue,
useSharedValue, useSharedValue,
withRepeat,
withTiming, withTiming,
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
@ -1089,10 +1090,13 @@ function VideoUploadToolbar({state}: {state: VideoUploadState}) {
const rotate = useDerivedValue(() => { const rotate = useDerivedValue(() => {
if (progress === 0 || progress >= 0.99) { if (progress === 0 || progress >= 0.99) {
return withTiming(360, { return withRepeat(
duration: 2500, withTiming(360, {
easing: Easing.out(Easing.cubic), duration: 2500,
}) easing: Easing.out(Easing.cubic),
}),
-1,
)
} }
return 0 return 0
}) })