Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button component generate warning #11094

Closed
adrienbataille opened this issue Nov 23, 2016 · 36 comments
Closed

Button component generate warning #11094

adrienbataille opened this issue Nov 23, 2016 · 36 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@adrienbataille
Copy link

adrienbataille commented Nov 23, 2016

Description

Using react native button on iOS create the following warning:

Animated: `useNativeDriver` is not supported because the native animated module is missing. Falling back to JS-based animation. To resolve this, add `RCTAnimation` module to this app, or remove `useNativeDriver`.

Reproduction

Step 1: Add a button in your view,
Step 2: Launch the iOS simulator
Step 3: Click on the button and see the warning.

capture d ecran 2016-11-23 a 11 23 53
capture d ecran 2016-11-23 a 11 23 57

If it can help, you can find the code here: https://github.com/adrienbataille/test-react-native

Note: I don't have this problem on Android

Solution

After a little investigation, I found the button component is based on TouchableOpacity for iOS and react-native release notes for 0.38.0 mention this commit: 1bb323e.
I don't if it the origin of the problem, but may be it can have an impact, because it works fine with react-native 0.37.0.

Additional Information

  • React Native version: 0.38.0
  • Platform: iOS
  • Operating System: MacOS - Sierra
@sibelius
Copy link

@adrienbataille u need to link RCTAnimation in ur xcode

follow this issue: #10638

@adrienbataille
Copy link
Author

@sibelius Thanks!

@heloa-net
Copy link

heloa-net commented Nov 27, 2016

I did what's on issue #10638, even replaced my NativeAnimation folder with the one in the repo but I still get that warning.
I'm using Visual Studio Code and the Xcode simulator.
I replaced files, I didn't understand how to change stuff inside Xcode.

@henrikra
Copy link

henrikra commented Nov 28, 2016

You need to link RCTAnimation like @sibelius said.

Here is how I did it:

  1. find RCTAnimation.xcodeproj The file can be found from node_modules/react-native/NativeAnimation OR node_modules/react-native/Libraries/NativeAnimation
  2. open xcode
  3. open project navigator (press cmd + 1 OR click folder icon from the left)
  4. drag & drop RCTAnimation.xcodeproj from the previous step to Libraries folder
  5. Expand RCTAnimation.xcodeproj in project navigator and find libRCTAnimation.a file inside of Products folder
  6. click on your project name on top of project navigator and go to Build Phrases tab
  7. drag and drop libRCTAnimation.a to Link Binary With Libraries
  8. Clean and run :)

I hope this works for you :)

@IlyasAbdighni
Copy link

Thank you @henrikra . I solved the problem following your instructions .

@michaelAndersonCampingWorld
Copy link
Contributor

@henrikra I think you have the right solution, except it doesn't work for me.

@TuomaXu
Copy link

TuomaXu commented Nov 29, 2016

thanks of all,
after add the libRCTAnimation.a file ,the warning dismiss.

@rgoldiez
Copy link

Followed @henrikra steps above and now getting the following error. Any idea what I've done wrong? I'm using RN 0.38.0.

image

@manishtpatel
Copy link

@henrikra, didn't work for me, looks like the solution but didn't work.

@adrienbataille
Copy link
Author

@rgoldiez @manishtpatel I've started a blank new project and upgraded it to RN 0.39.0-rc.0 and it works. Native Animation will be part of the next version of RN (#10783).
Hope it will fix your problem.

@rgoldiez
Copy link

rgoldiez commented Nov 29, 2016

@adrienbataille - I'll give 0.39.0-rc.0 a try.

In my case, I can get a clean/new project working with 0.38.0 by manually linking RCTAnimation.xcodeproj and the fall back to JS warning goes away.

The issue I'm running into is with an existing app that I've been building/releasing since 0.14.0 (but have been upgrading along the way). The app has numerous open source repos for things like icons, routing/navigating, etc. On 0.38.0, I now get the fall back to JS warning, which makes sense. However, when I add and link RCTAnimation.xcodeproj, the app will load but it will (seemingly) randomly throw that error when using the app.

EDIT: At least in some (maybe all) cases, it seems to be throwing that error when touching a TouchableOpacity component. If I switch to TouchableHighlight it doesn't crash and responds accordingly (although I don't care for TouchableHighlight in my case).

EDIT 2: This seems to be what's causing my issues: 8bb707b. If I remove the useNativeDriver from TouchableOpacity, the crash I'm experiencing goes away. And I'm not getting the warning that it's falling back to JS for animations.

@heloa-net
Copy link

@rgoldiez I'm new to RN, can you please describe how you remove useNativeDriver from TouchableOpacity?

@rgoldiez
Copy link

rgoldiez commented Nov 29, 2016

@she-dev - What I did was go to node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.js and remove the useNativeDriver...

(see line 90 in RN 0.38.0)...

  setOpacityTo: function(value: number) {
    Animated.timing(
      this.state.anim,
      {toValue: value, duration: 150, useNativeDriver: true}
    ).start();
  },

was edited by me to become

    Animated.timing(
      this.state.anim,
      {toValue: value, duration: 150}
    ).start();
  },

@janicduplessis
Copy link
Contributor

Not sure what causes that red screen, the steps to link the module are good. What I suggest is if you are having issues with this and can't fix it by linking the NativeAnimation module you can NOT link the module and add this somewhere to ignore the warning until we figure out the issue.

console.ignoredYellowBox = [
  'Animated: `useNativeDriver` is not',
];

@heloa-net
Copy link

@rgoldiez No more warnings around here, thank you c:

berkaybeyaz1 added a commit to berkaybeyaz1/react-native that referenced this issue Dec 2, 2016
Fixed touchable opacity animation driver ref: facebook#11094 (comment)
@knyga
Copy link

knyga commented Dec 3, 2016

The correct path for RCTAnimation is ./node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj

@milkersarac
Copy link

milkersarac commented Dec 3, 2016

@henrikra when I clean the code w.r.t 8th step of your solution above, clean failed and I get this error Unable to run command 'Libtool libRCTAnimation.a' - this target might include its own product.

@henrikra
Copy link

henrikra commented Dec 4, 2016

Now when RN 0.39 has been released it includes RTCAnimation by default so that will fix this problem by itself :)

@netfish88
Copy link

@henrikra I updated my code to RN 0.39. and there is a same warning messages that 'useAnimatedDriver' is not supported. is it sure that the issue has been solved ?

Anyone who solved this issue with 0.39 ?

@janicduplessis
Copy link
Contributor

See #11094 (comment)

@izhwei
Copy link

izhwei commented Dec 5, 2016

@henrikra I updated to RN 0.39, the same problem is still there.

@livtanong
Copy link

@izhwei @netfish88 Make sure you're using ProjectName, and not ProjectNameTest in the targets dropdown. Turns out, I was on ProjectNameTest at some point (because I had to set signing)

@almirfilho
Copy link

Updated to RN 0.39 and the warning message got back.
RCTAnimation.xcodeproj is already properly linked, and libRCTAnimation.a is included in Link Binary section in Build Phases.

Any ideas? Thanks!

@manishtpatel
Copy link

@almirfilho, with 0.39 NativeAnimation folder is moved into libraries, make sure that it is correctly linked to new folder.

@almirfilho
Copy link

@manishtpatel yup, it's like that since 0.38 actually, and it was fine in 0.38 =/

@jcollum
Copy link

jcollum commented Dec 10, 2016

Upgraded to @0.39.1, this warning is still coming up. I think it's an issue in react-native-router-flux though.

@rgoldiez
Copy link

@jcollum - I use react-native-router-flux and am not getting the warning. Note that TouchableOpacity uses animations and has been using the nativeDriver for a couple of releases. So if you don't have RCTAnimation linked properly in your project you will get the warning from TouchableOpacity, and likely other components using useNativeDriver.

I too thought I had RCTAnimation linked properly but I still got the warning... it wasn't until I really had it linked properly that the warning went away.

@jcollum
Copy link

jcollum commented Dec 10, 2016

I too thought I had RCTAnimation linked properly but I still got the warning... it wasn't until I really had it linked properly that the warning went away.

In that case can you point me to the "right" way to do it? I assume there's one in this thread. You can get a direct link in the "x minutes ago" hyperlink.

@rgoldiez
Copy link

@jcollum - Did you follow these instructions: #11094 (comment)

@jcollum
Copy link

jcollum commented Dec 11, 2016

That did it! Thanks

@rgoldiez
Copy link

@jcollum - glad to hear. I think the inclusion of RCTAnimation in 0.39.x is for new projects created with react-native init. Existing project need to link the library like you've done.

@Rebsos
Copy link

Rebsos commented Dec 11, 2016

I did not follow the instructions above, just upgraded the templates. Fixed the useNativeDriver warning for me

$ react-native upgrade

https://facebook.github.io/react-native/docs/upgrading.html

@henrikra
Copy link

Yes that is what I said here before #11094 (comment) :)

@uriklar
Copy link

uriklar commented Dec 28, 2016

Here's what solved it for me:
I upgraded from 0.37 to 0.39.2 using react-native upgrade but was still getting the error.
I tried following #11094 (comment), but on step 5 I couldn't find libRCTAnimation.a but rather libRCTAnimation-tvOS.a

So I went to Build Phases -> Link Binary With Libraries, clicked on the + sign in the bottom, and there under Workspace I found libRCTAnimation.a.

Hope this helps someone...

@siemiatj
Copy link

@uriklar the fie is actually located in RCTAnimation.xcodeproj/Products/.

@IvRRimum
Copy link

IvRRimum commented May 4, 2017

@henrikra Words can't describe how grateful i am for this answer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests