diff --git a/examples/with-expo/src/Moti.Skeleton.tsx b/examples/with-expo/src/Moti.Skeleton.tsx index e3065fa..c40d5ca 100644 --- a/examples/with-expo/src/Moti.Skeleton.tsx +++ b/examples/with-expo/src/Moti.Skeleton.tsx @@ -9,7 +9,7 @@ const transition = { opacity: { duration: 300, }, -} +} as const export default function HelloWorld() { const [dark, toggle] = useReducer((s) => !s, true) @@ -25,27 +25,13 @@ export default function HelloWorld() { style={[styles.container, styles.padded]} animate={{ backgroundColor: dark ? '#000000' : '#ffffff' }} > - + - + - + - + ) diff --git a/packages/skeleton/src/skeleton.tsx b/packages/skeleton/src/skeleton.tsx index 69b17f0..19b4add 100644 --- a/packages/skeleton/src/skeleton.tsx +++ b/packages/skeleton/src/skeleton.tsx @@ -96,7 +96,7 @@ for (let i = 0; i++; i < 3) { defaultLightColors = [...defaultLightColors, ...defaultLightColors] } -export default function Skelton(props: Props) { +export default function Skeleton(props: Props) { const { radius = 8, children, @@ -110,7 +110,7 @@ export default function Skelton(props: Props) { colors[1] ?? baseColors[colorMode]?.secondary, disableExitAnimation, - transition = {}, + transition, } = props const [measuredWidth, setMeasuredWidth] = useState(0) @@ -162,6 +162,9 @@ export default function Skelton(props: Props) { backgroundColor, opacity: 1, }} + transition={{ + type: 'timing', + }} exit={ !disableExitAnimation && { opacity: 0, @@ -177,7 +180,7 @@ export default function Skelton(props: Props) { + - + duration: 3000, + ...(transition as any), + }} + > + + ) },