Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda