Skip to content

Commit 70bca09

Browse files
committed
Setup react-native-macos
1 parent 9881a98 commit 70bca09

File tree

14 files changed

+1636
-3
lines changed

14 files changed

+1636
-3
lines changed

macos-example/macos/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# CocoaPods
2+
Pods/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#import <RCTAppDelegate.h>
2+
#import <Cocoa/Cocoa.h>
3+
4+
@interface AppDelegate : RCTAppDelegate
5+
6+
@end
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#import "AppDelegate.h"
2+
3+
#import <React/RCTBundleURLProvider.h>
4+
5+
@implementation AppDelegate
6+
7+
- (void)applicationDidFinishLaunching:(NSNotification *)notification
8+
{
9+
self.moduleName = @"LiveMarkdownExample";
10+
// You can add your custom initial props in the dictionary below.
11+
// They will be passed down to the ViewController used by React Native.
12+
self.initialProps = @{};
13+
14+
return [super applicationDidFinishLaunching:notification];
15+
}
16+
17+
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18+
{
19+
return [self bundleURL];
20+
}
21+
22+
- (NSURL *)bundleURL
23+
{
24+
#if DEBUG
25+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
26+
#else
27+
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
28+
#endif
29+
}
30+
31+
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
32+
///
33+
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
34+
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
35+
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
36+
- (BOOL)concurrentRootEnabled
37+
{
38+
#ifdef RN_FABRIC_ENABLED
39+
return true;
40+
#else
41+
return false;
42+
#endif
43+
}
44+
45+
@end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "mac",
5+
"scale" : "1x",
6+
"size" : "16x16"
7+
},
8+
{
9+
"idiom" : "mac",
10+
"scale" : "2x",
11+
"size" : "16x16"
12+
},
13+
{
14+
"idiom" : "mac",
15+
"scale" : "1x",
16+
"size" : "32x32"
17+
},
18+
{
19+
"idiom" : "mac",
20+
"scale" : "2x",
21+
"size" : "32x32"
22+
},
23+
{
24+
"idiom" : "mac",
25+
"scale" : "1x",
26+
"size" : "128x128"
27+
},
28+
{
29+
"idiom" : "mac",
30+
"scale" : "2x",
31+
"size" : "128x128"
32+
},
33+
{
34+
"idiom" : "mac",
35+
"scale" : "1x",
36+
"size" : "256x256"
37+
},
38+
{
39+
"idiom" : "mac",
40+
"scale" : "2x",
41+
"size" : "256x256"
42+
},
43+
{
44+
"idiom" : "mac",
45+
"scale" : "1x",
46+
"size" : "512x512"
47+
},
48+
{
49+
"idiom" : "mac",
50+
"scale" : "2x",
51+
"size" : "512x512"
52+
}
53+
],
54+
"info" : {
55+
"author" : "xcode",
56+
"version" : 1
57+
}
58+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

macos-example/macos/LiveMarkdownExample-macOS/Base.lproj/Main.storyboard

Lines changed: 684 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIconFile</key>
10+
<string></string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>$(PRODUCT_NAME)</string>
17+
<key>CFBundlePackageType</key>
18+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSMinimumSystemVersion</key>
24+
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
25+
<key>NSAppTransportSecurity</key>
26+
<dict>
27+
<key>NSAllowsArbitraryLoads</key>
28+
<true/>
29+
<key>NSExceptionDomains</key>
30+
<dict>
31+
<key>localhost</key>
32+
<dict>
33+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
34+
<true/>
35+
</dict>
36+
</dict>
37+
</dict>
38+
<key>NSMainStoryboardFile</key>
39+
<string>Main</string>
40+
<key>NSPrincipalClass</key>
41+
<string>NSApplication</string>
42+
<key>NSSupportsAutomaticTermination</key>
43+
<true/>
44+
<key>NSSupportsSuddenTermination</key>
45+
<true/>
46+
</dict>
47+
</plist>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-only</key>
8+
<true/>
9+
<key>com.apple.security.network.client</key>
10+
<true/>
11+
</dict>
12+
</plist>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
int main(int argc, const char *argv[]) {
4+
return NSApplicationMain(argc, argv);
5+
}

0 commit comments

Comments
 (0)