import { ReactNode, useEffect, useRef } from "react"; import { View, StyleSheet, Animated, Pressable, ViewStyle, Dimensions, } from "react-native"; const { width: screenWidth } = Dimensions.get("window"); interface GalaxyButtonProps { children: ReactNode; onPress: () => void; style?: ViewStyle; } export function GalaxyButton({ children, onPress, style }: GalaxyButtonProps) { const starsTranslateY = useRef(new Animated.Value(0)).current; const starsRotate = useRef(new Animated.Value(0)).current; useEffect(() => { // Star field animations Animated.loop( Animated.timing(starsTranslateY, { toValue: -135, duration: 60000, useNativeDriver: true, }) ).start(); Animated.loop( Animated.timing(starsRotate, { toValue: 1, duration: 90000, useNativeDriver: true, }) ).start(); }, [starsTranslateY, starsRotate]); const rotateInterpolate = starsRotate.interpolate({ inputRange: [0, 1], outputRange: ["0deg", "360deg"], }); return ( {/* Animated star field behind content */} {Array.from({ length: 30 }).map((_, i) => ( ))} {/* Button content */} {children} ); } const styles = StyleSheet.create({ buttonContainer: { position: "relative", backgroundColor: "rgba(31, 31, 31, 0.85)", borderRadius: 12, borderWidth: 1, borderColor: "rgba(255, 255, 255, 0.12)", overflow: "hidden", }, starsContainer: { ...StyleSheet.absoluteFillObject, overflow: "hidden", }, starsLayer: { position: "absolute", width: screenWidth * 3, height: 800, }, star: { position: "absolute", backgroundColor: "#ffffff", borderRadius: 50, shadowColor: "#ffffff", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.3, shadowRadius: 1, }, });