Skip to content

Commit 6918abd

Browse files
authored
feat: Add support for RN 0.76 (#224)
* upgrade iOS to RN 0.76.1 * android upgrade to RN 0.76 * fix eslint setup * android fix cmake * fix CI node setup * tests have changed due to updated babel version * fix java version * upgrade yest * fix iOS builds * change checksum of podfile for GH action to re-evaluate * fix iOS builds * fix: fix iOS podspec for new arch (#225) * fix(ios): fix install problems on new arch * compile example app for new arch
1 parent 64bca2b commit 6918abd

40 files changed

Lines changed: 8589 additions & 5554 deletions

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
lib/

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
root: true,
3+
extends: ["@react-native", "prettier"],
4+
plugins: ["prettier"],
5+
rules: {
6+
"prettier/prettier": [
7+
"warn",
8+
{
9+
quoteProps: "consistent",
10+
singleQuote: false,
11+
tabWidth: 2,
12+
trailingComma: "es5",
13+
useTabs: false,
14+
},
15+
],
16+
},
17+
};

.github/actions/setup/action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ runs:
66
steps:
77
- name: Setup Node.js
88
uses: actions/setup-node@v3
9-
with:
10-
node-version-file: .nvmrc
119

1210
- name: Cache dependencies
1311
id: yarn-cache

.github/workflows/build-android.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ on:
55
branches:
66
- main
77
paths:
8-
- '.github/workflows/build-android.yml'
9-
- 'android/**'
10-
- 'cpp/**'
11-
- 'example/android/**'
12-
- 'yarn.lock'
13-
- 'example/yarn.lock'
8+
- ".github/workflows/build-android.yml"
9+
- "android/**"
10+
- "cpp/**"
11+
- "example/android/**"
12+
- "yarn.lock"
13+
- "example/yarn.lock"
1414
pull_request:
1515
paths:
16-
- '.github/workflows/build-android.yml'
17-
- 'android/**'
18-
- 'cpp/**'
19-
- 'example/android/**'
20-
- 'yarn.lock'
21-
- 'example/yarn.lock'
16+
- ".github/workflows/build-android.yml"
17+
- "android/**"
18+
- "cpp/**"
19+
- "example/android/**"
20+
- "yarn.lock"
21+
- "example/yarn.lock"
2222

2323
jobs:
2424
build_example:
@@ -27,10 +27,10 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v2
2929

30-
- name: Setup JDK 11
30+
- name: Setup JDK 17
3131
uses: actions/setup-java@v1
3232
with:
33-
java-version: 11
33+
java-version: 17
3434

3535
- name: Get yarn cache directory path
3636
id: yarn-cache-dir-path

.github/workflows/build-ios.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ on:
55
branches:
66
- main
77
paths:
8-
- '.github/workflows/build-ios.yml'
9-
- 'ios/**'
10-
- 'cpp/**'
11-
- '*.podspec'
12-
- 'example/ios/**'
8+
- ".github/workflows/build-ios.yml"
9+
- "ios/**"
10+
- "cpp/**"
11+
- "*.podspec"
12+
- "example/ios/**"
1313
pull_request:
1414
paths:
15-
- '.github/workflows/build-ios.yml'
16-
- 'ios/**'
17-
- 'cpp/**'
18-
- '*.podspec'
19-
- 'example/ios/**'
15+
- ".github/workflows/build-ios.yml"
16+
- "ios/**"
17+
- "cpp/**"
18+
- "*.podspec"
19+
- "example/ios/**"
2020

2121
jobs:
2222
build:
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup Ruby (bundle)
5252
uses: ruby/setup-ruby@v1
5353
with:
54-
ruby-version: '2.7.6'
54+
ruby-version: "2.7.6"
5555
bundler-cache: true
5656
working-directory: example
5757

@@ -63,10 +63,8 @@ jobs:
6363
~/Library/Caches/CocoaPods
6464
~/.cocoapods
6565
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
66-
restore-keys: |
67-
${{ runner.os }}-pods-
6866
- name: Install Pods
69-
run: bundle exec pod check || bundle exec pod install
67+
run: RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
7068
- name: Install xcpretty
7169
run: gem install xcpretty
7270
- name: Build App

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ android.iml
4343
# Cocoapods
4444
#
4545
example/ios/Pods
46+
example/ios/.xcode.env.local
4647

4748
# Ruby
4849
example/vendor/

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"quoteProps": "consistent",
3+
"singleQuote": false,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"useTabs": false
7+
}

android/CMakeLists.txt

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ add_compile_options(${folly_FLAGS})
1919
find_package(fbjni REQUIRED CONFIG)
2020
find_package(ReactAndroid REQUIRED CONFIG)
2121

22-
if(${JS_RUNTIME} STREQUAL "hermes")
23-
find_package(hermes-engine REQUIRED CONFIG)
24-
endif()
25-
2622
file(GLOB_RECURSE SOURCES_COMMON CONFIGURE_DEPENDS "../cpp/**.cpp")
2723

2824
add_library(
@@ -59,38 +55,62 @@ target_link_libraries(
5955

6056
target_link_libraries(
6157
${PACKAGE_NAME}
62-
ReactAndroid::folly_runtime
63-
ReactAndroid::glog
6458
ReactAndroid::jsi
65-
ReactAndroid::reactnativejni
6659
fbjni::fbjni
6760
)
6861

62+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
63+
target_link_libraries(
64+
${PACKAGE_NAME}
65+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
66+
)
67+
else()
68+
target_link_libraries(
69+
${PACKAGE_NAME}
70+
ReactAndroid::reactnativejni # <-- RN: React Native JNI bindings
71+
ReactAndroid::folly_runtime
72+
ReactAndroid::glog
73+
)
74+
endif()
75+
76+
# Add the appropriate JS runtime
6977
if(${JS_RUNTIME} STREQUAL "hermes")
70-
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
78+
find_package(hermes-engine REQUIRED CONFIG)
7179

72-
# From prefab from module `com.facebook.react:hermes-android`
73-
set(HERMES_LIB hermes-engine::libhermes)
80+
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
7481

7582
target_link_libraries(
7683
${PACKAGE_NAME}
77-
${HERMES_LIB}
84+
hermes-engine::libhermes
7885
)
7986

8087
if(${HERMES_ENABLE_DEBUGGER})
81-
set(HERMES_EXECUTOR_LIB ReactAndroid::hermes_executor)
88+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
89+
target_link_libraries(
90+
${PACKAGE_NAME}
91+
ReactAndroid::hermestooling
92+
)
93+
else()
94+
target_link_libraries(
95+
${PACKAGE_NAME}
96+
ReactAndroid::hermes_executor
97+
)
98+
endif()
99+
endif()
100+
elseif(${JS_RUNTIME} STREQUAL "jsc")
101+
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")
82102

103+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
83104
target_link_libraries(
84105
${PACKAGE_NAME}
85-
${HERMES_EXECUTOR_LIB}
106+
ReactAndroid::jsctooling
107+
)
108+
else()
109+
target_link_libraries(
110+
${PACKAGE_NAME}
111+
ReactAndroid::jscexecutor
86112
)
87113
endif()
88-
elseif(${JS_RUNTIME} STREQUAL "jsc")
89-
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")
90-
91-
set(JSEXECUTOR_LIB ReactAndroid::jscexecutor)
92-
93-
target_link_libraries(${PACKAGE_NAME} ${JSEXECUTOR_LIB})
94114
else()
95115
message(FATAL_ERROR "Unknown JS runtime ${JS_RUNTIME}.")
96116
endif()

android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ android {
145145
"**/libhermes.so",
146146
"**/libhermes-executor-debug.so",
147147
"**/libhermes_executor.so",
148+
"**/libreactnative.so",
148149
"**/libreactnativejni.so",
149150
"**/libturbomodulejsijni.so",
150151
"**/libreact_nativemodule_core.so",

0 commit comments

Comments
 (0)