diff --git a/squarenotsquare/src/components/Slider.js b/squarenotsquare/src/components/Slider.js new file mode 100644 index 0000000..b0942b6 --- /dev/null +++ b/squarenotsquare/src/components/Slider.js @@ -0,0 +1,25 @@ +import React from "react"; +import { Animated, Easing} from "react-native"; +import { useEffect, useState } from "react"; + +function LeftToRight(props){ + const [xPosition, setXPosition] = useState(new Animated.Value(props.origin)); + + useEffect(() => { + Animated.timing(xPosition, { + toValue: 0, + easing: Easing.back(), + duration: props.duration, + useNativeDriver: true + }).start(); + }, []); + + + return ( + + {props.children} + + ) +} + +export default LeftToRight; \ No newline at end of file diff --git a/squarenotsquare/src/screens/Home.js b/squarenotsquare/src/screens/Home.js index d5b0ec3..8333bb6 100644 --- a/squarenotsquare/src/screens/Home.js +++ b/squarenotsquare/src/screens/Home.js @@ -6,6 +6,7 @@ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icons from '../themes/Icons'; import Colors from "../themes/Colors"; import Metrics from "../themes/Metrics"; +import Slider from "../components/Slider"; function Home(props){ @@ -35,16 +36,20 @@ function Home(props){ - - - Start - - - - - High Scores - - + + + + Start + + + + + + + High Scores + + +