Skip to content

Commit ca4e3fc

Browse files
authored
add react-native 0.73 support (#200)
1 parent fc6c2a1 commit ca4e3fc

File tree

9 files changed

+38
-20
lines changed

9 files changed

+38
-20
lines changed

.github/workflows/android.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
rn-version: ['0.72', '0.71']
25+
rn-version: ['0.73']
2626
v8-android-variant:
2727
[v8-android-jit, v8-android-jit-nointl, v8-android, v8-android-nointl]
2828
# include:
@@ -35,11 +35,11 @@ jobs:
3535
- uses: actions/checkout@v2
3636
- uses: oven-sh/setup-bun@v1
3737

38-
- name: Use JDK 11
38+
- name: Use JDK 17
3939
uses: actions/setup-java@v2
4040
with:
4141
distribution: 'temurin'
42-
java-version: '11'
42+
java-version: '17'
4343

4444
- name: Restore yarn caches
4545
uses: actions/cache@v2

.github/workflows/expo-android.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
- uses: actions/checkout@v2
2525
- uses: oven-sh/setup-bun@v1
2626

27-
- name: Use JDK 11
27+
- name: Use JDK 17
2828
uses: actions/setup-java@v2
2929
with:
3030
distribution: 'temurin'
31-
java-version: '11'
31+
java-version: '17'
3232

3333
- name: Restore yarn caches
3434
uses: actions/cache@v2
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Generate TestApp
4343
run: |
44-
yarn create expo-app TestApp
44+
yarn create expo-app -t blank@@sdk-50 TestApp
4545
cd TestApp
4646
yarn add v8-android-jit
4747
yarn add file:../react-native-v8

.github/workflows/expo-ios.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
- uses: actions/checkout@v2
2626
- uses: oven-sh/setup-bun@v1
2727

28+
- name: 🔨 Switch to Xcode 14.3.1
29+
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app
30+
2831
- name: Restore yarn caches
2932
uses: actions/cache@v2
3033
with:
@@ -36,7 +39,7 @@ jobs:
3639

3740
- name: Generate TestApp
3841
run: |
39-
yarn create expo-app TestApp
42+
yarn create expo-app -t blank@@sdk-50 TestApp
4043
cd TestApp
4144
yarn add v8-ios
4245
yarn add file:../react-native-v8
@@ -54,7 +57,7 @@ jobs:
5457
- name: Run TestApp
5558
working-directory: ../TestApp/ios
5659
run: |
57-
SIMUDID=$(xcrun simctl list devices available -j | jq -r '.devices."com.apple.CoreSimulator.SimRuntime.iOS-16-2"[] | select(.name=="iPhone 14 Pro") | .udid')
60+
SIMUDID=$(xcrun simctl list devices available -j | jq -r '.devices."com.apple.CoreSimulator.SimRuntime.iOS-16-4"[] | select(.name=="iPhone 14 Pro") | .udid')
5861
echo "Using simulator udid[${SIMUDID}]"
5962
xcrun simctl boot ${SIMUDID}
6063
xcrun simctl install booted ./build/Build/Products/Release-iphonesimulator/TestApp.app

RNV8.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if ENV["REACT_NATIVE_OVERRIDE_VERSION"]
1313
end
1414
reactNativeTargetVersion = reactNativeVersion.split('.')[1].to_i
1515

16-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
16+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
1717

1818
Pod::Spec.new do |s|
1919
s.name = 'RNV8'

plugin/build/withV8ExpoAdapter.js

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ function updateIosAppDelegate(contents) {
115115
#define FOLLY_HAVE_PTHREAD 1
116116
#endif
117117
118+
#ifndef FOLLY_CFG_NO_COROUTINES
119+
#define FOLLY_CFG_NO_COROUTINES 1
120+
#endif
121+
118122
#import <memory>
119123
#import <React/RCTCxxBridgeDelegate.h>
120124
#import <React/RCTJSIExecutorRuntimeInstaller.h>

plugin/src/withV8ExpoAdapter.ts

+4
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ export function updateIosAppDelegate(contents: string): string {
131131
#define FOLLY_HAVE_PTHREAD 1
132132
#endif
133133
134+
#ifndef FOLLY_CFG_NO_COROUTINES
135+
#define FOLLY_CFG_NO_COROUTINES 1
136+
#endif
137+
134138
#import <memory>
135139
#import <React/RCTCxxBridgeDelegate.h>
136140
#import <React/RCTJSIExecutorRuntimeInstaller.h>

scripts/gen_project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def main():
7676
patcher.add_v8_support()
7777
patcher.add_vm_hint()
7878
subprocess.run(
79-
["npx", "react-native", "run-android", "--variant", "release", "--no-packager"]
79+
["npx", "react-native", "run-android", "--mode", "release", "--no-packager"]
8080
)
8181

8282

scripts/lib/patcher.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ def _patch_app_gradle(self):
7777
f.write(new_content)
7878

7979
def _patch_react_native_host(self):
80-
main_app_files = glob.glob("android/**/MainApplication.java", recursive=True)
80+
main_app_files = glob.glob("android/**/MainApplication.kt", recursive=True)
8181
v8_block = """
82-
@Override
83-
protected com.facebook.react.bridge.JavaScriptExecutorFactory getJavaScriptExecutorFactory() {
84-
return new io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory(
85-
getApplicationContext(),
86-
getPackageName(),
87-
com.facebook.react.modules.systeminfo.AndroidInfoHelpers.getFriendlyDeviceName(),
88-
getUseDeveloperSupport());
82+
override fun getJavaScriptExecutorFactory(): com.facebook.react.bridge.JavaScriptExecutorFactory {
83+
return io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory(
84+
applicationContext,
85+
packageName,
86+
com.facebook.react.modules.systeminfo.AndroidInfoHelpers.getFriendlyDeviceName(),
87+
useDeveloperSupport
88+
)
8989
}
9090
"""
9191
for file in main_app_files:
9292
self._replace_file_content(
9393
file,
94-
r"(protected String getJSMainModuleName\(\) \{\n.*?\n.*?\}\n)",
94+
r'(override fun getJSMainModuleName\(\): String = "index")',
9595
"\\1" + v8_block,
9696
re_flags=(re.DOTALL | re.MULTILINE),
9797
)

src/v8runtime/V8Inspector.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@
1010
#include <cxxreact/MessageQueueThread.h>
1111
#include <condition_variable>
1212
#include "v8-inspector.h"
13+
1314
#if REACT_NATIVE_TARGET_VERSION >= 73
15+
16+
#if __has_include(<React-jsinspector/jsinspector/InspectorInterfaces.h>)
17+
#include <React-jsinspector/jsinspector/InspectorInterfaces.h>
18+
#else
1419
#include "jsinspector-modern/InspectorInterfaces.h"
20+
#endif // __has_include(<React-jsinspector/jsinspector/InspectorInterfaces.h>)
21+
1522
namespace jsinspector = facebook::react::jsinspector_modern;
1623
#else
1724
#include "jsinspector/InspectorInterfaces.h"
1825
namespace jsinspector = facebook::react;
19-
#endif
26+
#endif // REACT_NATIVE_TARGET_VERSION >= 73
2027

2128
namespace rnv8 {
2229

0 commit comments

Comments
 (0)