question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Animated: `useNativeDriver` was not specified" warning since React Native 0.62

See original GitHub issue

Following warning keeps appearing whenever I click on any button or item:

Animated: useNativeDriver was not specified. This is a required option and must be explicitly set to true or false

react-native: 0.62

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:33
  • Comments:19

github_iconTop GitHub Comments

28reactions
blindibrasilcommented, Apr 20, 2020

I think the solution to the problem will be to implement the following change to the ActionButton.js file;

 //////////////////////
  // Animation Methods
  //////////////////////

  animateButton(animate = true) {
    if (this.state.active) return this.reset();

    if (animate) {
      Animated.spring(this.anim, { toValue: 1, useNativeDriver: false }).start();
    } else {
      this.anim.setValue(1);
    }

    this.setState({ active: true, resetToken: this.state.resetToken });
  }

  reset(animate = true) {
    if (this.props.onReset) this.props.onReset();

    if (animate) {
      Animated.spring(this.anim, { toValue: 0, useNativeDriver: false }).start();
    } else {
      this.anim.setValue(0);
    }

    setTimeout(() => {
      if (this.mounted) {
        this.setState({ active: false, resetToken: this.state.resetToken });
      }
    }, 250);
  }
10reactions
mannyhappeningscommented, Aug 2, 2020

Until the PRs get merged, monkey patching the class works,

Hope this helps to some people annoyed by that warning

import RNActionButton from 'react-native-action-button'
import { Animated } from 'react-native'

RNActionButton.prototype.animateButton = function(animate = true) {
    if (this.state.active) return this.reset();

    if (animate) {
      Animated.spring(this.anim, { toValue: 1, useNativeDriver: false }).start();
    } else {
      this.anim.setValue(1);
    }

    this.setState({ active: true, resetToken: this.state.resetToken });
}

RNActionButton.prototype.reset = function (animate = true) {
    if (this.props.onReset) this.props.onReset();

    if (animate) {
      Animated.spring(this.anim, { toValue: 0, useNativeDriver: false }).start();
    } else {
      this.anim.setValue(0);
    }

    setTimeout(() => {
      if (this.mounted) {
        this.setState({ active: false, resetToken: this.state.resetToken });
      }
    }, 250);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

`useNativeDriver` was not specified. This is a required 'option ...
warn : Animated: useNativeDriver was not specified. This is a required 'option and must be explicitly set to ... React Native version:0.62.1.
Read more >
Animated: `useNativeDriver` was not specified issue of ...
As the warning says, we need to specify the useNativeDriver option explicitly ... In react native SDK 39 you have to write following...
Read more >
How to Fix Animated: `useNativeDriver` was not specified ...
1- First solution for Animation and Animatable As the warning says, we need to specify the useNativeDriver option explicitly and set it to...
Read more >
React-native – warning Animated: `useNativeDriver` was not ...
I am using React-Native to develop Android-APP, After React-Native version upgrading from 61.0 to 0-62.2, I encountered a problem. Animated: useNativeDriver ...
Read more >
"Animated: `useNativeDriver` was not specified" warning since ...
Following warning keeps appearing whenever I click on any button or item: Animated: useNativeDriver was not specified. This is a required option and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found