@shopify/react-native-skia 2.12.0-next.1 → 2.13.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 (295) hide show
  1. package/LICENSE.md +2 -1
  2. package/Package.swift +117 -0
  3. package/android/CMakeLists.txt +23 -179
  4. package/android/build.gradle +40 -209
  5. package/android/cpp/jni/JniSkiaManager.cpp +3 -45
  6. package/android/cpp/jni/include/JniPlatformContext.h +1 -1
  7. package/android/cpp/jni/include/JniSkiaBaseView.h +18 -11
  8. package/android/cpp/jni/include/JniSkiaManager.h +3 -4
  9. package/android/cpp/jni/include/JniSkiaPictureView.h +5 -5
  10. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -10
  11. package/android/cpp/rnskia-android/RNSkAndroidView.h +6 -6
  12. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
  13. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  14. package/android/src/main/AndroidManifest.xml +1 -1
  15. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/PlatformContext.java +1 -1
  16. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkVideo.java +1 -1
  17. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkiaModule.java +1 -8
  18. package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +57 -0
  19. package/android/src/main/java/com/reactnative/skia/SkiaBaseView.java +185 -0
  20. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaBaseViewManager.java +20 -1
  21. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaManager.java +11 -6
  22. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureView.java +3 -3
  23. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureViewManager.java +1 -1
  24. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaSurfaceView.java +13 -3
  25. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaTextureView.java +5 -3
  26. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaViewAPI.java +1 -1
  27. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/ViewScreenshotService.java +10 -13
  28. package/apple/MetalContext.mm +1 -1
  29. package/apple/RNSkApplePlatformContext.h +0 -3
  30. package/apple/RNSkApplePlatformContext.mm +0 -11
  31. package/apple/RNSkiaModule.h +1 -10
  32. package/apple/RNSkiaModule.mm +2 -10
  33. package/apple/SkiaManager.h +0 -2
  34. package/apple/SkiaManager.mm +4 -6
  35. package/apple/SkiaPictureView.h +2 -2
  36. package/apple/SkiaPictureView.mm +0 -4
  37. package/apple/SkiaUIView.h +3 -18
  38. package/apple/SkiaUIView.mm +0 -30
  39. package/cpp/api/CustomBlendModes.h +17 -0
  40. package/cpp/api/JsiSkApi.h +0 -6
  41. package/cpp/api/JsiSkCanvas.h +19 -10
  42. package/cpp/api/JsiSkFont.h +5 -10
  43. package/cpp/api/JsiSkMatrix.h +4 -2
  44. package/cpp/api/JsiSkSVGFactory.h +4 -0
  45. package/cpp/api/recorder/Convertor.h +5 -2
  46. package/cpp/api/recorder/Drawings.h +13 -3
  47. package/cpp/api/recorder/ImageFilters.h +15 -1
  48. package/cpp/api/recorder/Paint.h +8 -1
  49. package/cpp/jsi/JSICache.cpp +99 -0
  50. package/cpp/jsi/JSICache.h +90 -0
  51. package/cpp/jsi/NativeObject.h +38 -87
  52. package/cpp/jsi/ViewProperty.h +0 -28
  53. package/cpp/rnskia/RNDawnContext.h +2 -1
  54. package/cpp/rnskia/RNDawnWindowContext.h +22 -0
  55. package/cpp/rnskia/RNSkManager.cpp +0 -6
  56. package/cpp/rnskia/RNSkPlatformContext.h +0 -3
  57. package/cpp/skia/include/core/RasterContext.h +25 -0
  58. package/cpp/skia/include/core/SkCanvas.h +0 -1
  59. package/cpp/skia/include/core/SkContext.h +62 -0
  60. package/cpp/skia/include/core/SkContextOptions.h +15 -0
  61. package/cpp/skia/include/core/SkMilestone.h +1 -1
  62. package/cpp/skia/include/core/SkPicture.h +36 -18
  63. package/cpp/skia/include/core/SkRecorder.h +8 -0
  64. package/cpp/skia/include/core/SkSerialProcs.h +2 -6
  65. package/cpp/skia/include/effects/SkImageFilters.h +15 -2
  66. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +73 -47
  67. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +7 -4
  68. package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +12 -0
  69. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +11 -0
  70. package/cpp/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +11 -0
  71. package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +13 -0
  72. package/cpp/skia/include/gpu/graphite/ContextOptions.h +6 -0
  73. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +5 -4
  74. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +9 -1
  75. package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
  76. package/cpp/skia/include/gpu/graphite/Recording.h +3 -0
  77. package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +8 -0
  78. package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +11 -0
  79. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +11 -0
  80. package/cpp/skia/include/private/SkLog.h +1 -19
  81. package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +2 -1
  82. package/cpp/skia/include/utils/SkLogHandler.h +53 -0
  83. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -0
  84. package/cpp/skia/modules/skcms/src/Transform_inl.h +9 -10
  85. package/cpp/skia/modules/skcms/src/skcms_internals.h +8 -3
  86. package/cpp/skia/modules/skottie/include/SkottieProperty.h +2 -0
  87. package/cpp/skia/modules/skottie/include/TextShaper.h +1 -0
  88. package/cpp/skia/modules/skshaper/include/SkShaper.h +23 -1
  89. package/include/ReactNativeSkia.h +6 -0
  90. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  91. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  92. package/lib/commonjs/external/reanimated/useVideo.js +8 -2
  93. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  94. package/lib/commonjs/mock/index.js +0 -1
  95. package/lib/commonjs/mock/index.js.map +1 -1
  96. package/lib/commonjs/renderer/Canvas.d.ts +11 -3
  97. package/lib/commonjs/renderer/Canvas.js +8 -6
  98. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  99. package/lib/commonjs/renderer/components/Mask.js +3 -9
  100. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  101. package/lib/commonjs/skia/types/JsiInstance.d.ts +1 -0
  102. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  103. package/lib/commonjs/skia/types/Matrix4.js +7 -2
  104. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  105. package/lib/commonjs/skia/types/Skia.d.ts +1 -6
  106. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  107. package/lib/commonjs/skia/web/JsiSkCanvas.js +12 -7
  108. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  109. package/lib/commonjs/skia/web/JsiSkImage.js +6 -3
  110. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  111. package/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
  112. package/lib/commonjs/skia/web/JsiSkPathBuilder.js +2 -2
  113. package/lib/commonjs/skia/web/JsiSkPathBuilder.js.map +1 -1
  114. package/lib/commonjs/skia/web/JsiSkTextStyle.js +5 -5
  115. package/lib/commonjs/skia/web/JsiSkTextStyle.js.map +1 -1
  116. package/lib/commonjs/skia/web/JsiSkia.js +0 -3
  117. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  118. package/lib/commonjs/skia/web/JsiSkottieAnimation.js +8 -8
  119. package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -1
  120. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
  121. package/lib/commonjs/sksg/Recorder/DrawingContext.js +15 -0
  122. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -1
  123. package/lib/commonjs/sksg/Recorder/Player.js +1 -1
  124. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  125. package/lib/commonjs/sksg/Recorder/Visitor.js +6 -1
  126. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  127. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +12 -9
  128. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  129. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +15 -1
  130. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  131. package/lib/commonjs/sksg/Recorder/commands/Shaders.js +1 -1
  132. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  133. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  134. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  135. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  136. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +3 -0
  137. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
  138. package/lib/commonjs/views/SkiaPictureView.js +2 -12
  139. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  140. package/lib/commonjs/views/SkiaPictureView.web.js +247 -57
  141. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  142. package/lib/commonjs/views/types.d.ts +19 -8
  143. package/lib/commonjs/views/types.js.map +1 -1
  144. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  145. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  146. package/lib/module/external/reanimated/useVideo.js +8 -2
  147. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  148. package/lib/module/mock/index.js +0 -1
  149. package/lib/module/mock/index.js.map +1 -1
  150. package/lib/module/renderer/Canvas.d.ts +11 -3
  151. package/lib/module/renderer/Canvas.js +7 -5
  152. package/lib/module/renderer/Canvas.js.map +1 -1
  153. package/lib/module/renderer/components/Mask.js +3 -9
  154. package/lib/module/renderer/components/Mask.js.map +1 -1
  155. package/lib/module/skia/types/JsiInstance.d.ts +1 -0
  156. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  157. package/lib/module/skia/types/Matrix4.js +7 -2
  158. package/lib/module/skia/types/Matrix4.js.map +1 -1
  159. package/lib/module/skia/types/Skia.d.ts +1 -6
  160. package/lib/module/skia/types/Skia.js.map +1 -1
  161. package/lib/module/skia/web/JsiSkCanvas.js +12 -7
  162. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  163. package/lib/module/skia/web/JsiSkImage.js +6 -3
  164. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  165. package/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
  166. package/lib/module/skia/web/JsiSkPathBuilder.js +2 -2
  167. package/lib/module/skia/web/JsiSkPathBuilder.js.map +1 -1
  168. package/lib/module/skia/web/JsiSkTextStyle.js +5 -5
  169. package/lib/module/skia/web/JsiSkTextStyle.js.map +1 -1
  170. package/lib/module/skia/web/JsiSkia.js +0 -3
  171. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  172. package/lib/module/skia/web/JsiSkottieAnimation.js +8 -8
  173. package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -1
  174. package/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
  175. package/lib/module/sksg/Recorder/DrawingContext.js +15 -0
  176. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -1
  177. package/lib/module/sksg/Recorder/Player.js +1 -1
  178. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  179. package/lib/module/sksg/Recorder/Visitor.js +6 -1
  180. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  181. package/lib/module/sksg/Recorder/commands/Drawing.js +12 -9
  182. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  183. package/lib/module/sksg/Recorder/commands/ImageFilters.js +15 -1
  184. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  185. package/lib/module/sksg/Recorder/commands/Shaders.js +1 -1
  186. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  187. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  188. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  189. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  190. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +3 -0
  191. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
  192. package/lib/module/views/SkiaPictureView.js +2 -12
  193. package/lib/module/views/SkiaPictureView.js.map +1 -1
  194. package/lib/module/views/SkiaPictureView.web.js +247 -57
  195. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  196. package/lib/module/views/types.d.ts +19 -8
  197. package/lib/module/views/types.js.map +1 -1
  198. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  199. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
  200. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
  201. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +0 -1
  202. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
  203. package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  204. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  205. package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -2
  206. package/lib/typescript/lib/module/skia/Skia.web.d.ts +0 -1
  207. package/lib/typescript/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
  208. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +0 -1
  209. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
  210. package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  211. package/lib/typescript/react-native.config.d.ts +3 -0
  212. package/lib/typescript/src/renderer/Canvas.d.ts +11 -3
  213. package/lib/typescript/src/skia/types/JsiInstance.d.ts +1 -0
  214. package/lib/typescript/src/skia/types/Skia.d.ts +1 -6
  215. package/lib/typescript/src/skia/web/JsiSkPathBuilder.d.ts +1 -1
  216. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +1 -0
  217. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  218. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  219. package/lib/typescript/src/views/types.d.ts +19 -8
  220. package/package.json +15 -12
  221. package/react-native-skia.podspec +4 -10
  222. package/react-native.config.js +5 -0
  223. package/src/dom/nodes/datatypes/Rect.ts +6 -1
  224. package/src/external/reanimated/useVideo.ts +7 -2
  225. package/src/mock/index.ts +0 -1
  226. package/src/renderer/Canvas.tsx +23 -5
  227. package/src/renderer/components/Mask.tsx +10 -3
  228. package/src/skia/types/JsiInstance.ts +2 -0
  229. package/src/skia/types/Matrix4.ts +6 -2
  230. package/src/skia/types/Skia.ts +1 -7
  231. package/src/skia/web/JsiSkCanvas.ts +22 -12
  232. package/src/skia/web/JsiSkImage.ts +6 -3
  233. package/src/skia/web/JsiSkPathBuilder.ts +2 -2
  234. package/src/skia/web/JsiSkTextStyle.ts +20 -15
  235. package/src/skia/web/JsiSkia.ts +0 -4
  236. package/src/skia/web/JsiSkottieAnimation.ts +8 -8
  237. package/src/sksg/Recorder/DrawingContext.ts +15 -0
  238. package/src/sksg/Recorder/Player.ts +1 -1
  239. package/src/sksg/Recorder/Visitor.ts +9 -6
  240. package/src/sksg/Recorder/commands/Drawing.ts +12 -9
  241. package/src/sksg/Recorder/commands/ImageFilters.ts +20 -1
  242. package/src/sksg/Recorder/commands/Shaders.ts +1 -1
  243. package/src/specs/SkiaPictureViewNativeComponent.ts +5 -0
  244. package/src/specs/SkiaPictureViewNativeComponent.web.ts +5 -0
  245. package/src/views/SkiaPictureView.tsx +2 -10
  246. package/src/views/SkiaPictureView.web.tsx +245 -57
  247. package/src/views/types.ts +23 -10
  248. package/android/src/latest/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -11
  249. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +0 -79
  250. package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +0 -113
  251. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -136
  252. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +0 -41
  253. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +0 -20
  254. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +0 -35
  255. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +0 -17
  256. package/android/src/paper/java/com/shopify/reactnative/skia/NativeSkiaModuleSpec.java +0 -38
  257. package/android/src/reactnative74/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -14
  258. package/apple/SkiaPictureViewManager.h +0 -8
  259. package/apple/SkiaPictureViewManager.mm +0 -60
  260. package/apple/SkiaWebGPUView.h +0 -20
  261. package/apple/WebGPUMetalView.h +0 -12
  262. package/cpp/api/JsiSkiaContext.h +0 -94
  263. package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
  264. package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
  265. package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
  266. package/cpp/dawn/include/dawn/dawn_version.h +0 -41
  267. package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
  268. package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -103
  269. package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
  270. package/cpp/dawn/include/dawn/native/DawnNative.h +0 -368
  271. package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
  272. package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
  273. package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
  274. package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
  275. package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
  276. package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
  277. package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -207
  278. package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
  279. package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
  280. package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
  281. package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2856
  282. package/cpp/dawn/include/tint/tint.h +0 -91
  283. package/cpp/dawn/include/webgpu/webgpu.h +0 -5029
  284. package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10353
  285. package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
  286. package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -162
  287. package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
  288. package/cpp/jsi/RuntimeAwareCache.cpp +0 -7
  289. package/cpp/jsi/RuntimeAwareCache.h +0 -117
  290. package/cpp/jsi/RuntimeLifecycleMonitor.cpp +0 -72
  291. package/cpp/jsi/RuntimeLifecycleMonitor.h +0 -32
  292. package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
  293. package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
  294. package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
  295. package/libs/.graphite +0 -1
@@ -1,11 +1,23 @@
1
1
  import type { ViewProps } from "react-native";
2
- import type { SharedValue } from "react-native-reanimated";
3
- import type { Node } from "../dom/types";
4
2
  import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
5
3
  export type NativeSkiaViewProps = ViewProps & {
6
4
  debug?: boolean;
7
5
  opaque?: boolean;
8
6
  };
7
+ export type AndroidSurfaceType = "SurfaceView" | "TextureView";
8
+ export interface AndroidCanvasProps {
9
+ /**
10
+ * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to
11
+ * `TextureView` otherwise; both composite correctly in React Native stacking
12
+ * order without further flags.
13
+ */
14
+ surfaceType?: AndroidSurfaceType;
15
+ /**
16
+ * SurfaceView only: composite above every React Native view in the window,
17
+ * ignoring `zIndex`. Ignored for TextureView. Defaults to false.
18
+ */
19
+ zOrderOnTop?: boolean;
20
+ }
9
21
  export interface ISkiaViewApi {
10
22
  web?: boolean;
11
23
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
@@ -21,10 +33,10 @@ export interface SkiaBaseViewProps extends ViewProps {
21
33
  */
22
34
  debug?: boolean;
23
35
  /**
24
- * Pass an animated value to the onSize property to get updates when
25
- * the Skia view is resized.
36
+ * Declares that the canvas covers every pixel of its bounds. On Android an
37
+ * opaque canvas is backed by a `SurfaceView` by default, the cheapest path
38
+ * (see `android.surfaceType`). Defaults to false.
26
39
  */
27
- onSize?: SharedValue<SkSize>;
28
40
  opaque?: boolean;
29
41
  /**
30
42
  * Renders into a surface with more than 8 bits per channel (16-bit float on
@@ -32,12 +44,11 @@ export interface SkiaBaseViewProps extends ViewProps {
32
44
  * the extra precision survives composition only when combined with `opaque`.
33
45
  */
34
46
  highBitDepth?: boolean;
47
+ /** Android-only rendering options. Ignored on iOS and web. */
48
+ android?: AndroidCanvasProps;
35
49
  __destroyWebGLContextAfterRender?: boolean;
36
50
  }
37
51
  export interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {
38
52
  picture?: SkPicture;
39
53
  androidWarmup?: boolean;
40
54
  }
41
- export interface SkiaDomViewNativeProps extends SkiaBaseViewProps {
42
- root?: Node<unknown>;
43
- }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { Node } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n size: (nativeId: number) => SkSize;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValue<SkSize>;\n\n opaque?: boolean;\n\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android\n * the extra precision survives composition only when combined with `opaque`.\n */\n highBitDepth?: boolean;\n\n // On web, only 16 WebGL contextes are allowed. If the drawing is non-animated, set\n // __destroyWebGLContextAfterRender to true to release the context after each draw.\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n androidWarmup?: boolean;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: Node<unknown>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport type AndroidSurfaceType = \"SurfaceView\" | \"TextureView\";\n\nexport interface AndroidCanvasProps {\n /**\n * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to\n * `TextureView` otherwise; both composite correctly in React Native stacking\n * order without further flags.\n */\n surfaceType?: AndroidSurfaceType;\n /**\n * SurfaceView only: composite above every React Native view in the window,\n * ignoring `zIndex`. Ignored for TextureView. Defaults to false.\n */\n zOrderOnTop?: boolean;\n}\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n size: (nativeId: number) => SkSize;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n\n /**\n * Declares that the canvas covers every pixel of its bounds. On Android an\n * opaque canvas is backed by a `SurfaceView` by default, the cheapest path\n * (see `android.surfaceType`). Defaults to false.\n */\n opaque?: boolean;\n\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android\n * the extra precision survives composition only when combined with `opaque`.\n */\n highBitDepth?: boolean;\n\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n\n // On web, only 16 WebGL contextes are allowed. If the drawing is non-animated, set\n // __destroyWebGLContextAfterRender to true to release the context after each draw.\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n androidWarmup?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -39,7 +39,6 @@ export function Mock(CanvasKit: any): {
39
39
  };
40
40
  useValueEffect: () => undefined;
41
41
  isOnMainThread: () => boolean;
42
- isFabric: boolean;
43
42
  useClock: () => {
44
43
  value: number;
45
44
  };
@@ -1,11 +1,10 @@
1
1
  export const __esModule: boolean;
2
- export const isFabric: boolean;
3
2
  export function useCanvasRef(): any;
4
3
  export function useCanvasSize(userRef: any): {
5
4
  ref: any;
6
5
  size: any;
7
6
  };
8
- export function Canvas({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, ref, onLayout, ...viewProps }: {
7
+ export function Canvas({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, android, ref, onLayout, ...viewProps }: {
9
8
  [x: string]: any;
10
9
  debug: any;
11
10
  opaque: any;
@@ -14,6 +13,7 @@ export function Canvas({ debug, opaque, children, onSize, colorSpace, highBitDep
14
13
  colorSpace?: string | undefined;
15
14
  highBitDepth?: boolean | undefined;
16
15
  androidWarmup?: boolean | undefined;
16
+ android: any;
17
17
  ref: any;
18
18
  onLayout: any;
19
19
  }): any;
@@ -23,7 +23,7 @@ export class JsiSkPathBuilder extends _Host.HostObject {
23
23
  addOval(oval: any, isCCW: any, startIndex: any): this;
24
24
  addArc(oval: any, startAngleInDegrees: any, sweepAngleInDegrees: any): this;
25
25
  addRRect(rrect: any, isCCW: any): this;
26
- addCircle(x: any, y: any, r: any, _isCCW: any): this;
26
+ addCircle(x: any, y: any, r: any, isCCW: any): this;
27
27
  addPoly(points: any, close: any): this;
28
28
  addPath(src: any, matrix: any, extend?: boolean): this;
29
29
  setFillType(fill: any): this;
@@ -35,7 +35,6 @@ export function JsiSkApi(CanvasKit: any): {
35
35
  NativeBuffer: _JsiSkNativeBufferFactory.JsiSkNativeBufferFactory;
36
36
  Skottie: _JsiSkottieFactory.JsiSkottieFactory;
37
37
  Video: (url?: any) => Promise<any>;
38
- Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
39
38
  Recorder: () => jest.Mock<any, any, any>;
40
39
  getNativeDevice: () => jest.Mock<any, any, any>;
41
40
  };
@@ -12,6 +12,7 @@ export function createDrawingContext(Skia: any, paintPool: any, canvas: any): {
12
12
  paintDeclarations: any[];
13
13
  paintPool: any;
14
14
  savePaint: () => void;
15
+ pushPaint: (paint: any) => void;
15
16
  saveBackdropFilter: () => void;
16
17
  readonly paint: any;
17
18
  restorePaint: () => any;
@@ -1,10 +1,12 @@
1
1
  export const __esModule: boolean;
2
2
  export default SkiaPictureViewNativeComponent;
3
- declare function SkiaPictureViewNativeComponent({ nativeID, debug, opaque, onLayout, ...viewProps }: {
3
+ declare function SkiaPictureViewNativeComponent({ nativeID, debug, opaque, onLayout, androidSurfaceType: _androidSurfaceType, androidZOrderOnTop: _androidZOrderOnTop, ...viewProps }: {
4
4
  [x: string]: any;
5
5
  nativeID: any;
6
6
  debug: any;
7
7
  opaque: any;
8
8
  onLayout: any;
9
+ androidSurfaceType: any;
10
+ androidZOrderOnTop: any;
9
11
  }): _react.FunctionComponentElement<any>;
10
12
  import _react = require("react");
@@ -38,7 +38,6 @@ export function Mock(CanvasKit: any): {
38
38
  };
39
39
  useValueEffect: () => undefined;
40
40
  isOnMainThread: () => boolean;
41
- isFabric: boolean;
42
41
  useClock: () => {
43
42
  value: number;
44
43
  };
@@ -6,8 +6,7 @@ export function useCanvasSize(userRef: any): {
6
6
  height: number;
7
7
  };
8
8
  };
9
- export const isFabric: boolean;
10
- export function Canvas({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, ref, onLayout, ...viewProps }: {
9
+ export function Canvas({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, android, ref, onLayout, ...viewProps }: {
11
10
  [x: string]: any;
12
11
  debug: any;
13
12
  opaque: any;
@@ -16,6 +15,7 @@ export function Canvas({ debug, opaque, children, onSize, colorSpace, highBitDep
16
15
  colorSpace?: string | undefined;
17
16
  highBitDepth?: boolean | undefined;
18
17
  androidWarmup?: boolean | undefined;
18
+ android: any;
19
19
  ref: any;
20
20
  onLayout: any;
21
21
  }): React.CElement<object, React.Component<object, {}, any> & import("react-native").ReactNativeElement>;
@@ -34,7 +34,6 @@ export const Skia: {
34
34
  NativeBuffer: import("./web/JsiSkNativeBufferFactory").JsiSkNativeBufferFactory;
35
35
  Skottie: import("./web/JsiSkottieFactory").JsiSkottieFactory;
36
36
  Video: (url?: any) => Promise<any>;
37
- Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
38
37
  Recorder: () => jest.Mock<any, any, any>;
39
38
  getNativeDevice: () => jest.Mock<any, any, any>;
40
39
  };
@@ -22,7 +22,7 @@ export class JsiSkPathBuilder extends HostObject {
22
22
  addOval(oval: any, isCCW: any, startIndex: any): this;
23
23
  addArc(oval: any, startAngleInDegrees: any, sweepAngleInDegrees: any): this;
24
24
  addRRect(rrect: any, isCCW: any): this;
25
- addCircle(x: any, y: any, r: any, _isCCW: any): this;
25
+ addCircle(x: any, y: any, r: any, isCCW: any): this;
26
26
  addPoly(points: any, close: any): this;
27
27
  addPath(src: any, matrix: any, extend?: boolean): this;
28
28
  setFillType(fill: any): this;
@@ -34,7 +34,6 @@ export function JsiSkApi(CanvasKit: any): {
34
34
  NativeBuffer: JsiSkNativeBufferFactory;
35
35
  Skottie: JsiSkottieFactory;
36
36
  Video: (url?: any) => Promise<any>;
37
- Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
38
37
  Recorder: () => jest.Mock<any, any, any>;
39
38
  getNativeDevice: () => jest.Mock<any, any, any>;
40
39
  };
@@ -11,6 +11,7 @@ export function createDrawingContext(Skia: any, paintPool: any, canvas: any): {
11
11
  paintDeclarations: any[];
12
12
  paintPool: any;
13
13
  savePaint: () => void;
14
+ pushPaint: (paint: any) => void;
14
15
  saveBackdropFilter: () => void;
15
16
  readonly paint: any;
16
17
  restorePaint: () => any;
@@ -1,8 +1,10 @@
1
1
  export default SkiaPictureViewNativeComponent;
2
- declare function SkiaPictureViewNativeComponent({ nativeID, debug, opaque, onLayout, ...viewProps }: {
2
+ declare function SkiaPictureViewNativeComponent({ nativeID, debug, opaque, onLayout, androidSurfaceType: _androidSurfaceType, androidZOrderOnTop: _androidZOrderOnTop, ...viewProps }: {
3
3
  [x: string]: any;
4
4
  nativeID: any;
5
5
  debug: any;
6
6
  opaque: any;
7
7
  onLayout: any;
8
+ androidSurfaceType: any;
9
+ androidZOrderOnTop: any;
8
10
  }): import("react").FunctionComponentElement<any>;
@@ -0,0 +1,3 @@
1
+ export namespace spm {
2
+ let name: string;
3
+ }
@@ -2,6 +2,7 @@ import type { FC, RefObject } from "react";
2
2
  import React from "react";
3
3
  import type { MeasureInWindowOnSuccessCallback, MeasureOnSuccessCallback, ViewProps } from "react-native";
4
4
  import type { SharedValue } from "react-native-reanimated";
5
+ import type { AndroidCanvasProps } from "../views/types";
5
6
  import type { SkImage, SkRect, SkSize } from "../skia/types";
6
7
  export interface CanvasRef extends FC<CanvasProps> {
7
8
  makeImageSnapshot(rect?: SkRect): SkImage;
@@ -16,11 +17,16 @@ export declare const useCanvasSize: (userRef?: RefObject<CanvasRef | null>) => {
16
17
  ref: RefObject<CanvasRef | null>;
17
18
  size: SkSize;
18
19
  };
19
- export declare const isFabric: boolean;
20
20
  export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
21
21
  debug?: boolean;
22
- /** @deprecated Not supported on Fabric. Use `onSize` or `useCanvasSize()` instead. */
22
+ /** @deprecated Not supported on native. Use `onSize` or `useCanvasSize()` instead. */
23
23
  onLayout?: ViewProps["onLayout"];
24
+ /**
25
+ * Declares that the canvas covers every pixel of its bounds, so nothing
26
+ * behind it needs to show through. On Android an opaque canvas is backed by
27
+ * a `SurfaceView` by default, the cheapest path (see `android.surfaceType`).
28
+ * Defaults to false.
29
+ */
24
30
  opaque?: boolean;
25
31
  onSize?: SharedValue<SkSize>;
26
32
  colorSpace?: "p3" | "srgb";
@@ -33,8 +39,10 @@ export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
33
39
  * before the canvas is mounted.
34
40
  */
35
41
  highBitDepth?: boolean;
42
+ /** Android-only rendering options. Ignored on iOS and web. */
43
+ android?: AndroidCanvasProps;
36
44
  ref?: React.Ref<CanvasRef>;
37
45
  androidWarmup?: boolean;
38
46
  __destroyWebGLContextAfterRender?: boolean;
39
47
  }
40
- export declare const Canvas: ({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
48
+ export declare const Canvas: ({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, android, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference lib="esnext.disposable" preserve="true" />
1
2
  export interface SkJSIInstance<T extends string> extends Disposable {
2
3
  __typename__: T;
3
4
  dispose(): void;
@@ -17,7 +17,7 @@ import type { SkVertices, VertexMode } from "./Vertices/Vertices";
17
17
  import type { DataFactory } from "./Data";
18
18
  import type { SVGFactory } from "./SVG";
19
19
  import type { TextBlobFactory } from "./TextBlob";
20
- import type { SkSurface, SurfaceFactory } from "./Surface";
20
+ import type { SurfaceFactory } from "./Surface";
21
21
  import type { SkRSXform } from "./RSXform";
22
22
  import type { SkPath } from "./Path/Path";
23
23
  import type { SkContourMeasureIter } from "./ContourMeasure";
@@ -30,10 +30,6 @@ import type { Video } from "./Video";
30
30
  import type { NativeBufferFactory } from "./NativeBuffer";
31
31
  import type { JsiRecorder } from "./Recorder";
32
32
  import type { SkottieFactory } from "./Skottie";
33
- export interface SkiaContext {
34
- getSurface(): SkSurface;
35
- present(): void;
36
- }
37
33
  /**
38
34
  * Declares the interface for the native Skia API
39
35
  */
@@ -82,7 +78,6 @@ export interface Skia {
82
78
  ParagraphBuilder: ParagraphBuilderFactory;
83
79
  Skottie: SkottieFactory;
84
80
  Video: (url: string) => Promise<Video> | Video;
85
- Context(surface: bigint, width: number, height: number): SkiaContext;
86
81
  NativeBuffer: NativeBufferFactory;
87
82
  Recorder(): JsiRecorder;
88
83
  /**
@@ -25,7 +25,7 @@ export declare class JsiSkPathBuilder extends HostObject<CKPathBuilder, "PathBui
25
25
  addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): this;
26
26
  addArc(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number): this;
27
27
  addRRect(rrect: InputRRect, isCCW?: boolean): this;
28
- addCircle(x: number, y: number, r: number, _isCCW?: boolean): this;
28
+ addCircle(x: number, y: number, r: number, isCCW?: boolean): this;
29
29
  addPoly(points: SkPoint[], close: boolean): this;
30
30
  addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): this;
31
31
  setFillType(fill: FillType): this;
@@ -12,6 +12,7 @@ export declare const createDrawingContext: (Skia: Skia, paintPool: SkPaint[], ca
12
12
  paintDeclarations: SkPaint[];
13
13
  paintPool: SkPaint[];
14
14
  savePaint: () => void;
15
+ pushPaint: (paint: SkPaint) => void;
15
16
  saveBackdropFilter: () => void;
16
17
  readonly paint: SkPaint;
17
18
  restorePaint: () => SkPaint | undefined;
@@ -6,6 +6,8 @@ export interface NativeProps extends ViewProps {
6
6
  colorSpace?: string;
7
7
  highBitDepth?: boolean;
8
8
  androidWarmup?: boolean;
9
+ androidSurfaceType?: WithDefault<"auto" | "SurfaceView" | "TextureView", "auto">;
10
+ androidZOrderOnTop?: WithDefault<boolean, false>;
9
11
  pointerEvents?: WithDefault<"auto" | "none" | "box-none" | "box-only", "auto">;
10
12
  }
11
13
  declare const _default: import("react-native").HostComponent<NativeProps>;
@@ -3,6 +3,8 @@ export interface NativeProps extends ViewProps {
3
3
  debug?: boolean;
4
4
  opaque?: boolean;
5
5
  nativeID: string;
6
+ androidSurfaceType?: "auto" | "SurfaceView" | "TextureView";
7
+ androidZOrderOnTop?: boolean;
6
8
  }
7
- declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaPictureView.web").SkiaPictureViewProps>;
9
+ declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, androidSurfaceType: _androidSurfaceType, androidZOrderOnTop: _androidZOrderOnTop, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaPictureView.web").SkiaPictureViewProps>;
8
10
  export default SkiaPictureViewNativeComponent;
@@ -1,11 +1,23 @@
1
1
  import type { ViewProps } from "react-native";
2
- import type { SharedValue } from "react-native-reanimated";
3
- import type { Node } from "../dom/types";
4
2
  import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
5
3
  export type NativeSkiaViewProps = ViewProps & {
6
4
  debug?: boolean;
7
5
  opaque?: boolean;
8
6
  };
7
+ export type AndroidSurfaceType = "SurfaceView" | "TextureView";
8
+ export interface AndroidCanvasProps {
9
+ /**
10
+ * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to
11
+ * `TextureView` otherwise; both composite correctly in React Native stacking
12
+ * order without further flags.
13
+ */
14
+ surfaceType?: AndroidSurfaceType;
15
+ /**
16
+ * SurfaceView only: composite above every React Native view in the window,
17
+ * ignoring `zIndex`. Ignored for TextureView. Defaults to false.
18
+ */
19
+ zOrderOnTop?: boolean;
20
+ }
9
21
  export interface ISkiaViewApi {
10
22
  web?: boolean;
11
23
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
@@ -21,10 +33,10 @@ export interface SkiaBaseViewProps extends ViewProps {
21
33
  */
22
34
  debug?: boolean;
23
35
  /**
24
- * Pass an animated value to the onSize property to get updates when
25
- * the Skia view is resized.
36
+ * Declares that the canvas covers every pixel of its bounds. On Android an
37
+ * opaque canvas is backed by a `SurfaceView` by default, the cheapest path
38
+ * (see `android.surfaceType`). Defaults to false.
26
39
  */
27
- onSize?: SharedValue<SkSize>;
28
40
  opaque?: boolean;
29
41
  /**
30
42
  * Renders into a surface with more than 8 bits per channel (16-bit float on
@@ -32,12 +44,11 @@ export interface SkiaBaseViewProps extends ViewProps {
32
44
  * the extra precision survives composition only when combined with `opaque`.
33
45
  */
34
46
  highBitDepth?: boolean;
47
+ /** Android-only rendering options. Ignored on iOS and web. */
48
+ android?: AndroidCanvasProps;
35
49
  __destroyWebGLContextAfterRender?: boolean;
36
50
  }
37
51
  export interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {
38
52
  picture?: SkPicture;
39
53
  androidWarmup?: boolean;
40
54
  }
41
- export interface SkiaDomViewNativeProps extends SkiaBaseViewProps {
42
- root?: Node<unknown>;
43
- }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "setup-skia-web": "scripts/setup-canvaskit.js"
9
9
  },
10
10
  "title": "React Native Skia",
11
- "version": "2.12.0-next.1",
11
+ "version": "2.13.0",
12
12
  "description": "High-performance React Native Graphics using Skia",
13
13
  "main": "lib/module/index.js",
14
14
  "react-native": "src/index.ts",
@@ -32,6 +32,9 @@
32
32
  "cpp/**/*.{h,cpp}",
33
33
  "apple/**",
34
34
  "react-native-skia.podspec",
35
+ "Package.swift",
36
+ "include/**",
37
+ "react-native.config.js",
35
38
  "dist/**",
36
39
  "libs/.graphite"
37
40
  ],
@@ -51,7 +54,6 @@
51
54
  "clang-format-ios": "find apple/ -iname '*.h' -o -iname '*.mm' -o -iname '*.cpp' | xargs clang-format -i",
52
55
  "clang-format-android": "find android/cpp/ -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' | xargs clang-format -i",
53
56
  "clang-format-common": "find cpp/ \\( -path 'cpp//skia' -prune \\) -o \\( -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' \\) -print | xargs clang-format -i",
54
- "workflow-copy-libs": "tsx ./scripts/workflow-copy-libs.ts",
55
57
  "cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=package/cpp/skia --exclude=package/ios --exclude=package/android/build --exclude=package/node_modules --recursive package"
56
58
  },
57
59
  "repository": {
@@ -62,7 +64,7 @@
62
64
  "keywords": [
63
65
  "react-native"
64
66
  ],
65
- "author": "Shopify Inc.",
67
+ "author": "William Candillon",
66
68
  "contributors": [
67
69
  {
68
70
  "name": "Christian Falch",
@@ -116,6 +118,7 @@
116
118
  "eslint-config-react-native-wcandillon": "4.0.1",
117
119
  "eslint-plugin-import": "2.32.0",
118
120
  "eslint-plugin-react-hooks": "^5.2.0",
121
+ "extract-zip": "^2.0.1",
119
122
  "jest": "30.0.0",
120
123
  "jest-diff": "29.7.0",
121
124
  "jest-environment-jsdom": "30.0.0",
@@ -139,15 +142,16 @@
139
142
  },
140
143
  "dependencies": {
141
144
  "canvaskit-wasm": "0.41.0",
142
- "react-native-skia-graphite-android": "152.0.0",
143
- "react-native-skia-graphite-apple-ios": "152.0.0",
144
- "react-native-skia-graphite-apple-macos": "152.0.0",
145
+ "react-native-skia-android": "154.0.0",
146
+ "react-native-skia-apple-ios": "154.0.0",
147
+ "react-native-skia-apple-macos": "154.0.0",
148
+ "react-native-skia-apple-tvos": "154.0.0",
145
149
  "react-reconciler": "0.31.0"
146
150
  },
147
151
  "graphiteDependencies": {
148
- "react-native-skia-graphite-android": "152.0.0",
149
- "react-native-skia-graphite-apple-ios": "152.0.0",
150
- "react-native-skia-graphite-apple-macos": "152.0.0"
152
+ "react-native-skia-graphite-android": "154.0.0",
153
+ "react-native-skia-graphite-apple-ios": "154.0.0",
154
+ "react-native-skia-graphite-apple-macos": "154.0.0"
151
155
  },
152
156
  "eslintIgnore": [
153
157
  "node_modules/",
@@ -158,7 +162,7 @@
158
162
  "type": "all",
159
163
  "jsSrcsDir": "src/specs",
160
164
  "android": {
161
- "javaPackageName": "com.shopify.reactnative.skia"
165
+ "javaPackageName": "com.reactnative.skia"
162
166
  },
163
167
  "ios": {
164
168
  "componentProvider": {
@@ -184,6 +188,5 @@
184
188
  }
185
189
  ]
186
190
  ]
187
- },
188
- "stableVersion": "0.0.0"
191
+ }
189
192
  }
@@ -193,14 +193,8 @@ Pod::Spec.new do |s|
193
193
  ]
194
194
  s.exclude_files = graphite_exclusions unless use_graphite
195
195
 
196
- if defined?(install_modules_dependencies()) != nil
197
- install_modules_dependencies(s)
198
- s.dependency "React"
199
- s.dependency "React-callinvoker"
200
- s.dependency "React-Core"
201
- else
202
- s.dependency "React"
203
- s.dependency "React-callinvoker"
204
- s.dependency "React-Core"
205
- end
196
+ install_modules_dependencies(s)
197
+ s.dependency "React"
198
+ s.dependency "React-callinvoker"
199
+ s.dependency "React-Core"
206
200
  end
@@ -0,0 +1,5 @@
1
+ // Pins the SwiftPM target name. Without it the name is derived — today from the
2
+ // npm name (ReactNativeSkia), but an in-flight React Native change derives it
3
+ // from the podspec instead (react-native-skia). The name is also the header
4
+ // import prefix, so it must not move.
5
+ module.exports = {spm: {name: 'ReactNativeSkia'}};
@@ -6,8 +6,13 @@ import { processRadius } from "./Radius";
6
6
 
7
7
  export const isEdge = (pos: Vector, b: SkRect) => {
8
8
  "worklet";
9
+ const right = b.x + b.width;
10
+ const bottom = b.y + b.height;
11
+ const withinX = pos.x >= b.x && pos.x <= right;
12
+ const withinY = pos.y >= b.y && pos.y <= bottom;
9
13
  return (
10
- pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height
14
+ (withinY && (pos.x === b.x || pos.x === right)) ||
15
+ (withinX && (pos.y === b.y || pos.y === bottom))
11
16
  );
12
17
  };
13
18
 
@@ -22,8 +22,12 @@ const copyFrameOnAndroid = (currentFrame: SharedValue<SkImage | null>) => {
22
22
  if (Platform.OS === "android") {
23
23
  const tex = currentFrame.value;
24
24
  if (tex) {
25
- currentFrame.value = tex; //.makeNonTextureImage();
26
- tex.dispose();
25
+ const copy = tex.makeNonTextureImage();
26
+ if (copy) {
27
+ currentFrame.value = copy;
28
+ tex.dispose();
29
+ }
30
+ // If copy fails, keep the original frame rather than showing black
27
31
  }
28
32
  }
29
33
  };
@@ -32,6 +36,7 @@ const setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {
32
36
  "worklet";
33
37
  const img = video.nextImage();
34
38
  if (img) {
39
+ currentFrame.value?.dispose();
35
40
  currentFrame.value = img;
36
41
  copyFrameOnAndroid(currentFrame);
37
42
  }
package/src/mock/index.ts CHANGED
@@ -49,7 +49,6 @@ export const Mock = (CanvasKit: CanvasKit) => {
49
49
  useValueEffect: Noop,
50
50
  // Reanimated hooks
51
51
  isOnMainThread: () => true,
52
- isFabric: true,
53
52
  useClock: NoopSharedValue,
54
53
  usePathInterpolation: NoopSharedValue,
55
54
  useImageAsTexture: NoopSharedValue,
@@ -19,6 +19,7 @@ import type { SharedValue } from "react-native-reanimated";
19
19
 
20
20
  import Rea from "../external/reanimated/ReanimatedProxy";
21
21
  import { SkiaViewNativeId } from "../views/SkiaViewNativeId";
22
+ import type { AndroidCanvasProps, AndroidSurfaceType } from "../views/types";
22
23
  import SkiaPictureViewNativeComponent from "../specs/SkiaPictureViewNativeComponent";
23
24
  import type { SkImage, SkRect, SkSize } from "../skia/types";
24
25
  import { SkiaSGRoot } from "../sksg/Reconciler";
@@ -59,13 +60,16 @@ export const useCanvasSize = (userRef?: RefObject<CanvasRef | null>) => {
59
60
  return { ref, size };
60
61
  };
61
62
 
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- export const isFabric = Boolean((global as any)?.nativeFabricUIManager);
64
-
65
63
  export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
66
64
  debug?: boolean;
67
- /** @deprecated Not supported on Fabric. Use `onSize` or `useCanvasSize()` instead. */
65
+ /** @deprecated Not supported on native. Use `onSize` or `useCanvasSize()` instead. */
68
66
  onLayout?: ViewProps["onLayout"];
67
+ /**
68
+ * Declares that the canvas covers every pixel of its bounds, so nothing
69
+ * behind it needs to show through. On Android an opaque canvas is backed by
70
+ * a `SurfaceView` by default, the cheapest path (see `android.surfaceType`).
71
+ * Defaults to false.
72
+ */
69
73
  opaque?: boolean;
70
74
  onSize?: SharedValue<SkSize>;
71
75
  colorSpace?: "p3" | "srgb";
@@ -78,11 +82,22 @@ export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
78
82
  * before the canvas is mounted.
79
83
  */
80
84
  highBitDepth?: boolean;
85
+ /** Android-only rendering options. Ignored on iOS and web. */
86
+ android?: AndroidCanvasProps;
81
87
  ref?: React.Ref<CanvasRef>;
82
88
  androidWarmup?: boolean;
83
89
  __destroyWebGLContextAfterRender?: boolean;
84
90
  }
85
91
 
92
+ // Anything else reaching the native component would hit the generated
93
+ // string-enum parser, which aborts on unknown values.
94
+ const resolveSurfaceType = (
95
+ surfaceType: AndroidSurfaceType | undefined
96
+ ): "auto" | AndroidSurfaceType =>
97
+ surfaceType === "SurfaceView" || surfaceType === "TextureView"
98
+ ? surfaceType
99
+ : "auto";
100
+
86
101
  export const Canvas = ({
87
102
  debug,
88
103
  opaque,
@@ -91,11 +106,12 @@ export const Canvas = ({
91
106
  colorSpace = "p3",
92
107
  highBitDepth = false,
93
108
  androidWarmup = false,
109
+ android,
94
110
  ref,
95
111
  onLayout,
96
112
  ...viewProps
97
113
  }: CanvasProps) => {
98
- if (onLayout && isFabric) {
114
+ if (onLayout && Platform.OS !== "web") {
99
115
  console.error(
100
116
  "<Canvas onLayout={onLayout} /> is not supported on the new architecture, to fix the issue, see: https://shopify.github.io/react-native-skia/docs/canvas/overview/#getting-the-canvas-size"
101
117
  );
@@ -192,6 +208,8 @@ export const Canvas = ({
192
208
  colorSpace={colorSpace}
193
209
  highBitDepth={highBitDepth}
194
210
  androidWarmup={androidWarmup}
211
+ androidSurfaceType={resolveSurfaceType(android?.surfaceType)}
212
+ androidZOrderOnTop={!!android?.zOrderOnTop}
195
213
  onLayout={
196
214
  Platform.OS === "web" && (onSize || onLayout) ? onLayoutWeb : onLayout
197
215
  }