diff --git a/components/common/loadingSymbol.tsx b/components/common/loadingSymbol.tsx index 17fb29a..b7e1a03 100644 --- a/components/common/loadingSymbol.tsx +++ b/components/common/loadingSymbol.tsx @@ -1,23 +1,49 @@ -import { StyleSheet, View } from "react-native"; +import React, { useEffect, useRef } from "react"; +import { StyleSheet, View, Animated, Easing, ActivityIndicator } from "react-native"; const LoadingSymbol = () => { + const color = ["blue", "red", "purple", "green", "yellow", "orange"]; + const random = Math.floor(Math.random() * color.length); - const color = ["blue", "red", "purple", "green", "yellow", "orange"]; - const random = Math.floor(Math.random() * color.length); + const spinValue = useRef(new Animated.Value(0)).current; - const styles = StyleSheet.create({ - container: { - backgroundColor: color[random], - width: "100%", - height: "100%", - position: "absolute", - } - }); + const spin = spinValue.interpolate({ + inputRange: [0, 1], + outputRange: ["0deg", "360deg"], + }); - return ( - + useEffect(() => { + Animated.loop( + Animated.timing(spinValue, { + toValue: 1, + duration: 2000, + easing: Easing.linear, + useNativeDriver: true, + }) + ).start(); + }, [spinValue]); + + const styles = StyleSheet.create({ + container: { + backgroundColor: color[random], + width: "100%", + height: "100%", + position: "absolute", + justifyContent: "center", + alignItems: "center", + }, + loader: { + width: 100, + height: 100, + transform: [{ rotate: spin }], + }, + }); + + return ( + + + ); -} +}; - -export default LoadingSymbol; \ No newline at end of file +export default LoadingSymbol;