Skip to content

Commit 8b465b6

Browse files
wcandillonSaadnajmikewde
authored
feat(🎨): version 2.0.0 (#3133)
BREAKING CHANGE: * React 19 and React Native 0.78 minimum are required * The `debug` and `mode` properties are now deprecated * `SKSGRoot` api is now async, as a result functions such as `drawAsImage` are now async as well. --------- Co-authored-by: Saad Najmi <[email protected]> Co-authored-by: kewde <[email protected]>
1 parent cbcf5ef commit 8b465b6

File tree

450 files changed

+5170
-9066
lines changed

Some content is hidden

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

450 files changed

+5170
-9066
lines changed

‎.github/workflows/ci.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,22 @@ jobs:
129129
130130
- name: Install Android SDK
131131
run: |
132-
echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/paper/android/local.properties
132+
echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties
133133
134134
- name: Cache Gradle
135135
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
136136
with:
137137
path: |
138138
~/.gradle/wrapper
139139
~/.gradle/caches
140-
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/paper/android/gradle/wrapper/gradle-wrapper.properties') }}
140+
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/example/android/gradle/wrapper/gradle-wrapper.properties') }}
141141
${{ runner.os }}-gradle-
142142

143143
- name: Build example for Android
144144
env:
145145
JAVA_OPTS: "-XX:MaxHeapSize=6g"
146146
run: |
147-
yarn turbo run build:android --concurrency 1 --filter=paper --force
147+
yarn turbo run build:android --concurrency 1 --filter=example --force
148148
149149
build-android:
150150
runs-on: macos-latest-large
@@ -191,16 +191,15 @@ jobs:
191191
192192
- name: Install Android SDK
193193
run: |
194-
echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/paper/android/local.properties
195-
echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/fabric/android/local.properties
194+
echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties
196195
197196
- name: Cache Gradle
198197
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
199198
with:
200199
path: |
201200
~/.gradle/wrapper
202201
~/.gradle/caches
203-
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/paper/android/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('./apps/fabric/android/gradle/wrapper/gradle-wrapper.properties') }}
202+
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/example/android/gradle/wrapper/gradle-wrapper.properties') }}
204203
restore-keys: |
205204
${{ runner.os }}-gradle-
206205
@@ -215,17 +214,14 @@ jobs:
215214
env:
216215
cache-name: cache-apk
217216
with:
218-
path: apps/paper/android/app/build/outputs/apk/debug/app-debug.apk
217+
path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk
219218
key: apk-${{ github.sha }}
220219

221220
test-android:
222221
needs: build-android
223222
runs-on: macos-latest-large
224223
env:
225224
TURBO_CACHE_DIR: .turbo/android
226-
strategy:
227-
matrix:
228-
working-directory: [apps/paper]
229225
steps:
230226
- name: checkout
231227
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -241,7 +237,7 @@ jobs:
241237
id: cache-apk
242238
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
243239
with:
244-
path: ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
240+
path: apps/example/android/app/build/outputs/apk/debug/app-debug.apk
245241
key: apk-${{ github.sha }}
246242

247243
- name: SKDs - download required images
@@ -258,35 +254,31 @@ jobs:
258254
timeout-minutes: 10
259255

260256
- name: Start Package Manager
261-
working-directory: ${{ matrix.working-directory }}
257+
working-directory: apps/example/
262258
run: E2E=true yarn start &
263259

264260
- name: Check APK existence
265261
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
266262
with:
267-
files: ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
263+
files: apps/example/android/app/build/outputs/apk/debug/app-debug.apk
268264
fail: true
269265

270266
- name: Install APK
271-
run: adb install -r ${{ matrix.working-directory }}/android/app/build/outputs/apk/debug/app-debug.apk
267+
run: adb install -r apps/example/android/app/build/outputs/apk/debug/app-debug.apk
272268

273269
# - name: Set up environment
274270
# run: echo "PACKAGE_NAME=${{ env.PACKAGE_NAME }}" >> $GITHUB_ENV
275271
- name: Launch APK
276272
env:
277-
PACKAGE_NAME: ${{ matrix.working-directory == 'fabricexample' && 'com.fabricexample' || 'com.paper' }}
273+
PACKAGE_NAME: 'com.microsoft.reacttestapp'
278274
run: adb shell monkey -p ${{ env.PACKAGE_NAME }} 1
279275

280276
# On fabric, the system fonts are slightly different
281277
# so wont run the paragraph tests there for now
282278
- name: Run e2e Tests
283279
working-directory: packages/skia
284280
run: |
285-
if [ "${{ matrix.working-directory }}" = "apps/paper" ]; then
286-
CI=true yarn e2e
287-
elif [ "${{ matrix.working-directory }}" = "apps/none" ]; then
288-
CI=true yarn e2e --testPathIgnorePatterns Paragraphs
289-
fi
281+
CI=true yarn e2e --testPathIgnorePatterns Paragraphs
290282
291283
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
292284
if: failure()
@@ -332,15 +324,15 @@ jobs:
332324
fi
333325
334326
- name: Install CocoaPods
335-
working-directory: apps/paper/ios
327+
working-directory: apps/example/ios
336328
run: pod install
337329

338330
- name: Start Package Manager
339-
working-directory: apps/paper
331+
working-directory: apps/example
340332
run: E2E=true yarn start &
341333

342334
- name: Build example for iOS
343-
working-directory: apps/paper
335+
working-directory: apps/example
344336
run: yarn ios --simulator 'iPhone 16 Pro'
345337

346338
- name: Run e2e tests

‎apps/docs/docs/getting-started/installation.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@ React Native Skia brings the [Skia Graphics Library](https://skia.org/) to React
99
Skia serves as the graphics engine for Google Chrome and Chrome OS, Android, Flutter, Mozilla Firefox, Firefox OS, and many other products.
1010

1111
**Version compatibility:**
12-
`react-native@>=0.71` and `react@>=18` are required. <br />
12+
`react-native@>=0.79` and `react@>=19` are required. <br />
1313
In addition you should make sure you're on at least `iOS 13` and `Android API level 21` or above. <br />
14-
To use React Native Skia with the new architecture, `react-native@>=0.72` is required. <br />
1514
To use React Native Skia with video support, `Android API level 26` or above is required.
1615

17-
For `react-native@>=0.78` and `react@>=19`, you need to use `@shopify/react-native-skia@next`.
16+
For `react-native@<=0.78` and `react@<=18`, you need to use `@shopify/react-native-skia` version `1.12.4` or below.
1817

1918
`tvOS >= 13` is also supported.
2019

21-
Skia has a new experimental backend named Graphite which runs on Vulkan and Metal.
22-
We currently are working on a new version of React Native Skia that uses this new backend.
23-
For Graphite to run, you will need to use `Android API level 26` and `iOS 15.1` or above.
2420

2521
**Install the library using yarn:**
2622

‎apps/docs/docs/shapes/atlas.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rsxForm = Skia.RSXformFromRadians(1, r, 100, 0, 125, 25);
4747
In the example below, we draw in simple rectangle as an image.
4848
Then we display that rectangle 150 times with a simple transformation applied to each rectangle.
4949

50-
```tsx twoslash
50+
```tsx
5151
import {Skia, drawAsImage, Group, Rect, Canvas, Atlas, rect} from "@shopify/react-native-skia";
5252

5353
const size = { width: 25, height: 11.25 };
@@ -56,7 +56,7 @@ const imageSize = {
5656
width: size.width + strokeWidth,
5757
height: size.height + strokeWidth,
5858
};
59-
const image = drawAsImage(
59+
const image = await drawAsImage(
6060
<Group>
6161
<Rect
6262
rect={rect(strokeWidth / 2, strokeWidth / 2, size.width, size.height)}

‎apps/docs/docs/snapshot-views.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If the view is optimized away, `makeImageFromView` will crash or return the wron
1818

1919

2020

21-
```tsx twoslash
21+
```tsx
2222
import { useState, useRef } from "react";
2323
import { View, Text, PixelRatio, StyleSheet, Pressable } from "react-native";
2424
import type { SkImage } from "@shopify/react-native-skia";

‎apps/docs/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
"file-loader": "^6.2.0",
2828
"its-fine": "^1.0.8",
2929
"prism-react-renderer": "^2.4.1",
30-
"react": "18.3.1",
31-
"react-dom": "18.3.1",
32-
"react-native": "0.75.2",
33-
"react-native-gesture-handler": "^2.18.1",
34-
"react-native-reanimated": "^3.15.1",
30+
"react": "19.0.0",
31+
"react-dom": "19.0.0",
32+
"react-native": "0.78.0",
33+
"react-native-gesture-handler": "^2.24.0",
34+
"react-native-reanimated": "^3.0",
3535
"url-loader": "^4.1.1"
3636
},
3737
"devDependencies": {
@@ -45,7 +45,7 @@
4545
"ts-morph": "^25.0.1",
4646
"ts-node": "^10.9.2",
4747
"twoslash-cli": "1.3.24",
48-
"typescript": "5.1.6"
48+
"typescript": "^5.2.2"
4949
},
5050
"resolutions": {
5151
"@typescript-eslint/eslint-plugin": "6.10.0",

‎apps/fabric/.eslintrc renamed to ‎apps/example/.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"extends": "react-native-wcandillon",
3+
"parser": "@typescript-eslint/parser",
34
"parserOptions": {
45
"project": "./tsconfig.json"
56
},

‎apps/example/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.binlog
2+
*.hprof
3+
*.xcworkspace/
4+
*.zip
5+
.DS_Store
6+
.gradle/
7+
.idea/
8+
.vs/
9+
.xcode.env
10+
Pods/
11+
build/
12+
dist/*
13+
!dist/.gitignore
14+
local.properties
15+
msbuild.binlog
16+
node_modules/
File renamed without changes.

‎apps/example/android/build.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
buildscript {
2+
apply(from: {
3+
def searchDir = rootDir.toPath()
4+
do {
5+
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
6+
if (p.toFile().exists()) {
7+
return p.toRealPath().toString()
8+
}
9+
} while (searchDir = searchDir.getParent())
10+
throw new GradleException("Could not find `react-native-test-app`");
11+
}())
12+
13+
repositories {
14+
mavenCentral()
15+
google()
16+
}
17+
18+
dependencies {
19+
getReactNativeDependencies().each { dependency ->
20+
classpath(dependency)
21+
}
22+
}
23+
}
24+
25+
allprojects {
26+
repositories {
27+
maven {
28+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
29+
url({
30+
def searchDir = rootDir.toPath()
31+
do {
32+
def p = searchDir.resolve("node_modules/react-native/android")
33+
if (p.toFile().exists()) {
34+
return p.toRealPath().toString()
35+
}
36+
} while (searchDir = searchDir.getParent())
37+
throw new GradleException("Could not find `react-native`");
38+
}())
39+
}
40+
mavenCentral()
41+
google()
42+
}
43+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Project-wide Gradle settings.
2+
3+
# IDE (e.g. Android Studio) users:
4+
# Gradle settings configured through the IDE *will override*
5+
# any settings specified in this file.
6+
7+
# For more details on how to configure your build environment visit
8+
# http://www.gradle.org/docs/current/userguide/build_environment.html
9+
10+
# Specifies the JVM arguments used for the Gradle Daemon. The setting is
11+
# particularly useful for configuring JVM memory settings for build performance.
12+
# This does not affect the JVM settings for the Gradle client VM.
13+
# The default is `-Xmx512m -XX:MaxMetaspaceSize=256m`.
14+
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
15+
16+
# When configured, Gradle will fork up to org.gradle.workers.max JVMs to execute
17+
# projects in parallel. To learn more about parallel task execution, see the
18+
# section on Gradle build performance:
19+
# https://docs.gradle.org/current/userguide/performance.html#parallel_execution.
20+
# Default is `false`.
21+
#org.gradle.parallel=true
22+
23+
# AndroidX package structure to make it clearer which packages are bundled with the
24+
# Android operating system, and which are packaged with your app's APK
25+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
26+
android.useAndroidX=true
27+
# Automatically convert third-party libraries to use AndroidX
28+
android.enableJetifier=true
29+
# Jetifier randomly fails on these libraries
30+
android.jetifier.ignorelist=hermes-android,react-android
31+
32+
# Use this property to specify which architecture you want to build.
33+
# You can also override it from the CLI using
34+
# ./gradlew <task> -PreactNativeArchitectures=x86_64
35+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
36+
37+
# Use this property to enable support to the new architecture.
38+
# This will allow you to use TurboModules and the Fabric render in
39+
# your application. You should enable this flag either if you want
40+
# to write custom TurboModules/Fabric components OR use libraries that
41+
# are providing them.
42+
# Note that this is incompatible with web debugging.
43+
newArchEnabled=true
44+
bridgelessEnabled=true
45+
hermesEnabled=true
46+
47+
# Uncomment the line below to build React Native from source.
48+
#react.buildFromSource=true
49+
50+
# Version of Android NDK to build against.
51+
#ANDROID_NDK_VERSION=26.1.10909125
52+
53+
# Version of Kotlin to build against.
54+
#KOTLIN_VERSION=1.8.22
55+
56+
hermesEnabled=true
57+
react.minSdkVersion=26

0 commit comments

Comments
 (0)