File tree Expand file tree Collapse file tree 5 files changed +35
-7
lines changed
Expand file tree Collapse file tree 5 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 643643 ENABLE_BITCODE = NO;
644644 INFOPLIST_FILE = "SampleApp/Info-CarPlay.plist";
645645 IPHONEOS_DEPLOYMENT_TARGET = 16.6;
646+ GCC_PREPROCESSOR_DEFINITIONS = (
647+ "$(inherited)",
648+ "CARPLAY=1",
649+ );
646650 LD_RUNPATH_SEARCH_PATHS = (
647651 "$(inherited)",
648652 "@executable_path/Frameworks",
672676 CURRENT_PROJECT_VERSION = 1;
673677 INFOPLIST_FILE = SampleApp/Info.plist;
674678 IPHONEOS_DEPLOYMENT_TARGET = 16.6;
679+ GCC_PREPROCESSOR_DEFINITIONS = (
680+ "$(inherited)",
681+ "CARPLAY=1",
682+ );
675683 LD_RUNPATH_SEARCH_PATHS = (
676684 "$(inherited)",
677685 "@executable_path/Frameworks",
Original file line number Diff line number Diff line change 1717#import < UIKit/UIKit.h>
1818
1919@interface AppDelegateCarPlay : RCTAppDelegate
20- @property (nonatomic , strong ) UIWindow *window;
21- @property (nonatomic , strong ) RCTBridge *bridge;
22- @property (nonatomic , strong ) RCTRootView *rootView;
2320@end
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ - (BOOL)application:(UIApplication *)application
3030 self.moduleName = @" SampleApp" ;
3131 self.dependencyProvider = [RCTAppDependencyProvider new ];
3232
33+ // You can add your custom initial props in the dictionary below.
34+ // They will be passed down to the ViewController used by React Native.
35+ self.initialProps = @{};
36+
3337 // Note: Ensure that you have copied the Keys.plist.sample to Keys.plist
3438 // and have added the correct API_KEY value to the file.
3539 //
@@ -39,6 +43,11 @@ - (BOOL)application:(UIApplication *)application
3943 NSString *api_key = [keysDictionary objectForKey: @" API_KEY" ];
4044
4145 [GMSServices provideAPIKey: api_key];
46+
47+ // Set automaticallyLoadReactNativeWindow to NO to prevent RCTAppDelegate from creating the
48+ // window. It will be created in PhoneSceneDelegate for the main (phone) screen.
49+ self.automaticallyLoadReactNativeWindow = NO ;
50+
4251 return [super application: application didFinishLaunchingWithOptions: launchOptions];
4352}
4453
@@ -65,6 +74,14 @@ - (void)application:(UIApplication *)application
6574 didDiscardSceneSessions : (NSSet <UISceneSession *> *)sceneSessions {
6675}
6776
77+ - (BOOL )fabricEnabled {
78+ return NO ;
79+ }
80+
81+ - (BOOL )bridgelessEnabled {
82+ return NO ;
83+ }
84+
6885- (NSURL *)sourceURLForBridge : (RCTBridge *)bridge {
6986 return [self bundleURL ];
7087}
Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616#import " PhoneSceneDelegate.h"
17+ #import < RCTAppDelegate.h>
1718#import < React/RCTRootView.h>
1819#import < UIKit/UIKit.h>
19- #import " AppDelegateCarPlay.h"
2020
2121@implementation PhoneSceneDelegate
2222
2323- (void )scene : (UIScene *)scene
2424 willConnectToSession : (UISceneSession *)session
2525 options : (UISceneConnectionOptions *)connectionOptions {
26- AppDelegateCarPlay *appDelegate =
27- (AppDelegateCarPlay *)[UIApplication sharedApplication ].delegate ;
26+ RCTAppDelegate *appDelegate = (RCTAppDelegate *)[UIApplication sharedApplication ].delegate ;
2827 if (!appDelegate) {
2928 return ;
3029 }
@@ -34,12 +33,18 @@ - (void)scene:(UIScene *)scene
3433 return ;
3534 }
3635
36+ UIView *rootView = [appDelegate.rootViewFactory viewWithModuleName: appDelegate.moduleName
37+ initialProperties: appDelegate.initialProps
38+ launchOptions: nil ];
39+ rootView.backgroundColor = [UIColor whiteColor ];
40+
3741 UIViewController *rootViewController = [[UIViewController alloc ] init ];
38- rootViewController.view = appDelegate. rootView ;
42+ rootViewController.view = rootView;
3943
4044 UIWindow *window = [[UIWindow alloc ] initWithWindowScene: windowScene];
4145 window.rootViewController = rootViewController;
4246 self.window = window;
47+
4348 [appDelegate setWindow: window];
4449 [window makeKeyAndVisible ];
4550}
Original file line number Diff line number Diff line change 77 "android" : " react-native run-android" ,
88 "android-release" : " react-native run-android --mode release" ,
99 "ios" : " react-native run-ios" ,
10+ "ios:carplay" : " react-native run-ios --scheme SampleAppCarPlay" ,
1011 "ios-release" : " react-native run-ios --mode Release" ,
1112 "lint" : " eslint ." ,
1213 "test" : " jest" ,
You can’t perform that action at this time.
0 commit comments