Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
ReactJs (native) - Transition variable from one value to another incrementally

Is there a way to make a transitional change of value with increments over time in React native (or any method in JS that I don't know of / can't find?

I could of course create some sort of loop with interval or setTimeout, but I was wondering if there is something like the Animated API with interpolation that could be used to just change a value when there is not actually any view that is being animated?

In my case I want to change the screen brightness of the users device smoothly, right now it goes from 0-1 instantly, which is not what I want.

I will provide code in case anyone would like to see that. This process takes place in a useEffect() that reacts when the user is opening a scannable code on their screen.

    const [brightness, setBrightness] = useState(null);
     ...
     ...
         useEffect(() => {
               (async () => {
                    const currentBrightness =
                        await DeviceBrightness.getBrightnessLevel();
                    setBrightness(currentBrightness);
                })();
                if (isOpened) {
                    DeviceBrightness.setBrightnessLevel(1);
                }
                if (!isOpened && brightness) {
                    DeviceBrightness.setBrightnessLevel(brightness);
                }
        }, [isOpened]);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!