Nativebase: react-native 0.62.0 - Animated: `useNativeDriver`

Created on 28 Mar 2020  路  62Comments  路  Source: GeekyAnts/NativeBase

I have gone through these following points

Issue Description

node, npm, react-native, react and native-base version, expo version if used, xcode version

node: v12.14.1
npm: 6.14.4
react-native: 0.62.0
native-base: 2.13.12

Expected behaviour

Actual behaviour

Get some warning in react-native console since react-native 0.62.0.
WARN Animated: "useNativeDriver" was not specified. This is a required option and must be explicitly set to "true" or "false".

Steps to reproduce

Just run a react-native app and use some components with animation without specify useNativeDriver, like <Toast>.

Is the bug present in both iOS and Android or in any one of them?

Both iOS and Android.

Any other additional info which would help us debug the issue quicker.

PR Added

Most helpful comment

Guys.. this is impacting everyone using latest ReactNative .. it would be helpful to all if admin can rollout the fix soon ...

All 62 comments

Same here :)

Same here. Please fix this issue

Same <Item> with floatingLabel

<Form>
    <Item floatingLabel>
        <Label>Username</Label>
        <Input />
    </Item>
    <Item floatingLabel last>
        <Label>Password</Label>
        <Input />
    </Item>
</Form>

for toast replace ~\node_modules\native-base\dist\src\basic\ToastContainer.js by this code https://pastebin.com/mDfeg13E
or you can add useNativeDriver manually, just search _animated.timing_ on nativebase module

sory for my bad english

This would make a great first contribution for somebody to create a Pull Request for. It will mostly be a matter of finding all instances of Animated.timing or Animated.spring and adding useNativeDriver: false to the config.

Ideally useNativeDriver: true should be used for performance, but to match the current implementation of this library and avoid any headaches with working out which values can/cannot be natively driven and any elements that might have both native and JS driven animations it'll be safest just to throw useNativeDriver: false on all instances.

Same error here!

I have same error.

Created a PR for this per @levibuzolic comments above: https://github.com/GeekyAnts/NativeBase/pull/3136

Currently using my fork to avoid the yellow warnings until they merge or fix and it's working fine for me now:
"dependencies: {
...
"native-base": "https://github.com/dansokol/NativeBase.git",
...
}

Created a PR for this per @levibuzolic comments above: #3136

Currently using my fork to avoid the yellow warnings until they merge or fix and it's working fine for me now:
"dependencies: {
...
"native-base": "https://github.com/dansokol/NativeBase.git",
...
}

Waiting for merge)

in *\node_modules\native-base\dist\src\basic\Item.js search on 'animated.timing' and add 'useNativeDriver: false' to every callback function, this gonna hide the warning, (if u add useNativeDriver: true, you gonna face an error tell you that nativeDriver do not support Top (bla bala)), sorry for my bad english.

I got the warning using any of the input float labeled from NativeBase. I saw that it was merged but still got the warning after the update. Does anyone know if it must make any configuration manually?

I only updated the "src" directory.

Wasn't sure if I should be committing to the "dist" directory as well. Think it will be in the next update that compiles the src directory and updates the "dist" directory.

Would be great to have the latest release soon

same yellow warning here :(

Any update on this issue?

Edit: Found that is already fixed by GeekyAnts/NativeBase#3136 but not rolled to production yet, even that already merged!

Waiting for this

@astrahov

Same <Item> with floatingLabel

<Form>
    <Item floatingLabel>
        <Label>Username</Label>
        <Input />
    </Item>
    <Item floatingLabel last>
        <Label>Password</Label>
        <Input />
    </Item>
</Form>

in *\node_modules\native-base\dist\src\basic\Item.js search on 'animated.timing' and add 'useNativeDriver: false' ex: _reactNative.Animated.timing(this.state.opacAnim,{toValue:0.7,duration:150, useNativeDriver: false}).start();}}

@levibuzolic it looks like there is a PR waiting for this to be rolled out. Can we please get this merged?

Guys.. this is impacting everyone using latest ReactNative .. it would be helpful to all if admin can rollout the fix soon ...

Go Team .. It impacting everyone using latest ReactNative ... Can you help us by making the latest release available please

same warning... :(
don't want to downgrade rn version
plz fix it asap

is there any quick solution for this?

@damasofc downgrade RN below 0.62

Or the admins could merge the PR and deploy @levibuzolic

Hi ! any news on this ?

I've been using patch-package to keep the changes until the PR merges. I highly recommend it as the tool keeps the changes whenever a new version is released and an issue was never reconciled in the new version. Nice band-aid until admins merge the PR.

Any news on this?????????????

Same here, any news?

Any update

same here, any updates for this fix ?

for now on

Created a PR for this per @levibuzolic comments above: #3136
Currently using my fork to avoid the yellow warnings until they merge or fix and it's working fine for me now:
"dependencies: {
...
"native-base": "https://github.com/dansokol/NativeBase.git",
...
}

Waiting for merge)

Currently using this PR until the update rolls out.

https://github.com/dansokol/NativeBase.git PR working for me as well

Any luck on this? Any chance of getting a new npm version rolled out by this week?

I'm also waiting for a fix, any news ?

same warning -_- , I'm waiting updates for fix this

Facing same issue from a long time and still no update from native-base developers yet.

We will have to wait till they officially fix it, or they do merge the existing PR for the fix.
Meanwhile use workaround to avoid irritating yellow warnings of useNativeDriver.

Do addition of following lines in your App.js file.

import {YellowBox} from 'react-native';

componentDidMount() {
    YellowBox.ignoreWarnings(['Animated: `useNativeDriver`']);
}

When are they going to merge it into the release?

merge it please...

Hi all,

Even if the urge to do so is very high, please refrain from posting "me too" comments.

The PR is available and merged (see message above from 8 May by @AdrianoCahete ), so it will eventually be released according to the release schedule. Until then, there is only a very slight annoyance, namely a yellow spot in development mode (it will not appear in production), but other than that everything works as designed. Further more, for those who absolutely need to remove this yellow spot from their development experience, there are various fixes posted in this Fred.

Cheers and have fun, Remi.

@Remigius2011 it's been 3 months since this PR was merged and there has been no new releases for quite a while. If you are bothered by the "me too" comments maybe ask someone you know to release a new version that contains this fix.

It is still an issue in React native 0.63.0

@Remigius2011 what is the expected time for the new release?

I have forked the repo to fix this issue.

npm i @codler/native-base

Version 2.13.13 was just released and contains the fix for this issue.

@darrylyoung thanks!! Tested and working.

Tks God, tks team!!! You are amazing!

Most of the warnings are gone. But receiving an issue with Toast?

- node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:365:6 in result.start
- node_modules/native-base/dist/src/basic/ToastContainer.js:1:3656 in onPanResponderRelease

Also have the issue with Toast. Same as above

Recieving the following when closing manually toast:

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

react-native: 0.62.2
react-base: 2.13.13

Recieving the following when closing manually toast:

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

react-native: 0.62.2
react-base: 2.13.13

I'm getting the same warning.

react-native: 0.62.2
native-base: 2.13.13

Also have the issue with Toast. Same as above

"native-base": "^2.13.13",
"react-native": "0.62.2",

Solved:
When using Animated.spring or any other Animation specify useNativeDriver: true of useNativeDriver: false.
Example:

Animated.spring(this.position, {
    toValue: { x: 0, y: 0 },
    useNativeDriver: true,
}).start();

The Animated.spring is being called in onPanResponderRelease function.

  useEffect(() => {
    LogBox.ignoreLogs(['Animated: `useNativeDriver` was not specified.']);
    return () => {};
  }, []);

Just getting this warning sometimes when tapping buttons making them unusable (version 2.13.13), restarting the app solves the issue

I found a very strange bug in Toast. When the toast is shown, the yellow warning also comes up for "useNativeDriver" although I am already on 2.13.13. After the toast is closed, I cannot click the buttons shown or covered by the toast area. Now, I replaced the Toast with RN Alert .. ugly but working now.

I have the same problem and resolved temporary with https://github.com/GeekyAnts/NativeBase/pull/3200, however in the last version 2.13.14 it was already fixed!

image

Upgrade to "native-base": "^2.13.14", this solved the problem

Upgrade to "native-base": "^2.13.14", this solved the problem

Not for me it didn't...

Upgrade to "native-base": "^2.13.14", this solved the problem

Not for me as well...

Add to your project the following import

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
'Animated: useNativeDriver was not specified.',
]);

Hello Im also still facing issue with nativeDriver for the deck swiper.

Just added PR #3278 to fix this issue in the DeckSwiper, Fab, and ToastContainer components.

Is it already published on npm ? Im using 2.13.14 and im having that issue with FAB.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elnygren picture elnygren  路  3Comments

eggybot picture eggybot  路  3Comments

maphongba008 picture maphongba008  路  3Comments

sihemhssine picture sihemhssine  路  3Comments

natashache picture natashache  路  3Comments