@shopify/react-native-skia 0.1.155 → 0.1.157
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/jni/JniLoad.cpp +5 -5
- package/android/cpp/jni/JniPlatformContext.cpp +107 -119
- package/android/cpp/jni/JniSkiaManager.cpp +18 -20
- package/android/cpp/jni/include/JniPlatformContext.h +41 -45
- package/android/cpp/jni/include/JniSkiaBaseView.h +52 -55
- package/android/cpp/jni/include/JniSkiaDrawView.h +72 -77
- package/android/cpp/jni/include/JniSkiaManager.h +51 -53
- package/android/cpp/jni/include/JniSkiaPictureView.h +74 -78
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +36 -45
- package/android/cpp/rnskia-android/RNSkAndroidView.h +87 -92
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +62 -65
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +20 -17
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +257 -313
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +107 -110
- package/cpp/api/JsiSkApi.h +66 -62
- package/cpp/api/JsiSkCanvas.h +38 -30
- package/cpp/api/JsiSkColor.h +58 -56
- package/cpp/api/JsiSkColorFilter.h +5 -3
- package/cpp/api/JsiSkColorFilterFactory.h +23 -21
- package/cpp/api/JsiSkContourMeasure.h +74 -85
- package/cpp/api/JsiSkContourMeasureIter.h +68 -75
- package/cpp/api/JsiSkData.h +16 -22
- package/cpp/api/JsiSkDataFactory.h +86 -79
- package/cpp/api/JsiSkFont.h +286 -311
- package/cpp/api/JsiSkHostObjects.h +15 -16
- package/cpp/api/JsiSkImage.h +107 -103
- package/cpp/api/JsiSkImageFactory.h +34 -36
- package/cpp/api/JsiSkImageFilter.h +5 -3
- package/cpp/api/JsiSkImageFilterFactory.h +71 -68
- package/cpp/api/JsiSkImageInfo.h +41 -38
- package/cpp/api/JsiSkMaskFilter.h +5 -3
- package/cpp/api/JsiSkMaskFilterFactory.h +2 -3
- package/cpp/api/JsiSkMatrix.h +26 -36
- package/cpp/api/JsiSkPaint.h +20 -13
- package/cpp/api/JsiSkPath.h +70 -85
- package/cpp/api/JsiSkPathEffect.h +5 -3
- package/cpp/api/JsiSkPathEffectFactory.h +33 -28
- package/cpp/api/JsiSkPathFactory.h +68 -67
- package/cpp/api/JsiSkPicture.h +28 -22
- package/cpp/api/JsiSkPictureFactory.h +13 -12
- package/cpp/api/JsiSkPictureRecorder.h +21 -19
- package/cpp/api/JsiSkPoint.h +6 -8
- package/cpp/api/JsiSkRRect.h +11 -7
- package/cpp/api/JsiSkRSXform.h +82 -85
- package/cpp/api/JsiSkRect.h +9 -9
- package/cpp/api/JsiSkRuntimeEffect.h +182 -186
- package/cpp/api/JsiSkRuntimeEffectFactory.h +10 -11
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +64 -61
- package/cpp/api/JsiSkSVG.h +4 -5
- package/cpp/api/JsiSkSVGFactory.h +28 -27
- package/cpp/api/JsiSkShader.h +3 -2
- package/cpp/api/JsiSkShaderFactory.h +37 -25
- package/cpp/api/JsiSkSurface.h +44 -40
- package/cpp/api/JsiSkSurfaceFactory.h +22 -22
- package/cpp/api/JsiSkTextBlob.h +28 -31
- package/cpp/api/JsiSkTextBlobFactory.h +88 -87
- package/cpp/api/JsiSkTypeface.h +6 -5
- package/cpp/api/JsiSkTypefaceFactory.h +22 -21
- package/cpp/api/JsiSkVertices.h +137 -124
- package/cpp/api/third_party/CSSColorParser.cpp +161 -174
- package/cpp/api/third_party/CSSColorParser.h +172 -96
- package/cpp/jsi/JsiHostObject.cpp +11 -9
- package/cpp/jsi/JsiHostObject.h +31 -24
- package/cpp/jsi/JsiSimpleValueWrapper.h +74 -83
- package/cpp/jsi/JsiValueWrapper.h +52 -54
- package/cpp/rnskia/RNSkAnimation.h +26 -29
- package/cpp/rnskia/RNSkDispatchQueue.cpp +50 -61
- package/cpp/rnskia/RNSkDispatchQueue.h +3 -1
- package/cpp/rnskia/RNSkInfoParameter.h +12 -12
- package/cpp/rnskia/RNSkJsView.cpp +82 -81
- package/cpp/rnskia/RNSkJsView.h +45 -41
- package/cpp/rnskia/RNSkJsiViewApi.h +99 -89
- package/cpp/rnskia/RNSkManager.cpp +8 -7
- package/cpp/rnskia/RNSkManager.h +8 -6
- package/cpp/rnskia/RNSkPictureView.h +44 -37
- package/cpp/rnskia/RNSkPlatformContext.h +39 -28
- package/cpp/rnskia/RNSkValueApi.h +33 -34
- package/cpp/rnskia/RNSkView.h +108 -93
- package/cpp/rnskia/values/RNSkClockValue.h +63 -64
- package/cpp/rnskia/values/RNSkComputedValue.h +32 -30
- package/cpp/rnskia/values/RNSkReadonlyValue.h +60 -59
- package/cpp/rnskia/values/RNSkValue.h +38 -40
- package/cpp/utils/RNSkLog.h +9 -7
- package/cpp/utils/RNSkMeasureTime.h +7 -7
- package/cpp/utils/RNSkTimingInfo.h +27 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +8 -9
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +24 -23
- package/ios/RNSkia-iOS/RNSkiOSView.h +16 -13
- package/ios/RNSkia-iOS/SkiaUIView.h +9 -8
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +6 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/LayerNode.js +43 -0
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -0
- package/lib/commonjs/dom/types/NodeType.js +1 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +1 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js +3 -0
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +10 -1
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Group.js +19 -4
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +6 -1
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +3 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +6 -3
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/module/animation/spring/runSpring.js +1 -1
- package/lib/module/animation/spring/runSpring.js.map +1 -1
- package/lib/module/animation/spring/useSpring.js +1 -1
- package/lib/module/animation/spring/useSpring.js.map +1 -1
- package/lib/module/animation/timing/createTiming.js +6 -2
- package/lib/module/animation/timing/createTiming.js.map +1 -1
- package/lib/module/animation/timing/functions/getResolvedParams.js +10 -6
- package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -1
- package/lib/module/animation/timing/useTiming.js +3 -1
- package/lib/module/animation/timing/useTiming.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +6 -1
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/LayerNode.js +32 -0
- package/lib/module/dom/nodes/LayerNode.js.map +1 -0
- package/lib/module/dom/nodes/datatypes/Gradient.js +2 -2
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.js +4 -2
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/NodeType.js +1 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/mock/index.js +10 -6
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +1 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/HostComponents.js +3 -0
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +9 -1
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Group.js +16 -3
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +7 -1
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/skia/core/Vector.js +1 -1
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/web/Host.js +1 -1
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/values/web/RNSkAnimation.js +2 -2
- package/lib/module/values/web/RNSkAnimation.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +3 -1
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +2 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +4 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/useTouchHandler.js +6 -6
- package/lib/module/views/useTouchHandler.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +1 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/LayerNode.d.ts +8 -0
- package/lib/typescript/src/dom/types/NodeType.d.ts +1 -0
- package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -0
- package/lib/typescript/src/renderer/HostComponents.d.ts +2 -1
- package/lib/typescript/src/renderer/components/Group.d.ts +5 -1
- package/lib/typescript/src/views/SkiaView.d.ts +3 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +42 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +42 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +14 -6
- package/src/dom/nodes/JsiSkDOM.ts +5 -0
- package/src/dom/nodes/LayerNode.ts +35 -0
- package/src/dom/types/NodeType.ts +1 -0
- package/src/dom/types/SkDOM.ts +1 -0
- package/src/renderer/Canvas.tsx +11 -1
- package/src/renderer/HostComponents.ts +3 -0
- package/src/renderer/HostConfig.ts +8 -1
- package/src/renderer/components/Group.tsx +16 -3
- package/src/renderer/components/Paint.tsx +7 -1
- package/src/views/SkiaPictureView.tsx +2 -3
- package/src/views/SkiaView.tsx +2 -2
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>AvailableLibraries</key>
|
6
|
+
<array>
|
7
|
+
<dict>
|
8
|
+
<key>LibraryIdentifier</key>
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
|
+
<key>LibraryPath</key>
|
11
|
+
<string>libskottie.a</string>
|
12
|
+
<key>SupportedArchitectures</key>
|
13
|
+
<array>
|
14
|
+
<string>arm64</string>
|
15
|
+
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
17
|
+
</array>
|
18
|
+
<key>SupportedPlatform</key>
|
19
|
+
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
22
|
+
</dict>
|
23
|
+
<dict>
|
24
|
+
<key>LibraryIdentifier</key>
|
25
|
+
<string>ios-arm64_arm64e</string>
|
26
|
+
<key>LibraryPath</key>
|
27
|
+
<string>libskottie.a</string>
|
28
|
+
<key>SupportedArchitectures</key>
|
29
|
+
<array>
|
30
|
+
<string>arm64</string>
|
31
|
+
<string>arm64e</string>
|
32
|
+
</array>
|
33
|
+
<key>SupportedPlatform</key>
|
34
|
+
<string>ios</string>
|
35
|
+
</dict>
|
36
|
+
</array>
|
37
|
+
<key>CFBundlePackageType</key>
|
38
|
+
<string>XFWK</string>
|
39
|
+
<key>XCFrameworkFormatVersion</key>
|
40
|
+
<string>1.0</string>
|
41
|
+
</dict>
|
42
|
+
</plist>
|
Binary file
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>AvailableLibraries</key>
|
6
|
+
<array>
|
7
|
+
<dict>
|
8
|
+
<key>LibraryIdentifier</key>
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
|
+
<key>LibraryPath</key>
|
11
|
+
<string>libsksg.a</string>
|
12
|
+
<key>SupportedArchitectures</key>
|
13
|
+
<array>
|
14
|
+
<string>arm64</string>
|
15
|
+
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
17
|
+
</array>
|
18
|
+
<key>SupportedPlatform</key>
|
19
|
+
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
22
|
+
</dict>
|
23
|
+
<dict>
|
24
|
+
<key>LibraryIdentifier</key>
|
25
|
+
<string>ios-arm64_arm64e</string>
|
26
|
+
<key>LibraryPath</key>
|
27
|
+
<string>libsksg.a</string>
|
28
|
+
<key>SupportedArchitectures</key>
|
29
|
+
<array>
|
30
|
+
<string>arm64</string>
|
31
|
+
<string>arm64e</string>
|
32
|
+
</array>
|
33
|
+
<key>SupportedPlatform</key>
|
34
|
+
<string>ios</string>
|
35
|
+
</dict>
|
36
|
+
</array>
|
37
|
+
<key>CFBundlePackageType</key>
|
38
|
+
<string>XFWK</string>
|
39
|
+
<key>XCFrameworkFormatVersion</key>
|
40
|
+
<string>1.0</string>
|
41
|
+
</dict>
|
42
|
+
</plist>
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskshaper.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
-
<string>x86_64</string>
|
17
16
|
</array>
|
18
17
|
<key>SupportedPlatform</key>
|
19
18
|
<string>ios</string>
|
20
|
-
<key>SupportedPlatformVariant</key>
|
21
|
-
<string>simulator</string>
|
22
19
|
</dict>
|
23
20
|
<dict>
|
24
21
|
<key>LibraryIdentifier</key>
|
25
|
-
<string>ios-
|
22
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
26
23
|
<key>LibraryPath</key>
|
27
24
|
<string>libskshaper.a</string>
|
28
25
|
<key>SupportedArchitectures</key>
|
29
26
|
<array>
|
30
27
|
<string>arm64</string>
|
31
28
|
<string>arm64e</string>
|
29
|
+
<string>x86_64</string>
|
32
30
|
</array>
|
33
31
|
<key>SupportedPlatform</key>
|
34
32
|
<string>ios</string>
|
33
|
+
<key>SupportedPlatformVariant</key>
|
34
|
+
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libsvg.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
16
17
|
</array>
|
17
18
|
<key>SupportedPlatform</key>
|
18
19
|
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
19
22
|
</dict>
|
20
23
|
<dict>
|
21
24
|
<key>LibraryIdentifier</key>
|
22
|
-
<string>ios-
|
25
|
+
<string>ios-arm64_arm64e</string>
|
23
26
|
<key>LibraryPath</key>
|
24
27
|
<string>libsvg.a</string>
|
25
28
|
<key>SupportedArchitectures</key>
|
26
29
|
<array>
|
27
30
|
<string>arm64</string>
|
28
31
|
<string>arm64e</string>
|
29
|
-
<string>x86_64</string>
|
30
32
|
</array>
|
31
33
|
<key>SupportedPlatform</key>
|
32
34
|
<string>ios</string>
|
33
|
-
<key>SupportedPlatformVariant</key>
|
34
|
-
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
8
8
|
},
|
9
9
|
"title": "React Native Skia",
|
10
|
-
"version": "0.1.
|
10
|
+
"version": "0.1.157",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"files": [
|
@@ -30,6 +30,8 @@
|
|
30
30
|
"libs/ios/libskia.xcframework",
|
31
31
|
"libs/ios/libskshaper.xcframework",
|
32
32
|
"libs/ios/libsvg.xcframework",
|
33
|
+
"libs/ios/libskottie.xcframework",
|
34
|
+
"libs/ios/libsksg.xcframework",
|
33
35
|
"react-native-skia.podspec",
|
34
36
|
"scripts/install-npm.js",
|
35
37
|
"scripts/setup-canvaskit.js",
|
@@ -65,8 +67,8 @@
|
|
65
67
|
"licenseFilename": "LICENSE.md",
|
66
68
|
"readmeFilename": "README.md",
|
67
69
|
"peerDependencies": {
|
68
|
-
"react": ">=
|
69
|
-
"react-native": ">=0.
|
70
|
+
"react": ">=18.0",
|
71
|
+
"react-native": ">=0.64",
|
70
72
|
"react-native-reanimated": ">=2.0.0"
|
71
73
|
},
|
72
74
|
"peerDependenciesMeta": {
|
@@ -77,7 +79,7 @@
|
|
77
79
|
"devDependencies": {
|
78
80
|
"@types/jest": "^28.1.6",
|
79
81
|
"@types/react-native": "0.66.2",
|
80
|
-
"@types/react-reconciler": "0.26.
|
82
|
+
"@types/react-reconciler": "^0.26.7",
|
81
83
|
"eslint": "8.21.0",
|
82
84
|
"eslint-config-react-native-wcandillon": "3.9.0",
|
83
85
|
"eslint-plugin-reanimated": "2.0.0",
|
@@ -89,8 +91,9 @@
|
|
89
91
|
"typescript": "4.8.3"
|
90
92
|
},
|
91
93
|
"dependencies": {
|
94
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
92
95
|
"canvaskit-wasm": "0.36.1",
|
93
|
-
"react-reconciler": "0.
|
96
|
+
"react-reconciler": "^0.27.0"
|
94
97
|
},
|
95
98
|
"eslintIgnore": [
|
96
99
|
"node_modules/",
|
@@ -101,7 +104,12 @@
|
|
101
104
|
"output": "lib",
|
102
105
|
"targets": [
|
103
106
|
"commonjs",
|
104
|
-
|
107
|
+
[
|
108
|
+
"module",
|
109
|
+
{
|
110
|
+
"configFile": "./.babelrc"
|
111
|
+
}
|
112
|
+
],
|
105
113
|
"typescript"
|
106
114
|
]
|
107
115
|
},
|
@@ -121,10 +121,15 @@ import { MorphologyImageFilterNode } from "./paint/ImageFilters";
|
|
121
121
|
import { GroupNode } from "./GroupNode";
|
122
122
|
import { PaintNode } from "./PaintNode";
|
123
123
|
import type { NodeContext } from "./Node";
|
124
|
+
import { LayerNode } from "./LayerNode";
|
124
125
|
|
125
126
|
export class JsiSkDOM implements SkDOM {
|
126
127
|
constructor(private ctx: NodeContext) {}
|
127
128
|
|
129
|
+
Layer(props?: ChildrenProps) {
|
130
|
+
return new LayerNode(this.ctx, props ?? {});
|
131
|
+
}
|
132
|
+
|
128
133
|
Group(props?: GroupProps) {
|
129
134
|
return new GroupNode(this.ctx, props ?? {});
|
130
135
|
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { DeclarationNode, DrawingContext, Node } from "../types";
|
2
|
+
import { NodeType } from "../types";
|
3
|
+
import type { ChildrenProps } from "../types/Common";
|
4
|
+
import type { SkPaint } from "../../skia";
|
5
|
+
|
6
|
+
import { JsiRenderNode } from "./RenderNode";
|
7
|
+
import type { NodeContext } from "./Node";
|
8
|
+
import { JsiDeclarationNode } from "./Node";
|
9
|
+
|
10
|
+
const isLayer = (
|
11
|
+
node: Node<unknown>
|
12
|
+
): node is DeclarationNode<unknown, SkPaint> =>
|
13
|
+
node instanceof JsiDeclarationNode && node.isPaint();
|
14
|
+
|
15
|
+
export class LayerNode extends JsiRenderNode<ChildrenProps> {
|
16
|
+
constructor(ctx: NodeContext, props: ChildrenProps) {
|
17
|
+
super(ctx, NodeType.Layer, props);
|
18
|
+
}
|
19
|
+
|
20
|
+
renderNode(ctx: DrawingContext): void {
|
21
|
+
const [layer, ...children] = this.children();
|
22
|
+
if (isLayer(layer)) {
|
23
|
+
const paint = layer.materialize() as SkPaint;
|
24
|
+
ctx.canvas.saveLayer(paint);
|
25
|
+
}
|
26
|
+
children.map((child) => {
|
27
|
+
if (child instanceof JsiRenderNode) {
|
28
|
+
child.render(ctx);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
if (isLayer(layer)) {
|
32
|
+
ctx.canvas.restore();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
package/src/dom/types/SkDOM.ts
CHANGED
@@ -76,6 +76,7 @@ type NullablePathEffectNode<P> = DeclarationNode<P, SkPathEffect, null>;
|
|
76
76
|
type DrawingNode<P extends GroupProps> = RenderNode<P>;
|
77
77
|
|
78
78
|
export interface SkDOM {
|
79
|
+
Layer(props?: ChildrenProps): RenderNode<ChildrenProps>;
|
79
80
|
Group(props?: GroupProps): RenderNode<GroupProps>;
|
80
81
|
Paint(props: PaintProps): DeclarationNode<PaintProps, SkPaint>;
|
81
82
|
|
package/src/renderer/Canvas.tsx
CHANGED
@@ -77,7 +77,17 @@ export const Canvas = forwardRef<SkiaView, CanvasProps>(
|
|
77
77
|
}, [redraw, registerValues]);
|
78
78
|
|
79
79
|
const root = useMemo(
|
80
|
-
() =>
|
80
|
+
() =>
|
81
|
+
skiaReconciler.createContainer(
|
82
|
+
container,
|
83
|
+
0,
|
84
|
+
null,
|
85
|
+
true,
|
86
|
+
null,
|
87
|
+
"",
|
88
|
+
console.error,
|
89
|
+
null
|
90
|
+
),
|
81
91
|
[container]
|
82
92
|
);
|
83
93
|
// Render effect
|
@@ -66,6 +66,7 @@ declare global {
|
|
66
66
|
namespace JSX {
|
67
67
|
interface IntrinsicElements {
|
68
68
|
skGroup: SkiaProps<GroupProps>;
|
69
|
+
skLayer: SkiaProps<ChildrenProps>;
|
69
70
|
skPaint: SkiaProps<PaintProps> & { ref: ForwardedRef<PaintNode> };
|
70
71
|
|
71
72
|
// Drawings
|
@@ -146,6 +147,8 @@ export const createNode = (
|
|
146
147
|
) => {
|
147
148
|
const { Sk } = container;
|
148
149
|
switch (type) {
|
150
|
+
case NodeType.Layer:
|
151
|
+
return Sk.Layer(props);
|
149
152
|
case NodeType.Group:
|
150
153
|
return Sk.Group(props);
|
151
154
|
case NodeType.Paint:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/*global NodeJS*/
|
2
2
|
import type { HostConfig } from "react-reconciler";
|
3
|
+
import { DefaultEventPriority } from "react-reconciler/constants";
|
3
4
|
|
4
5
|
import type { NodeType, Node } from "../dom/types";
|
5
6
|
import type { SkiaValue } from "../values";
|
@@ -67,7 +68,6 @@ export const skHostConfig: SkiaHostConfig = {
|
|
67
68
|
* This function is used by the reconciler in order to calculate current time for prioritising work.
|
68
69
|
*/
|
69
70
|
now: Date.now,
|
70
|
-
|
71
71
|
supportsMutation: true,
|
72
72
|
isPrimaryRenderer: false,
|
73
73
|
supportsPersistence: false,
|
@@ -232,6 +232,13 @@ export const skHostConfig: SkiaHostConfig = {
|
|
232
232
|
insertBefore: (parent, child, before) => {
|
233
233
|
insertBefore(parent, child, before);
|
234
234
|
},
|
235
|
+
// see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
236
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
237
|
+
// @ts-expect-error
|
238
|
+
getCurrentEventPriority: () => DefaultEventPriority,
|
239
|
+
beforeActiveInstanceBlur: () => {},
|
240
|
+
afterActiveInstanceBlur: () => {},
|
241
|
+
detachDeletedInstance: () => {},
|
235
242
|
};
|
236
243
|
|
237
244
|
const materialize = <P>(props: AnimatedProps<P>) => {
|
@@ -1,8 +1,21 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { isValidElement } from "react";
|
2
2
|
|
3
3
|
import type { SkiaProps } from "../processors";
|
4
4
|
import type { GroupProps } from "../../dom/types";
|
5
|
+
import type { ChildrenProps } from "../../dom/types/Common";
|
5
6
|
|
6
|
-
export
|
7
|
-
|
7
|
+
export interface PublicGroupProps extends Omit<GroupProps, "layer"> {
|
8
|
+
layer?: GroupProps["layer"] | ChildrenProps["children"];
|
9
|
+
}
|
10
|
+
|
11
|
+
export const Group = ({ layer, ...props }: SkiaProps<PublicGroupProps>) => {
|
12
|
+
if (isValidElement(layer) && typeof layer === "object") {
|
13
|
+
return (
|
14
|
+
<skLayer>
|
15
|
+
{layer}
|
16
|
+
<skGroup {...props} />
|
17
|
+
</skLayer>
|
18
|
+
);
|
19
|
+
}
|
20
|
+
return <skGroup layer={layer as GroupProps["layer"]} {...props} />;
|
8
21
|
};
|
@@ -1,10 +1,16 @@
|
|
1
|
+
/* eslint-disable max-len */
|
1
2
|
import React, { useRef, forwardRef } from "react";
|
2
3
|
|
3
4
|
import type { SkiaProps } from "../processors";
|
4
5
|
import type { DrawingNodeProps } from "../../dom/types";
|
5
6
|
import type { PaintNode } from "../../dom/nodes/PaintNode";
|
6
7
|
|
7
|
-
export const usePaintRef = () =>
|
8
|
+
export const usePaintRef = () => {
|
9
|
+
console.log(`usePaintRef() is now deprecated.
|
10
|
+
If you are using the layer property, simply pass the component directly: https://shopify.github.io/react-native-skia/docs/group#layer-effects.
|
11
|
+
If you are using the paint property, please the following paint properties directly: https://shopify.github.io/react-native-skia/docs/paint/overview`);
|
12
|
+
return useRef<PaintNode>(null);
|
13
|
+
};
|
8
14
|
|
9
15
|
export const Paint = forwardRef<PaintNode, SkiaProps<DrawingNodeProps>>(
|
10
16
|
(props, ref) => {
|
@@ -5,17 +5,16 @@ import type { SkRect } from "../skia/types";
|
|
5
5
|
import type { SkiaValue } from "../values";
|
6
6
|
|
7
7
|
import { SkiaViewApi } from "./api";
|
8
|
+
import { SkiaViewNativeId } from "./SkiaView";
|
8
9
|
import type { NativeSkiaViewProps, SkiaPictureViewProps } from "./types";
|
9
10
|
|
10
|
-
let SkiaViewNativeId = 1000;
|
11
|
-
|
12
11
|
const NativeSkiaPictureView =
|
13
12
|
requireNativeComponent<NativeSkiaViewProps>("SkiaPictureView");
|
14
13
|
|
15
14
|
export class SkiaPictureView extends React.Component<SkiaPictureViewProps> {
|
16
15
|
constructor(props: SkiaPictureViewProps) {
|
17
16
|
super(props);
|
18
|
-
this._nativeId = SkiaViewNativeId++;
|
17
|
+
this._nativeId = SkiaViewNativeId.current++;
|
19
18
|
const { picture } = props;
|
20
19
|
if (picture) {
|
21
20
|
assertSkiaViewApi();
|
package/src/views/SkiaView.tsx
CHANGED
@@ -7,7 +7,7 @@ import type { SkiaValue } from "../values";
|
|
7
7
|
import { SkiaViewApi } from "./api";
|
8
8
|
import type { NativeSkiaViewProps, SkiaDrawViewProps } from "./types";
|
9
9
|
|
10
|
-
|
10
|
+
export const SkiaViewNativeId = { current: 1000 };
|
11
11
|
|
12
12
|
const NativeSkiaView =
|
13
13
|
requireNativeComponent<NativeSkiaViewProps>("SkiaDrawView");
|
@@ -15,7 +15,7 @@ const NativeSkiaView =
|
|
15
15
|
export class SkiaView extends React.Component<SkiaDrawViewProps> {
|
16
16
|
constructor(props: SkiaDrawViewProps) {
|
17
17
|
super(props);
|
18
|
-
this._nativeId = SkiaViewNativeId++;
|
18
|
+
this._nativeId = SkiaViewNativeId.current++;
|
19
19
|
const { onDraw } = props;
|
20
20
|
if (onDraw) {
|
21
21
|
assertSkiaViewApi();
|