Skip to content

Commit 7e514d7

Browse files
authored
feat: add macos back to Example app (#2119)
PR restoring macos CI job and restoring usage of UIGraphicsBeginImageContextWithOptions on macos since there is no implementation for UIGraphicsImageRendererFormat there yet.
1 parent fb28d78 commit 7e514d7

File tree

25 files changed

+3485
-50
lines changed

25 files changed

+3485
-50
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Example/examples/
33
Example/android/
44
Example/ios/
55
Example/windows/
6+
Example/macos/
67
screenshots/
78
android/
89
apple/
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test macOS build
2+
on:
3+
pull_request:
4+
paths:
5+
- .github/workflows/macos-build-test.yml
6+
- RNSVG.podspec
7+
- apple/**
8+
- Example/package.json
9+
- Example/macos/**
10+
- src/fabric/**
11+
- package.json
12+
push:
13+
branches:
14+
- main
15+
16+
jobs:
17+
build:
18+
runs-on: macos-12
19+
strategy:
20+
matrix:
21+
working-directory: [Example]
22+
fail-fast: false
23+
concurrency:
24+
group: macos-${{ matrix.working-directory }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
steps:
27+
- name: Check out Git repository
28+
uses: actions/checkout@v3
29+
30+
- name: Restore react-native-svg node_modules from cache
31+
uses: actions/cache@v3
32+
with:
33+
path: node_modules
34+
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
35+
restore-keys: ${{ runner.os }}-node-modules-svg-
36+
37+
- name: Install react-native-svg node_modules
38+
run: yarn install --frozen-lockfile
39+
40+
- name: Restore app node_modules from cache
41+
uses: actions/cache@v3
42+
with:
43+
path: ${{ matrix.working-directory }}/node_modules
44+
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
45+
restore-keys: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-
46+
47+
- name: Install app node_modules
48+
working-directory: ${{ matrix.working-directory }}
49+
run: yarn install --frozen-lockfile
50+
51+
- name: Restore Pods from cache
52+
uses: actions/cache@v3
53+
with:
54+
path: |
55+
${{ matrix.working-directory }}/macos/Pods
56+
~/Library/Caches/CocoaPods
57+
~/.cocoapods
58+
key: ${{ runner.os }}-pods-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/macos/Podfile.lock', matrix.working-directory)) }}
59+
60+
- name: Install Pods
61+
working-directory: ${{ matrix.working-directory }}/macos
62+
run: pod install
63+
64+
- name: Restore build artifacts from cache
65+
uses: actions/cache@v3
66+
with:
67+
path: ~/Library/Developer/Xcode/DerivedData
68+
key: ${{ runner.os }}-macos-derived-data-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/macos/Podfile.lock', matrix.working-directory)) }}
69+
70+
- name: Build app
71+
working-directory: ${{ matrix.working-directory }}
72+
run: npx react-native run-macos

Example/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ PODS:
484484
- React-jsi (= 0.72.1)
485485
- React-logger (= 0.72.1)
486486
- React-perflogger (= 0.72.1)
487-
- RNReanimated (3.4.2):
487+
- RNReanimated (3.5.0-nightly-20230822-8ef27c219):
488488
- DoubleConversion
489489
- FBLazyVector
490490
- glog
@@ -513,7 +513,7 @@ PODS:
513513
- React-RCTText
514514
- ReactCommon/turbomodule/core
515515
- Yoga
516-
- RNSVG (13.11.0):
516+
- RNSVG (13.12.0):
517517
- React-Core
518518
- SocketRocket (0.6.1)
519519
- Yoga (1.14.0)
@@ -740,8 +740,8 @@ SPEC CHECKSUMS:
740740
React-runtimescheduler: 67707a955b9ecc628cc38bdc721fbc498910f0fd
741741
React-utils: 0a70ea97d4e2749f336b450c082905be1d389435
742742
ReactCommon: e593d19c9e271a6da4d0bd7f13b28cfeae5d164b
743-
RNReanimated: 726395a2fa2f04cea340274ba57a4e659bc0d9c1
744-
RNSVG: 791907c36f290562750132f8d274730c3aa529f6
743+
RNReanimated: c8c9d8f36908aa7a2997c0b87d0205a336e90186
744+
RNSVG: 6d07f8f8f246c85e3e16e0bcfc0d047db0c48496
745745
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
746746
Yoga: 65286bb6a07edce5e4fe8c90774da977ae8fc009
747747
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

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/

Example/macos/.xcode.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export NODE_BINARY=$(command -v node)
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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#import "AppDelegate.h"
2+
3+
#import <React/RCTBundleURLProvider.h>
4+
5+
@implementation AppDelegate
6+
7+
- (void)applicationDidFinishLaunching:(NSNotification *)notification
8+
{
9+
self.moduleName = @"Example";
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+
#if DEBUG
20+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21+
#else
22+
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23+
#endif
24+
}
25+
26+
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
27+
///
28+
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
29+
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
30+
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
31+
- (BOOL)concurrentRootEnabled
32+
{
33+
#ifdef RN_FABRIC_ENABLED
34+
return true;
35+
#else
36+
return false;
37+
#endif
38+
}
39+
40+
@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+
}

0 commit comments

Comments
 (0)