Commit 0fb08aa4 by G

spring animation from bottom to top once when rendering.

parent 2f22c93a
import { containers } from "@styles/Commons"; import { containers } from "@styles/Commons";
import { useEffect } from "react";
import { Animated, Dimensions } from "react-native";
import Box from "./bases/Box"; import Box from "./bases/Box";
type Props = { children: React.ReactNode }; type Props = { children: React.ReactNode };
const ContainerBorderTopCurved = ({ children }: Props) => { const ContainerBorderTopCurved = ({ children }: Props) => {
const animated = new Animated.Value(0);
useEffect(() => {
Animated.spring(animated, {
toValue: 1,
useNativeDriver: true,
}).start();
}, [animated]);
return ( return (
<Box <Animated.View
backgroundColor={"white"} style={[
borderTopLeftRadius={30} containers.containerFull,
borderTopRightRadius={30} {
style={containers.containerFull} transform: [
{
translateY: animated.interpolate({
inputRange: [0, 1],
outputRange: [Dimensions.get("window").height, 0],
}),
},
],
},
]}
> >
{children} <Box
</Box> backgroundColor={"white"}
borderTopLeftRadius={30}
borderTopRightRadius={30}
style={containers.containerFull}
>
{children}
</Box>
</Animated.View>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment