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 (
<Animated.View
style={[
containers.containerFull,
{
transform: [
{
translateY: animated.interpolate({
inputRange: [0, 1],
outputRange: [Dimensions.get("window").height, 0],
}),
},
],
},
]}
>
<Box <Box
backgroundColor={"white"} backgroundColor={"white"}
borderTopLeftRadius={30} borderTopLeftRadius={30}
...@@ -12,6 +38,7 @@ const ContainerBorderTopCurved = ({ children }: Props) => { ...@@ -12,6 +38,7 @@ const ContainerBorderTopCurved = ({ children }: Props) => {
> >
{children} {children}
</Box> </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