vydimitrov / react-countdown-circle-timer

Lightweight React/React Native countdown timer component with color and progress animation based on SVG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add gradient colors like it was in prior versions?

djaffer opened this issue · comments

I have a simple question on how to add a gradient that was there before?

colors={[['#004777', 0.33], ['#F7B801', 0.33], ['#A30000']]}

It would be nice to have smooth migration guidelines.

Hey @djaffer, is this about the Web package? If yes. then you can see one example here

Is this the same as the one above. I am just trying to have example equivalent the example you had in past as it is easier to than really link them.

Yup, it was easier but it was not really used much so I decided to remove it from the bundle so other users do not pay the price of having it in the bundle every time. You can use the one below to get the same gradient as before:

<svg>
  <defs>
    <linearGradient id="countdown-circle-timer-gradient" x1="1" y1="0" x2="0" y2="0">
      <stop offset="0" stop-color="#004777" />>
      <stop offset="0.33" stop-color="#004777"/>
      <stop offset="0.66" stop-color="#F7B801"/>
      <stop offset="1" stop-color="#A30000" />
    </linearGradient>
  </defs>
</svg>
<CountdownCircleTimer colors="url(#countdown-circle-timer-gradient)">
  {({ remainingTime }) => remainingTime}
</CountdownCircleTimer>

Thank you @vydimitrov