Skip to content

Commit 592efd0

Browse files
authored
Add experimental iOS support (#166)
# Why Since Xcode 14 has deprecated BitCode, it is a good time to revisit iOS support. # How - v8-ios now delivers xcframework - add ios autolinking and fix launch crash from the default `freeze_flags_after_init` v8 flag - remove deprecated `react-native-template-v8` - add expo config-plugin support for ios # Test Plan ```sh $ yarn create expo-app sdk48 $ cd sdk48 $ npx expo install react-native-v8 v8-ios $ npx expo run:ios ```
1 parent 3380d22 commit 592efd0

File tree

74 files changed

+690
-3285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+690
-3285
lines changed

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This project aims to support V8 replacement runtime for React Native. Designed a
88
> **Note** From react-native-v8 2.0, the minimum requirement for react-native is 0.71.2.
99
1010
For earlier versions, please check out the older readmes.
11+
1112
- [react-native>=0.66.0 readme](https://github.com/Kudo/react-native-v8/blob/1.0-stable/README.md)
1213
- [react-native<0.66.0 readme](https://github.com/Kudo/react-native-v8/blob/0.67-stable/README.md)
1314

@@ -16,12 +17,12 @@ For earlier versions, please check out the older readmes.
1617
For managed projects, you can install through the single command:
1718

1819
```sh
19-
$ expo install react-native-v8 v8-android-jit
20+
$ npx expo install react-native-v8 v8-android-jit
2021
```
2122

2223
- Please make sure you have [`"android.jsEngine": "jsc"`](https://docs.expo.dev/versions/latest/config/app/#jsengine-2).
2324

24-
For bare projects, you can run `expo prebuild -p android --clean` after the installation to prebuild again.
25+
For bare projects, you can run `npx expo prebuild -p android --clean` after the installation to prebuild again.
2526

2627
## Installation for React Native >= 0.71
2728

@@ -133,10 +134,19 @@ For detailed V8 features, please check [the v8-android-buildscripts feature flag
133134
| `v8-android` | No | Yes |
134135
| `v8-android-nointl` | No | No |
135136

136-
## iOS Support (Experimented)
137+
## iOS Support (Experimental)
138+
139+
You could try the experimental ios support on an Expo project which SDK version is greater or equal to 48.
140+
141+
For managed projects, you can install through the single command:
142+
143+
```sh
144+
$ npx expo install react-native-v8 v8-ios
145+
```
146+
147+
- Please make sure you have [`"ios.jsEngine": "jsc"`](https://docs.expo.dev/versions/latest/config/app/#jsengine-1).
137148

138-
We did have experimented iOS support. To adopt V8 for Xcodeproj gets a little complicated, so we have a pre-shaped template.
139-
Please check [react-native-template-v8](packages/react-native-template-v8/README.md) for more information.
149+
For bare projects, you can run `npx expo prebuild -p ios --clean` after the installation to prebuild again.
140150

141151
## FAQ
142152

RNV8.podspec

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require 'json'
2+
3+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4+
5+
reactNativeVersion = '0.0.0'
6+
begin
7+
reactNativeVersion = `node --print "require('react-native/package.json').version"`
8+
rescue
9+
reactNativeVersion = '0.0.0'
10+
end
11+
if ENV["REACT_NATIVE_OVERRIDE_VERSION"]
12+
reactNativeVersion = ENV["REACT_NATIVE_OVERRIDE_VERSION"]
13+
end
14+
reactNativeTargetVersion = reactNativeVersion.split('.')[1].to_i
15+
16+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
17+
18+
Pod::Spec.new do |s|
19+
s.name = 'RNV8'
20+
s.version = package['version']
21+
s.summary = package['description']
22+
s.description = package['description']
23+
s.license = package['license']
24+
s.author = package['author']
25+
s.homepage = package['homepage']
26+
s.platform = :ios, '13.0'
27+
28+
s.source = { git: 'https://github.com/Kudo/react-native-v8.git' }
29+
s.source_files = 'src/v8runtime/**/*.{h,cpp}', 'src/iosexecutor/**/*.{h,cpp,m,mm}'
30+
31+
s.pod_target_xcconfig = {
32+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
33+
'HEADER_SEARCH_PATHS' => "\"$(PODS_ROOT)/boost\"",
34+
}
35+
36+
compiler_flags = folly_compiler_flags + ' ' + "-DREACT_NATIVE_TARGET_VERSION=#{reactNativeTargetVersion}"
37+
s.compiler_flags = compiler_flags
38+
39+
s.dependency 'v8-ios'
40+
s.dependency 'React-Core'
41+
s.dependency 'React-cxxreact'
42+
end

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"android",
1919
"v8"
2020
],
21+
"author": "Kudo Chien",
2122
"license": "MIT",
2223
"bugs": {
2324
"url": "https://github.com/Kudo/react-native-v8/issues"

packages/react-native-template-v8/README.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/react-native-template-v8/package.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/react-native-template-v8/template.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/react-native-template-v8/template/App.js

Lines changed: 0 additions & 122 deletions
This file was deleted.

packages/react-native-template-v8/template/__tests__/App-test.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/react-native-template-v8/template/_buckconfig

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/react-native-template-v8/template/_eslintrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)