forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce new method to RCTAppDelegate
- Loading branch information
1 parent
30a914f
commit fab7056
Showing
17 changed files
with
173 additions
and
536 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
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
12 changes: 0 additions & 12 deletions
12
packages/react-native/Libraries/AppDelegate/RCTReactController.h
This file was deleted.
Oops, something went wrong.
120 changes: 0 additions & 120 deletions
120
packages/react-native/Libraries/AppDelegate/RCTReactController.mm
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
packages/react-native/Libraries/AppDelegate/RCTReactViewController.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import <React/RCTBridgeDelegate.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface RCTReactViewController : UIViewController | ||
|
||
@property (nonatomic, strong) NSString *_Nonnull moduleName; | ||
@property (nonatomic, strong) NSDictionary *_Nullable initialProps; | ||
|
||
- (instancetype _Nonnull)initWithModuleName:(NSString *_Nonnull)moduleName | ||
initProps:(NSDictionary *_Nullable)initProps; | ||
|
||
@end |
27 changes: 27 additions & 0 deletions
27
packages/react-native/Libraries/AppDelegate/RCTReactViewController.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,27 @@ | ||
#import "RCTReactViewController.h" | ||
#import <React/RCTUtils.h> | ||
|
||
#import "RCTAppDelegate.h" | ||
|
||
@implementation RCTReactViewController | ||
|
||
- (instancetype)initWithModuleName:(NSString *)moduleName initProps:(NSDictionary *)initProps { | ||
if (self = [super init]) { | ||
_moduleName = moduleName; | ||
_initialProps = initProps; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)loadView { | ||
id<UIApplicationDelegate> appDelegate = RCTSharedApplication().delegate; | ||
if ([appDelegate respondsToSelector:@selector(viewWithModuleName:initialProperties:launchOptions:)]) { | ||
RCTAppDelegate *delegate = (RCTAppDelegate *)appDelegate; | ||
self.view = [delegate viewWithModuleName:_moduleName initialProperties:_initialProps launchOptions:@{}]; | ||
} else { | ||
[NSException raise:@"UIApplicationDelegate:viewWithModuleName:initialProperties:launchOptions: not implemented" | ||
format:@"Make sure you subclass RCTAppDelegate"]; | ||
} | ||
} | ||
|
||
@end |
48 changes: 0 additions & 48 deletions
48
packages/react-native/Libraries/AppDelegate/RCTSwiftUIAppDelegate.h
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.