@shopify/react-native-skia 2.13.1 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +2 -0
- package/android/cpp/jni/include/JniSkiaPictureView.h +16 -15
- package/apple/RNSkApplePlatformContext.h +3 -4
- package/apple/RNSkiaModule.h +11 -3
- package/apple/RNSkiaModule.mm +46 -19
- package/apple/SkiaPictureView.mm +2 -2
- package/apple/SkiaUIView.h +0 -1
- package/apple/SkiaUIView.mm +1 -1
- package/apple/ViewScreenshotService.h +2 -2
- package/apple/ViewScreenshotService.mm +5 -4
- package/cpp/api/JsiSkPath.h +0 -431
- package/cpp/api/JsiSkSkottie.h +2 -3
- package/cpp/api/JsiSkStrutStyle.h +1 -1
- package/cpp/api/JsiSkSurfaceFactory.h +41 -0
- package/cpp/api/recorder/Convertor.h +152 -131
- package/cpp/api/recorder/DataTypes.h +11 -11
- package/cpp/api/recorder/ImageFit.h +8 -5
- package/cpp/api/recorder/JsiRecorder.h +9 -29
- package/cpp/api/recorder/Paint.h +3 -3
- package/cpp/api/recorder/RNRecorder.h +56 -0
- package/cpp/jsi/ViewProperty.cpp +23 -0
- package/cpp/jsi/ViewProperty.h +31 -10
- package/cpp/rnskia/RNDawnContext.h +33 -0
- package/cpp/rnskia/RNSkJsiViewApi.h +69 -2
- package/cpp/rnskia/RNSkPictureView.cpp +58 -0
- package/cpp/rnskia/RNSkPictureView.h +110 -24
- package/lib/commonjs/Platform/IPlatform.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -336
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/Recorder.d.ts +10 -0
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/commonjs/skia/web/JsiSkPath.js +3 -275
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +3 -0
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.d.ts +15 -1
- package/lib/commonjs/sksg/Container.native.js +34 -33
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js +4 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +9 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/Platform/IPlatform.js.map +1 -1
- package/lib/module/animation/functions/interpolate.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -336
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/Recorder.d.ts +10 -0
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/module/skia/web/JsiSkPath.js +4 -276
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +4 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/sksg/Container.native.d.ts +15 -1
- package/lib/module/sksg/Container.native.js +34 -33
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.js +4 -0
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/views/types.d.ts +9 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -35
- package/lib/typescript/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +3 -37
- package/lib/typescript/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -336
- package/lib/typescript/src/skia/types/Recorder.d.ts +10 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/typescript/src/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/src/views/types.d.ts +9 -0
- package/package.json +2 -2
- package/src/Platform/IPlatform.ts +1 -4
- package/src/animation/functions/interpolate.ts +1 -4
- package/src/skia/core/Image.ts +1 -2
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +2 -5
- package/src/skia/types/Path/Path.ts +2 -420
- package/src/skia/types/Recorder.ts +10 -0
- package/src/skia/types/Shader/Shader.ts +1 -5
- package/src/skia/types/Surface/SurfaceFactory.ts +17 -0
- package/src/skia/web/JsiSkPath.ts +4 -495
- package/src/skia/web/JsiSkSurfaceFactory.ts +6 -2
- package/src/sksg/Container.native.ts +34 -37
- package/src/specs/NativeSkiaModule.web.ts +4 -0
- package/src/views/types.ts +13 -0
- package/apple/SkiaManager.h +0 -23
- package/apple/SkiaManager.mm +0 -63
package/src/views/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ViewProps } from "react-native";
|
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
3
|
|
|
3
4
|
import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
|
|
4
5
|
|
|
@@ -27,6 +28,18 @@ export interface ISkiaViewApi {
|
|
|
27
28
|
web?: boolean;
|
|
28
29
|
setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
|
|
29
30
|
requestRedraw: (nativeId: number) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Reads the shared values into the recording held for the view and
|
|
33
|
+
* schedules a redraw. Native only; called from a worklet on every frame.
|
|
34
|
+
* Until the view registers, the recording is queued for it and kept
|
|
35
|
+
* current all the same. Ignored when the recording `recorderId` is neither
|
|
36
|
+
* held by the view nor queued for it.
|
|
37
|
+
*/
|
|
38
|
+
applyUpdates: (
|
|
39
|
+
nativeId: number,
|
|
40
|
+
recorderId: number,
|
|
41
|
+
values: SharedValue<unknown>[]
|
|
42
|
+
) => void;
|
|
30
43
|
makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
|
|
31
44
|
makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
|
|
32
45
|
size: (nativeId: number) => SkSize;
|
package/apple/SkiaManager.h
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#import <React/RCTBridge.h>
|
|
4
|
-
|
|
5
|
-
#import "RNSkManager.h"
|
|
6
|
-
|
|
7
|
-
@interface SkiaManager : NSObject
|
|
8
|
-
|
|
9
|
-
- (std::shared_ptr<RNSkia::RNSkManager>)skManager;
|
|
10
|
-
|
|
11
|
-
- (instancetype)init NS_UNAVAILABLE;
|
|
12
|
-
|
|
13
|
-
- (void)invalidate;
|
|
14
|
-
|
|
15
|
-
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
16
|
-
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)
|
|
17
|
-
jsInvoker;
|
|
18
|
-
|
|
19
|
-
// Fabric components do not have a better way to interact with TurboModules.
|
|
20
|
-
// Workaround to get the SkManager instance from singleton.
|
|
21
|
-
+ (std::shared_ptr<RNSkia::RNSkManager>)latestActiveSkManager;
|
|
22
|
-
|
|
23
|
-
@end
|
package/apple/SkiaManager.mm
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#import "SkiaManager.h"
|
|
2
|
-
|
|
3
|
-
#import <Foundation/Foundation.h>
|
|
4
|
-
|
|
5
|
-
#import <React/RCTBridge.h>
|
|
6
|
-
#import <React/RCTUIManager.h>
|
|
7
|
-
|
|
8
|
-
#import "RNSkApplePlatformContext.h"
|
|
9
|
-
|
|
10
|
-
// Forward-declared runtime accessor satisfied by RCTBridgeProxy (bridgeless).
|
|
11
|
-
// Avoids referencing RCTCxxBridge, which is compiled out when
|
|
12
|
-
// RCT_REMOVE_LEGACY_ARCH is set (React Native 0.82+).
|
|
13
|
-
@interface RCTBridge (RNSkiaRuntime)
|
|
14
|
-
- (void *)runtime;
|
|
15
|
-
@end
|
|
16
|
-
|
|
17
|
-
static __weak SkiaManager *sharedInstance = nil;
|
|
18
|
-
|
|
19
|
-
@implementation SkiaManager {
|
|
20
|
-
std::shared_ptr<RNSkia::RNSkManager> _skManager;
|
|
21
|
-
__weak RCTBridge *weakBridge;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
- (std::shared_ptr<RNSkia::RNSkManager>)skManager {
|
|
25
|
-
return _skManager;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
- (void)invalidate {
|
|
29
|
-
_skManager = nullptr;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
33
|
-
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)
|
|
34
|
-
jsInvoker {
|
|
35
|
-
self = [super init];
|
|
36
|
-
if (self) {
|
|
37
|
-
sharedInstance = self;
|
|
38
|
-
if (bridge.runtime) {
|
|
39
|
-
facebook::jsi::Runtime *jsRuntime =
|
|
40
|
-
(facebook::jsi::Runtime *)bridge.runtime;
|
|
41
|
-
|
|
42
|
-
// Create the RNSkiaManager (cross platform)
|
|
43
|
-
_skManager = std::make_shared<RNSkia::RNSkManager>(
|
|
44
|
-
jsRuntime, jsInvoker,
|
|
45
|
-
std::make_shared<RNSkia::RNSkApplePlatformContext>(bridge,
|
|
46
|
-
jsInvoker));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return self;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
- (void)dealloc {
|
|
53
|
-
sharedInstance = nil;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
+ (std::shared_ptr<RNSkia::RNSkManager>)latestActiveSkManager {
|
|
57
|
-
if (sharedInstance != nil) {
|
|
58
|
-
return [sharedInstance skManager];
|
|
59
|
-
}
|
|
60
|
-
return nullptr;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@end
|