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

400
Visualizações
Get current value of Animated.Value, React-native

I'm trying to animate View with interpolate. I'd like to get a current value of my Animated.Value, but don't know how. I didn't understand how to do it with React-native docs.

this.state = {
      translateAnim: new Animated.Value(0)
}
DeviceEventEmitter.addListener('Accelerometer', function (data) {
  console.log(this.state.translateAnim);
  // returns an object, but I need a value in current moment
}
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I find out, how to get a value:

this.state.translateAnim.addListener(({value}) => this._value = value);

EDIT

to log a value I do the following:

console.log(this.state.translateAnim._value)
over 4 years ago · Santiago Trujillo Relatório

0

For the people with typescript.

console.log((this.state.translateAnim as any)._value);

It worked for me to full tsc as any.

over 4 years ago · Santiago Trujillo Relatório

0

This also works for me...

const headerHeight = new Animated.Value(0);

After some manipulation....

console.log(headerHeight.__getValue())

It feels hackish but it gets the job done...

over 4 years ago · Santiago Trujillo Relatório
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