How to use gradient colors in RN projects
See original GitHub issueI looked at the examples for the web version, but it didn’t solve my problem.

I run react-native init myapp
to create a RN project, and run yarn add react-native-svg react-native-countdown-circle-timer@3.0.8
to add dependencies.
This is my App.js
import React from 'react';
import {Text, View} from 'react-native';
import Svg, {Defs, LinearGradient, Stop} from "react-native-svg";
import { CountdownCircleTimer } from 'react-native-countdown-circle-timer'
export default function App() {
return (
<View>
<Svg width="0" height="0" >
<Defs>
<LinearGradient id="your-unique-id" x1="1" y1="0" x2="0" y2="0">
<Stop offset="5%" stopColor="gold"/>
<Stop offset="95%" stopColor="red"/>
</LinearGradient>
</Defs>
</Svg>
<CountdownCircleTimer
colors="url(#your-unique-id)"
size={200}
strokeWidth={20}
duration={60}
initialRemainingTime={25}>
{({remainingTime}) => <Text>{remainingTime}</Text>}
</CountdownCircleTimer>
</View>
);
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Creating complex gradients with react-native-linear-gradient
A gradient is a design technique that blends more than one color together in a smooth transition. For example, think of the Instagram...
Read more >React Native Linear Gradient - GitHub
An array of at least two color values that represent gradient colors. Example: ['red', 'blue'] sets gradient from red to blue. start. An...
Read more >Does React Native styles support gradients? - Stack Overflow
Just export your gradient as SVG and use it using react-native-svg and when after you import your component set width and height and ......
Read more >7 Ways to Use Gradient Colors in Your Creative Projects
From gradient backgrounds to social media templates, here's how to use gradient colors in your creative projects.
Read more >rn-gradients - npm
Start using rn-gradients in your project by running `npm i rn-gradients`. There are no other projects in the npm registry using rn-gradients.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey you can restart the timer the same way you do it with the component, by passing a
key
. So below is your CountdownCircleTimer:Then in your App you just use it as it was before
Does it help?
Worked for me as well. Thanks!