need to change header search path to '$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/'
After quite a lot of playing around, got this working on iOS (with Swift) by:
pod 'react-native-orientation', :path => '../node_modules/react-native-orientation' to PodFile (Do not perform react-native link)import react_native_orientation to top of AppDelegatefunc application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return react_native_orientation.Orientation.getOrientation()
} under main AppDelegate methodimport Orientation from 'react-native-orientation' to wherever needed in RNThe solution from @Mactub07 worked great for me on RN v0.53.3
For RN v0.55.3, react-native link wasn't working. Followed the manual steps and @mactub07 header search path and worked for me.
I had the same problem and just had to run pod install after react-native link
@Mactub07 Thanks a million!
Trying not to be another "This worked for me" but as I have scoured the internet and tried many things - this is what caused me to FINALLY get a successful build, but STILL having to do manual linking.
So this does get the build, but also I'm automating some things for app initialization, so I think the solution will need to be to fix the automatic linking.
I'm wondering how this information could be used to correct the root issue. Guess it's time to check into how to react-native link works...
Update: For what it's worth, I used the diff command to produce a patch file and apply this in postinstall hook in package.json
The doc says:
$(SRCROOT)/node_modules/react-native-orientation/iOS/RCTOrientation/
But I think for most of us our SRCROOT is the ios folder inside our parent app root. And the note_modeuls are in the root, not in SRCROOT. So this fixes the build for me:
$(SRCROOT)/../node_modules/react-native-orientation/iOS/RCTOrientation/
Just moves the search up a folder before descending into node_modules.
This repo dead , use the fork https://github.com/wonday/react-native-orientation-locker
Most helpful comment
The doc says:
But I think for most of us our SRCROOT is the ios folder inside our parent app root. And the note_modeuls are in the root, not in SRCROOT. So this fixes the build for me:
Just moves the search up a folder before descending into node_modules.