// Source - https://stackoverflow.com/a/74182982 // Posted by TOPKAT, modified by community. See post 'Timeline' for change history // Retrieved 2026-02-18, License - CC BY-SA 4.0 import { StyleSheet, View, ViewProps } from "react-native"; import Animated from "react-native-reanimated"; import Svg, { Defs, LinearGradient, NumberProp, Rect, Stop, } from "react-native-svg"; type GradientProps = { fromColor: string; toColor: string; children?: any; height?: NumberProp; opacityColor1?: number; opacityColor2?: number; } & ViewProps; function Gradient({ children, fromColor, toColor, height = "100%", opacityColor1 = 1, opacityColor2 = 1, style, ...otherViewProps }: GradientProps) { const gradientUniqueId = `grad${fromColor}+${toColor}`.replace( /[^a-zA-Z0-9 ]/g, "", ); return ( {children} ); } export const AnimatedGradient = Animated.createAnimatedComponent(Gradient); export default Gradient;