forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update macOS init template to enable New Architecture (#1854)
* Remove Window & ContentViewController * AppDelegate uses RCTAppDelegate for initialization * RCTAppDelegate renders the window/view controller correctly * MacOS uses same AppDelegate as RN Core HelloWorld template * Update Podfile * Remove extra HelloWorld-iOS target * Remove iOS project from macOS generator * Fix Podfile to work w/ M1 mac & disable flipper * Remove last iOS file * Need to implement concurrentRootEnabled check * Hermes is off by default & Fabric is only enabled w/ New Arch --------- Co-authored-by: Shawn Dempsey <[email protected]>
- Loading branch information
Showing
18 changed files
with
75 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
local-cli/generator-macos/templates/macos/HelloWorld-iOS/AppDelegate.h
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
local-cli/generator-macos/templates/macos/HelloWorld-iOS/AppDelegate.m
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
local-cli/generator-macos/templates/macos/HelloWorld-iOS/Base.lproj/LaunchScreen.xib
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...tor-macos/templates/macos/HelloWorld-iOS/Images.xcassets/AppIcon.appiconset/Contents.json
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
local-cli/generator-macos/templates/macos/HelloWorld-iOS/Images.xcassets/Contents.json
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
local-cli/generator-macos/templates/macos/HelloWorld-iOS/Info.plist
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
local-cli/generator-macos/templates/macos/HelloWorld-iOS/main.m
This file was deleted.
Oops, something went wrong.
7 changes: 2 additions & 5 deletions
7
local-cli/generator-macos/templates/macos/HelloWorld-macOS/AppDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
#import <RCTAppDelegate.h> | ||
#import <Cocoa/Cocoa.h> | ||
|
||
@class RCTBridge; | ||
|
||
@interface AppDelegate : NSObject <NSApplicationDelegate> | ||
|
||
@property (nonatomic, readonly) RCTBridge *bridge; | ||
@interface AppDelegate : RCTAppDelegate | ||
|
||
@end |
32 changes: 0 additions & 32 deletions
32
local-cli/generator-macos/templates/macos/HelloWorld-macOS/AppDelegate.m
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
local-cli/generator-macos/templates/macos/HelloWorld-macOS/AppDelegate.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#import "AppDelegate.h" | ||
|
||
#import <React/RCTBundleURLProvider.h> | ||
|
||
@implementation AppDelegate | ||
|
||
- (void)applicationDidFinishLaunching:(NSNotification *)notification | ||
{ | ||
self.moduleName = @"HelloWorld"; | ||
// You can add your custom initial props in the dictionary below. | ||
// They will be passed down to the ViewController used by React Native. | ||
self.initialProps = @{}; | ||
|
||
return [super applicationDidFinishLaunching:notification]; | ||
} | ||
|
||
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge | ||
{ | ||
#if DEBUG | ||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; | ||
#else | ||
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; | ||
#endif | ||
} | ||
|
||
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. | ||
/// | ||
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html | ||
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). | ||
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`. | ||
- (BOOL)concurrentRootEnabled | ||
{ | ||
#ifdef RN_FABRIC_ENABLED | ||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
local-cli/generator-macos/templates/macos/HelloWorld-macOS/ViewController.h
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.