Open leadhkr opened 6 years ago
This error has been fixed for me by updated the header search path. See Issue #305
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 RNFor me it didn't do it just updating header search paths. I had to manually add the library and .xcodeproj as well. At least now it works perfectly 👍
This repo dead , use the fork https://github.com/wonday/react-native-orientation-locker
I've been following the instructions on setting up react-native-orientation, along with the guidance in issues others have raised but I still cannot get this to work. Steps I've taken:
yarn add react-native-orientation
react-native link react-native-orientation
I followed the steps to Config both IOS and Android. I'm currently testing in IOS so will show my config files:
AppDelegate.m
Don't think
react-native link
took. I opened my project in Xcode and had to manually add RCTOrientation.xcodeproj to the Libraries folder. Then I added libRCTOrientation.a to Build Phases > Link Binary With Libraries. Finally, I added $(SRCROOT)/node_modules/react-native-orientation/iOS/RCTOrientation to Build Settings > Header Search Paths.After all this, I rebuilt my project in both Xcode and React-Native. When I build in XCODE, I get the following error:
Orientation.h file not found
in myAppDelegate.m
file. When I build with react-native, I get the following error: undefined is not an object (evaluating Orientation.lock`)Thanks in advance for the help!