react-native: [iOS][cocoapods] 'RCTAnimation/RCTValueAnimatedNode.h' file not found

Description

'RCTAnimation/RCTValueAnimatedNode.h' file not found. in current master https://github.com/facebook/react-native/tree/c233191485ef733aa7a8d4ea5c758b9e6a06964c

  1. related to 28 of march changes. @janicduplessis might help
  2. podspec test are passed. @alloy do you have ideas how tests could be improved? Maybe we need to run xcbuild to test?

Reproduction Steps and Sample Code

https://github.com/skv-headless/AwesomeProject - demo project based on this page https://facebook.github.io/react-native/docs/integration-with-existing-apps.html#cocoapods

Solution

It works if change #import <RCTAnimation/RCTValueAnimatedNode.h> to #import "RCTValueAnimatedNode.h"

Additional Information

  • Platform: [iOS]
  • Development Operating System: [MacOS]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 77
  • Comments: 69 (18 by maintainers)

Commits related to this issue

Most upvoted comments

For those who still searching for a quick solution. I was able to launch iOS app with RCTAnimation subspec by including following string to my package.json:

"scripts": {
  "postinstall": "sed -i '' 's\/#import <RCTAnimation\\/RCTValueAnimatedNode.h>\/#import \"RCTValueAnimatedNode.h\"\/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h",
  ...rest scripts
}

React: 16.0.0-alpha.12 ReactNative: 0.45.0-rc.0

Didn’t work for me with above PR which already accepted in 0.45.0-rc.0

I still get this error even in 0.44.0 where the code in RCTNativeAnimatedModule.h is updated from It works if change #import <RCTAnimation/RCTValueAnimatedNode.h> to #import “RCTValueAnimatedNode.h”

as mentioned by the original Bug logger. So the solution did not work for me… Any other recommended solutions?

it seem that this change in RCTNativeAnimatedNodesManager.h does the trick:

before:

screen shot 2017-07-03 at 11 54 59

after:

screen shot 2017-07-03 at 11 55 52

Does this make sense? It’s working for me on 0.45.1, without running the patch script

@jeanregisser This is still an issue with RN 0.56.0-rc.4

pod 'React', :path => REACT_NATIVE_PATH, :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTAnimation',
    'RCTActionSheet',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => "#{REACT_NATIVE_PATH}/ReactCommon/yoga"

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => "#{REACT_NATIVE_PATH}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{REACT_NATIVE_PATH}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{REACT_NATIVE_PATH}/third-party-podspecs/Folly.podspec"

Same here, please fix this

Still get this error in RN 0.45.1

Hi everyone, I’ve centralized a lot of the CocoaPods issues into a single project which will apply all of the post-install fixes for you, which should simplify integrating React Native with CocoaPods

https://github.com/orta/cocoapods-fix-react-native

There is a common practice that I noticed in quite a few projects that deal with this issue. Here is how it would look like:

#if __has_include(<React/RCTValueAnimatedNode.h>)
#import <React/RCTValueAnimatedNode.h>
#else
#import "RCTValueAnimatedNode.h"
#endif

You can adjust this to your needs, e.g. if you want to cling to #import <RCTAnimation/RCTValueAnimatedNode.h> for whatever reason, then just replace the first and second line appropriately.

This “trick” ensures best compatibility with use_frameworks! and traditional methods.

Still get error with fishhook.h and RCTValueAnimatedNode.h, so I have to change it manually.

I got this issue upgrading to react native 0.47.1, any way to resolve it without hacks?

For those who are still experiencing the issue. Try the following:

  1. rm -rf ~/Library/Developer/Xcode/DerivedData/
  2. Inside the ios folder, do rm -rf "`pwd`/Pods/"
  3. rm -rf "${HOME}/Library/Caches/CocoaPods"
  4. Run pod install
  5. Open xcworkspace
  6. Product > Clean
  7. Product > Clean Folder (Must hold the option key)
  8. Build

Good luck!

I think that we should push this up again. Otherwise we will have always kind of hack on our projects to make them work with Cocoapods.

Thanks!

Please use this script in package.json script section.

"postinstall": "sed -i '' 's\/#import <RCTAnimation\\/RCTValueAnimatedNode.h>\/#import \"RCTValueAnimatedNode.h\"\/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h",

It will change #import <RCTAnimation/RCTValueAnimatedNode.h> -> #import "RCTValueAnimatedNode.h

@iggyfisk Is it possible to have a 0.44 fix with this commit ?

this is a blocker for us too… why is the issue closed? (13217)

Did anyone try setting private_header_files? We do use that in a few place in the pod config file. I’m pretty sure it’s just a config issue, we should not have to change the import. Sorry about this taking so long to get resolved but we want to make sure we have the right fix.

I can verify that RN 0.56.0-rc.2 does not resolve the issue.

I am using COCOAPODS: 1.5.0, avoided issues by using @orta 's https://github.com/orta/cocoapods-fix-react-native

I use this script and it works but it’s not a solution its a patch… Also some of our teammates are working on Windows macines so this script will not work (I know there’s an equivalent for Windows)

The point is that this should be solved the right way without using any hacking…

try to add this to package.json and run it in your post-install:

"scripts": {
  "fix:ios": "sed -i '' 's/#import <RCTAnimation\\/RCTValueAnimatedNode.h>/#import \"RCTValueAnimatedNode.h\"/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h"
}

Here is the project template which demonstrates this: https://www.npmjs.com/package/react-native-vanilla

I’ve asked on the Cocoapods mailing list but I think it is correct to change the import to #import <React/RCTValueAnimatedNode.h>.

I think this is because RCTAnimation is only a subspec and will be built within the React.framework when installed with Cocoapods. If RCTAnimation would be a full-fledged pod then it would be possible to use #import <RCTAnimation/RCTValueAnimatedNode.h>.

Does anyone tried to investigate real cause of this problem and find proper solution? All approaches mentioned here and in attached PRs do not look legit and almost certainly will not be merged.

@iggyfisk This PR (7b7d6bb) didn’t solve this issue (with RN 0.45.0-rc.0) but this one which is closed yes (13217) !!!

Does someone work again on this issue ?

Yup, it has not been fixed. This issue has been on for more than a year.

What build is the React Native team planning to put out a fix for this? Now that Swift has been around for a couple years and use_frameworks! has become commonplace this seems like it really needs a fix. Maybe a trial branch so that folks can report errors and issues before release?

Yeah I’ll do that, and then we’ll see how much time it takes to complete on CI.