Trying to make a spinner with Moti but having some issue with the speeding down (just want it to spin for ever (I do like that it starts out slow, but not needed).
import { Feather } from '@expo/vector-icons'
import { MotiText } from 'moti'
import React from 'react'
import type { TextStyle } from 'react-native'
import { Colors } from '~/constants/Theme'
type Props = {
color?: TextStyle['color']
size?: number
}
export function LoadingSpinner({ color = Colors['white'], size = 15 }: Props) {
return (
<MotiText
from={{
rotate: '0deg',
}}
animate={{
rotate: '360deg',
}}
transition={{
loop: true,
repeatReverse: false,
type: 'timing',
duration: 5000,
}}
>
<Feather
name="loader"
size={size}
style={{
paddingBottom: 5,
color,
}}
/>
</MotiText>
)
}
I'm guessing that it's type: 'timing',
that's the issue, but it seems like I can only do timing
and spring
CodePudding user response:
Have you tried adding easing: Easing.linear
to transition
, where Easing
is imported from react-native-reanimated
?