-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(macos): add react-native-macos demo app
- Loading branch information
Showing
26 changed files
with
5,023 additions
and
3,070 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: 8 additions & 0 deletions
8
examples/demo/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
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 @@ | ||
export NODE_BINARY=$(command -v node) |
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,11 @@ | ||
#import <Cocoa/Cocoa.h> | ||
#import <RCTAppDelegate.h> | ||
#import <React/RCTLinkingManager.h> | ||
#import "RNAppAuthAuthorizationFlowManager.h" | ||
|
||
@interface AppDelegate : RCTAppDelegate <RNAppAuthAuthorizationFlowManager> | ||
|
||
@property(nonatomic, weak) id<RNAppAuthAuthorizationFlowManagerDelegate> | ||
authorizationFlowManagerDelegate; | ||
|
||
@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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#import "AppDelegate.h" | ||
|
||
#import <React/RCTBundleURLProvider.h> | ||
#import <React/RCTLinkingManager.h> | ||
|
||
@implementation AppDelegate | ||
|
||
- (void)applicationDidFinishLaunching:(NSNotification *)notification | ||
{ | ||
self.moduleName = @"Example"; | ||
// 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]; | ||
} | ||
|
||
- (void)applicationWillFinishLaunching:(NSNotification *)notification { | ||
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self | ||
andSelector:@selector(getURL:withReplyEvent:) | ||
forEventClass:kInternetEventClass | ||
andEventID:kAEGetURL]; | ||
} | ||
|
||
- (void)getURL:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)reply | ||
{ | ||
NSString* urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; | ||
NSURL *url = [NSURL URLWithString:urlString]; | ||
|
||
if ([self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url]) { | ||
return; | ||
} | ||
|
||
[RCTLinkingManager getUrlEventHandler:event withReplyEvent:reply]; | ||
} | ||
|
||
- (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 |
58 changes: 58 additions & 0 deletions
58
examples/demo/macos/Example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json
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,58 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "512x512" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "512x512" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/demo/macos/Example-macOS/Assets.xcassets/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.