Feature request: Update docs for usage into 0.77
Add the following to your project's AppDelegate.m:
AppDelegate has become a swift file into React Native 0.77
Do you have any update? @Pnlvfx
Do you have any update? @Pnlvfx
I used react-native-orientation-director
there is 1 issue with the instructions on how to do it.
I resolved this issue by:
Creating the file YourProjectName-Bridging-Header.h and adding the following line:
#import "Orientation.h"
In AppDelegate.swift, adding:
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return Orientation.getOrientation()
}
override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { return Orientation.getOrientation() }
I have also added the following, but seeing above error
#import 'Orientation.h'
Never mind, fixed the issue, added the path to the Bridging-Header.h file to the following
Build Settings > Swift Compiler - General > Objective-C Bridging Header > Double click to open the editor > Dragged the header file into it
XCode will Pre-Pan and then good to go.
I'd consider this library retired. It's still can be used for old react native projects based on bridge. If your project uses react native new architecture - consider using https://github.com/whitestranger7/react-native-orientation-turbo
Please note that this lib is working only with new architecture enabled. It's does not require any ios or android configuration. It's using latest android and ios sdk.
You're welcome to use discussions on the page for ideas of how lib can be improved
Never mind, fixed the issue, added the path to the Bridging-Header.h file to the following
Build Settings > Swift Compiler - General > Objective-C Bridging Header > Double click to open the editor > Dragged the header file into it
XCode will Pre-Pan and then good to go.
This can also be fixed by importing below line in AppDelegate.swift file
import react_native_orientation_locker
adding public at start of method fixed things for me
public override func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return Orientation.getOrientation()
}
I also added #import "Orientation.h" in Bridging header as suggested
Add
#import "Orientation.h"
to your ProjectName-Bridging-Header.h file.
Then, add the following method inside your AppDelegate into AppDelegate: UIResponder, UIApplicationDelegate class:
func application(_ application: UIApplication,
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return Orientation.getOrientation()
}