@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
package/LICENSE.md CHANGED
@@ -1,4 +1,5 @@
1
- Copyright 2021-present, Shopify Inc.
1
+ Copyright 2026-present, William Candillon
2
+ Copyright 2021-2026, Shopify Inc.
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
5
 
package/Package.swift ADDED
@@ -0,0 +1,117 @@
1
+ // swift-tools-version: 6.0
2
+ //
3
+ // SwiftPM manifest for @shopify/react-native-skia. iOS, Ganesh.
4
+ // Additive: the CocoaPods podspec remains the supported default.
5
+ //
6
+ // React Native 0.87+ references a library that ships its own Package.swift
7
+ // through a symlink at <app>/ios/build/generated/autolinking/libs/<name>, and
8
+ // resolves the relative paths below against that symlink. They are the same
9
+ // for every standard app, because the symlink location is.
10
+
11
+ import Foundation
12
+ import PackageDescription
13
+
14
+ // Skia's xcframeworks are ~200MB and are not carried in this package. They come
15
+ // from the react-native-skia-apple-ios npm package, which @shopify/react-native-skia
16
+ // depends on, so a checkout that has installed its dependencies builds offline.
17
+ // Xcode passes the symlink as the package directory, hence resolvingSymlinks.
18
+ let packageRoot = URL(fileURLWithPath: Context.packageDirectory)
19
+ .resolvingSymlinksInPath().path
20
+
21
+ let binariesPath = [
22
+ "../../react-native-skia-apple-ios", // consumer: sibling in node_modules
23
+ "../../node_modules/react-native-skia-apple-ios", // this monorepo
24
+ ]
25
+ .map { "\(packageRoot)/\($0)" }
26
+ .first { FileManager.default.fileExists(atPath: "\($0)/Package.swift") }
27
+
28
+ guard let binariesPath else {
29
+ // Reached when the package was skipped at install time (`--omit=optional`,
30
+ // or a non-Apple `os` filter), which SwiftPM would otherwise report as an
31
+ // unresolvable dependency path.
32
+ fatalError(
33
+ """
34
+ react-native-skia-apple-ios was not found next to @shopify/react-native-skia. \
35
+ It ships the prebuilt Skia binaries this package links against. Reinstall \
36
+ dependencies without --omit=optional, on macOS.
37
+ """)
38
+ }
39
+
40
+ let package = Package(
41
+ name: "ReactNativeSkia",
42
+ platforms: [.iOS(.v15)],
43
+ products: [
44
+ // Autolinking looks this name up verbatim; react-native.config.js pins it.
45
+ .library(name: "ReactNativeSkia", targets: ["ReactNativeSkia"])
46
+ ],
47
+ dependencies: [
48
+ .package(name: "React-GeneratedCode", path: "../../../ios"),
49
+ .package(name: "ReactNative", path: "../../../../xcframeworks"),
50
+ .package(path: binariesPath),
51
+ ],
52
+ targets: [
53
+ .target(
54
+ name: "ReactNativeSkia",
55
+ dependencies: [
56
+ .product(name: "ReactHeaders", package: "ReactNative"),
57
+ .product(name: "ReactNativeHeaders", package: "ReactNative"),
58
+ .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
59
+ .product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
60
+ .product(name: "react-native-skia-apple-ios", package: "react-native-skia-apple-ios"),
61
+ ],
62
+ // apple/ and cpp/ have no common ancestor below the package root, and
63
+ // .headerSearchPath cannot escape the target path.
64
+ path: ".",
65
+ exclude: [
66
+ "cpp/rnskia/RNDawnWindowContext.cpp", // Graphite only
67
+ "cpp/rnskia/RNDawnInterop.cpp", // Graphite only
68
+ ],
69
+ // Explicit, so SwiftPM never walks node_modules, lib, android, or the
70
+ // headers-only cpp/skia — which carries x86 AVX skcms sources that
71
+ // cannot build for arm64.
72
+ sources: [
73
+ "apple",
74
+ "cpp/api",
75
+ "cpp/jsi",
76
+ "cpp/rnskia",
77
+ "cpp/utils",
78
+ // libskottie.a needs skjson and Apple builds no libskjson archive.
79
+ // CocoaPods compiles this via its cpp/**/*.cpp glob.
80
+ "cpp/skia/modules/jsonreader/SkJSONReader.cpp",
81
+ ],
82
+ cxxSettings: [
83
+ // Replaces the podspec's recursive cpp/** glob, which expands to 90.
84
+ .headerSearchPath("cpp"), // "api/…", "jsi/…", "utils/…"
85
+ .headerSearchPath("cpp/skia"), // "include/core/…", "modules/…", "src/…"
86
+ .headerSearchPath("cpp/rnskia"), // apple/ uses bare "RNSkView.h"
87
+ .headerSearchPath("cpp/utils"), // apple/ uses bare "RNSkLog.h"
88
+
89
+ // CocoaPods defines both project-wide for a New Architecture app; the
90
+ // SwiftPM path defines neither. Skia's own sources no longer gate on
91
+ // them, but React's headers do (RCT_REMOVE_LEGACY_ARCH hides the
92
+ // legacy bridge API), so mirror what CocoaPods does.
93
+ .define("RCT_NEW_ARCH_ENABLED", to: "1"),
94
+ .define("RCT_REMOVE_LEGACY_ARCH", to: "1"),
95
+
96
+ .define("SK_METAL", to: "1"),
97
+ .define("SK_GANESH", to: "1"),
98
+ .define("SK_IMAGE_READ_PIXELS_DISABLE_LEGACY_API", to: "1"),
99
+ .define("SK_DISABLE_LEGACY_SHAPER_FACTORY", to: "1"),
100
+
101
+ // React's prebuilt C++ ABI is NDEBUG-gated, and Skia derives
102
+ // SK_RELEASE from it. Omitting either breaks the Release link.
103
+ .define("DEBUG", .when(configuration: .debug)),
104
+ .define("NDEBUG", .when(configuration: .release)),
105
+ ],
106
+ linkerSettings: [
107
+ .linkedFramework("MetalKit"),
108
+ .linkedFramework("AVFoundation"),
109
+ .linkedFramework("AVKit"),
110
+ .linkedFramework("CoreMedia"),
111
+ ]
112
+ )
113
+ ],
114
+ // React Native's headers need C++20, and so does Skia m152: SkMathPriv.h
115
+ // calls std::countl_zero, std::countr_zero and std::popcount.
116
+ cxxLanguageStandard: .cxx20
117
+ )
@@ -1,7 +1,6 @@
1
1
  project(RNSkia)
2
2
  cmake_minimum_required(VERSION 3.4.1)
3
3
 
4
- set (CMAKE_VERBOSE_MAKEFILE ON)
5
4
  set (CMAKE_CXX_STANDARD 20)
6
5
 
7
6
  # SKIA_LIBS_PATH is passed from Gradle (pointing at the prebuilt Skia binaries,
@@ -48,20 +47,7 @@ set (SKIA_SKSG_LIB "sksg")
48
47
  set (SKIA_JSONREADER_LIB "jsonreader")
49
48
 
50
49
 
51
- # Clear some variables
52
- unset(LIBRN_DIR CACHE)
53
- unset(libfbjni_link_DIRS CACHE)
54
- unset(libfbjni_include_DIRS CACHE)
55
-
56
- set(build_DIR ${CMAKE_SOURCE_DIR}/build)
57
- file(GLOB LIBRN_DIR "${PREBUILT_DIR}/${ANDROID_ABI}")
58
- file(GLOB libfbjni_link_DIRS "${build_DIR}/fbjni*.aar/jni/${ANDROID_ABI}")
59
- file(GLOB libfbjni_include_DIRS "${build_DIR}/fbjni-*-headers.jar/")
60
-
61
50
  message("-- ABI : " ${ANDROID_ABI})
62
- message("-- PREBUILT: " ${PREBUILT_DIR})
63
- message("-- BUILD : " ${build_DIR})
64
- message("-- LIBRN : " ${LIBRN_DIR})
65
51
 
66
52
  link_directories(${SKIA_LIBS_PATH}/)
67
53
 
@@ -80,14 +66,6 @@ else()
80
66
  )
81
67
  endif()
82
68
 
83
- if(${REACT_NATIVE_VERSION} LESS 66)
84
- file(
85
- TO_CMAKE_PATH
86
- "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
87
- INCLUDE_JSI_CPP
88
- )
89
- endif()
90
-
91
69
  add_library(
92
70
  ${PACKAGE_NAME}
93
71
  SHARED
@@ -100,8 +78,7 @@ add_library(
100
78
  "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/AHardwareBufferUtils.cpp"
101
79
  "${PROJECT_SOURCE_DIR}/cpp/rnskia-android/RNSkAndroidVideo.cpp"
102
80
 
103
- "${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeLifecycleMonitor.cpp"
104
- "${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeAwareCache.cpp"
81
+ "${PROJECT_SOURCE_DIR}/../cpp/jsi/JSICache.cpp"
105
82
  "${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiPromises.cpp"
106
83
  "${PROJECT_SOURCE_DIR}/../cpp/jsi/Promise.cpp"
107
84
 
@@ -146,8 +123,6 @@ target_include_directories(
146
123
 
147
124
  # Shared JSI infrastructure (cpp/jsi) via prefix-qualified includes
148
125
  ../cpp
149
-
150
- ${libfbjni_include_DIRS}
151
126
  )
152
127
 
153
128
  add_library(svg STATIC IMPORTED)
@@ -190,113 +165,9 @@ find_library(
190
165
  )
191
166
  message("-- LOG : " ${LOG_LIB})
192
167
 
193
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
194
- # We need to find packages since from RN 0.71 binaries are prebuilt
195
- find_package(fbjni REQUIRED CONFIG)
196
- find_package(ReactAndroid REQUIRED CONFIG)
197
- endif()
198
-
199
- unset(JSI_LIB CACHE)
200
- if(${REACT_NATIVE_VERSION} LESS 66)
201
- # JSI lib didn't exist on RN 0.65 and before. Simply omit it.
202
- set (JSI_LIB "")
203
- elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
204
- # RN 0.71 distributes prebuilt binaries.
205
- set (JSI_LIB ReactAndroid::jsi)
206
- else()
207
- # RN 0.66 distributes libjsi.so, can be used instead of compiling jsi.cpp manually.
208
- find_library(
209
- JSI_LIB
210
- jsi
211
- PATHS ${LIBRN_DIR}
212
- NO_CMAKE_FIND_ROOT_PATH
213
- )
214
- endif()
215
- message("-- JSI : " ${JSI_LIB})
216
-
217
- unset(REACT_LIB CACHE)
218
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
219
- # RN 0.76 packs react_nativemodule_core into ReactAndroid::reactnative
220
- set (REACT_LIB ReactAndroid::reactnative)
221
- elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
222
- # RN 0.71 distributes prebuilt binaries.
223
- set (REACT_LIB ReactAndroid::react_nativemodule_core)
224
- else()
225
- find_library(
226
- REACT_LIB
227
- react_nativemodule_core
228
- PATHS ${LIBRN_DIR}
229
- NO_CMAKE_FIND_ROOT_PATH
230
- )
231
- endif()
232
- message("-- REACT : " ${REACT_LIB})
233
-
234
- unset(FBJNI_LIBRARY CACHE)
235
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
236
- # RN 0.71 distributes prebuilt binaries.
237
- set (FBJNI_LIBRARY fbjni::fbjni)
238
- else()
239
- find_library(
240
- FBJNI_LIBRARY
241
- fbjni
242
- PATHS ${libfbjni_link_DIRS}
243
- NO_CMAKE_FIND_ROOT_PATH
244
- )
245
- endif()
246
- message("-- FBJNI : " ${FBJNI_LIBRARY})
247
-
248
- unset(REACTNATIVEJNI_LIB CACHE)
249
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
250
- # RN 0.76 doesn't have reactnativejni
251
- # DO NOTHING, we'll not link these libraries
252
- elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
253
- # RN 0.71 distributes prebuilt binaries.
254
- set (REACTNATIVEJNI_LIB "ReactAndroid::reactnativejni")
255
- else()
256
- find_library(
257
- REACTNATIVEJNI_LIB
258
- reactnativejni
259
- PATHS ${LIBRN_DIR}
260
- NO_CMAKE_FIND_ROOT_PATH
261
- )
262
- endif()
263
- message("-- REACTNATIVEJNI : " ${REACTNATIVEJNI_LIB})
264
-
265
- unset(RUNTIMEEXECUTOR_LIB CACHE)
266
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
267
- # RN 0.76 doesn't have runtimeexecutor
268
- # DO NOTHING, we'll not link these libraries
269
- elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
270
- # RN 0.71 distributes prebuilt binaries.
271
- set (RUNTIMEEXECUTOR_LIB "ReactAndroid::runtimeexecutor")
272
- else()
273
- find_library(
274
- RUNTIMEEXECUTOR_LIB
275
- runtimeexecutor
276
- PATHS ${LIBRN_DIR}
277
- NO_CMAKE_FIND_ROOT_PATH
278
- )
279
- endif()
280
- message("-- RUNTIMEEXECUTOR : " ${RUNTIMEEXECUTOR_LIB})
281
-
282
- unset(TURBOMODULES_LIB CACHE)
283
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
284
- # RN 0.76 doesn't have turbomodulejsijni
285
- # DO NOTHING, we'll not link these libraries
286
- elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
287
- # RN 0.71 distributes prebuilt binaries.
288
- set (TURBOMODULES_LIB "ReactAndroid::turbomodulejsijni")
289
- else()
290
- find_library(
291
- TURBOMODULES_LIB
292
- turbomodulejsijni
293
- PATHS ${LIBRN_DIR}
294
- NO_CMAKE_FIND_ROOT_PATH
295
- )
296
- endif()
297
- message("-- TURBO : " ${TURBOMODULES_LIB})
298
-
299
- add_definitions(-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION})
168
+ # React Native distributes prebuilt binaries via prefab.
169
+ find_package(fbjni REQUIRED CONFIG)
170
+ find_package(ReactAndroid REQUIRED CONFIG)
300
171
 
301
172
  # Set RN_SERIALIZABLE_STATE and C++ flags for React Native 0.81+
302
173
  if(${REACT_NATIVE_VERSION} GREATER_EQUAL 80)
@@ -308,50 +179,25 @@ else()
308
179
  endif()
309
180
 
310
181
  # Link
311
- if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
312
- set(COMMON_LIBS
313
- ${LOG_LIB}
314
- ${REACT_LIB}
315
- ${FBJNI_LIBRARY}
316
- ${JSI_LIB}
317
- ${SKIA_SVG_LIB}
318
- ${SKIA_SKSHAPER_LIB}
319
- ${SKIA_SKPARAGRAPH_LIB}
320
- ${SKIA_SKUNICODE_CORE_LIB}
321
- ${SKIA_SKUNICODE_ICU_LIB}
322
- ${SKIA_SKOTTIE_LIB}
323
- ${SKIA_SKSG_LIB}
324
- ${SKIA_JSONREADER_LIB}
325
- ${SKIA_LIB}
326
- -ljnigraphics
327
- -lGLESv2
328
- -lEGL
329
- -landroid
330
- )
331
- else()
332
- set(COMMON_LIBS
333
- ${LOG_LIB}
334
- ${FBJNI_LIBRARY}
335
- ${REACT_LIB}
336
- ${JSI_LIB}
337
- ${REACTNATIVEJNI_LIB}
338
- ${RUNTIMEEXECUTOR_LIB}
339
- ${TURBOMODULES_LIB}
340
- ${SKIA_SVG_LIB}
341
- ${SKIA_SKSHAPER_LIB}
342
- ${SKIA_SKPARAGRAPH_LIB}
343
- ${SKIA_SKUNICODE_CORE_LIB}
344
- ${SKIA_SKUNICODE_ICU_LIB}
345
- ${SKIA_SKOTTIE_LIB}
346
- ${SKIA_SKSG_LIB}
347
- ${SKIA_JSONREADER_LIB}
348
- ${SKIA_LIB}
349
- -ljnigraphics
350
- -lGLESv2
351
- -lEGL
352
- -landroid
353
- )
354
- endif()
182
+ set(COMMON_LIBS
183
+ ${LOG_LIB}
184
+ ReactAndroid::reactnative
185
+ fbjni::fbjni
186
+ ReactAndroid::jsi
187
+ ${SKIA_SVG_LIB}
188
+ ${SKIA_SKSHAPER_LIB}
189
+ ${SKIA_SKPARAGRAPH_LIB}
190
+ ${SKIA_SKUNICODE_CORE_LIB}
191
+ ${SKIA_SKUNICODE_ICU_LIB}
192
+ ${SKIA_SKOTTIE_LIB}
193
+ ${SKIA_SKSG_LIB}
194
+ ${SKIA_JSONREADER_LIB}
195
+ ${SKIA_LIB}
196
+ -ljnigraphics
197
+ -lGLESv2
198
+ -lEGL
199
+ -landroid
200
+ )
355
201
 
356
202
  if(SK_GRAPHITE)
357
203
  target_link_libraries(${PACKAGE_NAME}
@@ -361,8 +207,6 @@ if(SK_GRAPHITE)
361
207
  else()
362
208
  target_link_libraries(${PACKAGE_NAME}
363
209
  ${COMMON_LIBS}
364
- -lGLESv2
365
- -lEGL
366
210
  )
367
211
  endif()
368
212