@shopify/react-native-skia 2.13.0 → 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.
Files changed (124) hide show
  1. package/android/CMakeLists.txt +2 -0
  2. package/android/cpp/jni/include/JniSkiaPictureView.h +16 -15
  3. package/android/cpp/rnskia-android/OpenGLContext.h +1 -1
  4. package/android/cpp/rnskia-android/gl/Surface.h +1 -1
  5. package/apple/RNSkApplePlatformContext.h +3 -4
  6. package/apple/RNSkiaModule.h +11 -3
  7. package/apple/RNSkiaModule.mm +46 -19
  8. package/apple/SkiaPictureView.mm +2 -2
  9. package/apple/SkiaUIView.h +0 -1
  10. package/apple/SkiaUIView.mm +1 -1
  11. package/apple/ViewScreenshotService.h +2 -2
  12. package/apple/ViewScreenshotService.mm +5 -4
  13. package/cpp/api/JsiSkImage.h +1 -1
  14. package/cpp/api/JsiSkImageFilter.h +3 -1
  15. package/cpp/api/JsiSkParagraph.h +2 -1
  16. package/cpp/api/JsiSkParagraphBuilder.h +1 -1
  17. package/cpp/api/JsiSkParagraphBuilderFactory.h +1 -1
  18. package/cpp/api/JsiSkPath.h +11 -435
  19. package/cpp/api/JsiSkPathBuilder.h +11 -4
  20. package/cpp/api/JsiSkPictureRecorder.h +2 -1
  21. package/cpp/api/JsiSkShader.h +3 -1
  22. package/cpp/api/JsiSkSkottie.h +29 -28
  23. package/cpp/api/JsiSkStrutStyle.h +1 -1
  24. package/cpp/api/JsiSkSurfaceFactory.h +41 -0
  25. package/cpp/api/recorder/Command.h +1 -1
  26. package/cpp/api/recorder/Convertor.h +153 -132
  27. package/cpp/api/recorder/DataTypes.h +12 -12
  28. package/cpp/api/recorder/DrawingCtx.h +1 -1
  29. package/cpp/api/recorder/ImageFit.h +8 -5
  30. package/cpp/api/recorder/JsiRecorder.h +14 -31
  31. package/cpp/api/recorder/Paint.h +3 -3
  32. package/cpp/api/recorder/RNRecorder.h +56 -0
  33. package/cpp/api/third_party/base64.cpp +1 -1
  34. package/cpp/jsi/JSICache.cpp +23 -0
  35. package/cpp/jsi/JSICache.h +28 -1
  36. package/cpp/jsi/NativeObject.h +36 -7
  37. package/cpp/jsi/ViewProperty.cpp +23 -0
  38. package/cpp/jsi/ViewProperty.h +31 -10
  39. package/cpp/rnskia/RNDawnContext.h +34 -1
  40. package/cpp/rnskia/RNSkJsiViewApi.h +69 -2
  41. package/cpp/rnskia/RNSkPictureView.cpp +58 -0
  42. package/cpp/rnskia/RNSkPictureView.h +110 -24
  43. package/lib/commonjs/Platform/IPlatform.js.map +1 -1
  44. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  45. package/lib/commonjs/animation/functions/interpolatePaths.js +18 -0
  46. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  47. package/lib/commonjs/skia/core/Image.js.map +1 -1
  48. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  49. package/lib/commonjs/skia/types/Path/Path.d.ts +2 -336
  50. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  51. package/lib/commonjs/skia/types/Recorder.d.ts +10 -0
  52. package/lib/commonjs/skia/types/Recorder.js.map +1 -1
  53. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  54. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  55. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  56. package/lib/commonjs/skia/web/JsiSkPath.d.ts +4 -38
  57. package/lib/commonjs/skia/web/JsiSkPath.js +3 -275
  58. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  59. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  60. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +3 -0
  61. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  62. package/lib/commonjs/sksg/Container.native.d.ts +15 -1
  63. package/lib/commonjs/sksg/Container.native.js +34 -33
  64. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  65. package/lib/commonjs/specs/NativeSkiaModule.web.js +4 -0
  66. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  67. package/lib/commonjs/views/types.d.ts +9 -0
  68. package/lib/commonjs/views/types.js.map +1 -1
  69. package/lib/module/Platform/IPlatform.js.map +1 -1
  70. package/lib/module/animation/functions/interpolate.js.map +1 -1
  71. package/lib/module/animation/functions/interpolatePaths.js +18 -0
  72. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  73. package/lib/module/skia/core/Image.js.map +1 -1
  74. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  75. package/lib/module/skia/types/Path/Path.d.ts +2 -336
  76. package/lib/module/skia/types/Path/Path.js.map +1 -1
  77. package/lib/module/skia/types/Recorder.d.ts +10 -0
  78. package/lib/module/skia/types/Recorder.js.map +1 -1
  79. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  80. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  81. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  82. package/lib/module/skia/web/JsiSkPath.d.ts +4 -38
  83. package/lib/module/skia/web/JsiSkPath.js +4 -276
  84. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  85. package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  86. package/lib/module/skia/web/JsiSkSurfaceFactory.js +4 -1
  87. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  88. package/lib/module/sksg/Container.native.d.ts +15 -1
  89. package/lib/module/sksg/Container.native.js +34 -33
  90. package/lib/module/sksg/Container.native.js.map +1 -1
  91. package/lib/module/specs/NativeSkiaModule.web.js +4 -0
  92. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  93. package/lib/module/views/types.d.ts +9 -0
  94. package/lib/module/views/types.js.map +1 -1
  95. package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -35
  96. package/lib/typescript/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
  97. package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +15 -1
  98. package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +3 -37
  99. package/lib/typescript/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
  100. package/lib/typescript/lib/module/sksg/Container.native.d.ts +15 -1
  101. package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -336
  102. package/lib/typescript/src/skia/types/Recorder.d.ts +10 -0
  103. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  104. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +4 -38
  105. package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  106. package/lib/typescript/src/sksg/Container.native.d.ts +15 -1
  107. package/lib/typescript/src/views/types.d.ts +9 -0
  108. package/package.json +2 -2
  109. package/src/Platform/IPlatform.ts +1 -4
  110. package/src/animation/functions/interpolate.ts +1 -4
  111. package/src/animation/functions/interpolatePaths.ts +24 -0
  112. package/src/skia/core/Image.ts +1 -2
  113. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +2 -5
  114. package/src/skia/types/Path/Path.ts +2 -420
  115. package/src/skia/types/Recorder.ts +10 -0
  116. package/src/skia/types/Shader/Shader.ts +1 -5
  117. package/src/skia/types/Surface/SurfaceFactory.ts +17 -0
  118. package/src/skia/web/JsiSkPath.ts +4 -495
  119. package/src/skia/web/JsiSkSurfaceFactory.ts +6 -2
  120. package/src/sksg/Container.native.ts +34 -37
  121. package/src/specs/NativeSkiaModule.web.ts +4 -0
  122. package/src/views/types.ts +13 -0
  123. package/apple/SkiaManager.h +0 -23
  124. package/apple/SkiaManager.mm +0 -63
@@ -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;
@@ -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
@@ -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