@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,6 +1,6 @@
1
1
  // RnskiaModule.java
2
2
 
3
- package com.shopify.reactnative.skia;
3
+ package com.reactnative.skia;
4
4
 
5
5
  import android.util.Log;
6
6
 
@@ -17,11 +17,6 @@ public class RNSkiaModule extends NativeSkiaModuleSpec {
17
17
 
18
18
  private final WeakReference<ReactApplicationContext> weakReactContext;
19
19
  private SkiaManager skiaManager;
20
- private static volatile boolean sIsValid = false;
21
-
22
- public static boolean isModuleValid() {
23
- return sIsValid;
24
- }
25
20
 
26
21
  public RNSkiaModule(ReactApplicationContext reactContext) {
27
22
  super(reactContext);
@@ -31,7 +26,6 @@ public class RNSkiaModule extends NativeSkiaModuleSpec {
31
26
  @Override
32
27
  public void invalidate() {
33
28
  super.invalidate();
34
- sIsValid = false;
35
29
 
36
30
  if (this.skiaManager != null) {
37
31
  this.skiaManager.invalidate();
@@ -64,7 +58,6 @@ public class RNSkiaModule extends NativeSkiaModuleSpec {
64
58
  return false;
65
59
  }
66
60
  skiaManager = new SkiaManager(context);
67
- sIsValid = true;
68
61
  return true;
69
62
  } catch (Exception exception) {
70
63
  Log.e(NAME, "Failed to initialize Skia Manager!", exception);
@@ -0,0 +1,57 @@
1
+ // RnskiaPackage.java
2
+
3
+ package com.reactnative.skia;
4
+
5
+ import androidx.annotation.Nullable;
6
+
7
+ import java.util.Arrays;
8
+ import java.util.HashMap;
9
+ import java.util.List;
10
+ import java.util.Map;
11
+
12
+ import com.facebook.react.BaseReactPackage;
13
+ import com.facebook.react.ReactPackage;
14
+ import com.facebook.react.bridge.NativeModule;
15
+ import com.facebook.react.bridge.ReactApplicationContext;
16
+ import com.facebook.react.module.model.ReactModuleInfo;
17
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
18
+ import com.facebook.react.uimanager.ViewManager;
19
+
20
+ // `implements ReactPackage` is redundant (BaseReactPackage already implements it)
21
+ // but required: older @react-native-community/cli versions only autolink
22
+ // classes matching `implements ReactPackage` or `extends TurboReactPackage`.
23
+ public class RNSkiaPackage extends BaseReactPackage implements ReactPackage {
24
+ @Nullable
25
+ @Override
26
+ public NativeModule getModule(String name, ReactApplicationContext reactApplicationContext) {
27
+ if (RNSkiaModule.NAME.equals(name)) {
28
+ return new RNSkiaModule(reactApplicationContext);
29
+ }
30
+ return null;
31
+ }
32
+
33
+ @Override
34
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
35
+ return Arrays.<ViewManager>asList(
36
+ new SkiaPictureViewManager()
37
+ );
38
+ }
39
+
40
+ @Override
41
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
42
+ return () -> {
43
+ final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
44
+ reactModuleInfoMap.put(
45
+ RNSkiaModule.NAME,
46
+ new ReactModuleInfo(
47
+ RNSkiaModule.NAME,
48
+ RNSkiaModule.class.getName(),
49
+ false, // canOverrideExistingModule
50
+ false, // needsEagerInit
51
+ false, // isCxxModule
52
+ true // isTurboModule
53
+ ));
54
+ return reactModuleInfoMap;
55
+ };
56
+ }
57
+ }
@@ -0,0 +1,185 @@
1
+ package com.reactnative.skia;
2
+
3
+ import android.content.Context;
4
+ import android.graphics.SurfaceTexture;
5
+ import android.util.Log;
6
+ import android.view.MotionEvent;
7
+ import android.view.Surface;
8
+ import android.view.View;
9
+
10
+ import com.facebook.react.uimanager.PointerEvents;
11
+ import com.facebook.react.views.view.ReactViewGroup;
12
+
13
+ public abstract class SkiaBaseView extends ReactViewGroup implements SkiaViewAPI {
14
+ // Backing view kinds, see updateView().
15
+ private static final int KIND_SURFACE_VIEW = 0;
16
+ private static final int KIND_TEXTURE_VIEW = 1;
17
+
18
+ private View mView;
19
+
20
+ // Props, applied together in updateView().
21
+ private boolean mOpaque = false;
22
+ private String mSurfaceType = "auto";
23
+ private boolean mZOrderOnTop = false;
24
+ private boolean mHighBitDepth = false;
25
+
26
+ // What the current backing view was created with.
27
+ private int mAppliedKind = -1;
28
+ private boolean mAppliedZOrderOnTop;
29
+ private boolean mAppliedHighBitDepth;
30
+
31
+ private final boolean debug = false;
32
+ private final String tag = "SkiaView";
33
+
34
+ public SkiaBaseView(Context context) {
35
+ super(context);
36
+ }
37
+
38
+ @Override
39
+ public boolean dispatchTouchEvent(MotionEvent ev) {
40
+ // When pointerEvents is "none" or "box-none", make this view completely
41
+ // transparent to touch dispatch so events pass through to views behind it
42
+ if (!PointerEvents.canBeTouchTarget(getPointerEvents())) {
43
+ return false;
44
+ }
45
+ return super.dispatchTouchEvent(ev);
46
+ }
47
+
48
+ public void setOpaque(boolean value) {
49
+ mOpaque = value;
50
+ }
51
+
52
+ public void setSurfaceType(String value) {
53
+ mSurfaceType = value == null ? "auto" : value;
54
+ }
55
+
56
+ public void setZOrderOnTop(boolean value) {
57
+ mZOrderOnTop = value;
58
+ }
59
+
60
+ public void setHighBitDepth(boolean value) {
61
+ mHighBitDepth = value;
62
+ }
63
+
64
+ // Resolve the backing view from the props. "auto" picks SurfaceView for an
65
+ // opaque canvas and TextureView for a non-opaque one.
66
+ private int resolveKind() {
67
+ if ("SurfaceView".equals(mSurfaceType)) {
68
+ return KIND_SURFACE_VIEW;
69
+ }
70
+ if ("TextureView".equals(mSurfaceType)) {
71
+ return KIND_TEXTURE_VIEW;
72
+ }
73
+ return mOpaque ? KIND_SURFACE_VIEW : KIND_TEXTURE_VIEW;
74
+ }
75
+
76
+ // The 10-bit buffer format only has 2 bits of alpha, which would visibly
77
+ // break translucency, and the extra precision would be lost in the 8-bit
78
+ // composition pass of a TextureView anyway. So the flag only applies to an
79
+ // opaque SurfaceView.
80
+ private boolean resolveHighBitDepth(int kind) {
81
+ if (!mHighBitDepth) {
82
+ return false;
83
+ }
84
+ if (kind != KIND_SURFACE_VIEW || !mOpaque) {
85
+ Log.w(tag, "highBitDepth requires an opaque SurfaceView on Android, falling back to the 8-bit format");
86
+ return false;
87
+ }
88
+ return true;
89
+ }
90
+
91
+ // Apply the complete prop transaction once, after every prop has arrived.
92
+ // Only a change of backing view, or of a setting the view must know before
93
+ // it attaches (zOrderOnTop, the buffer format), replaces the child; opacity
94
+ // is applied in place.
95
+ void updateView() {
96
+ int kind = resolveKind();
97
+ boolean zOrderOnTop = kind == KIND_SURFACE_VIEW && mZOrderOnTop;
98
+ boolean highBitDepth = resolveHighBitDepth(kind);
99
+ if (mView == null
100
+ || kind != mAppliedKind
101
+ || zOrderOnTop != mAppliedZOrderOnTop
102
+ || highBitDepth != mAppliedHighBitDepth) {
103
+ if (mView != null) {
104
+ removeView(mView);
105
+ }
106
+ mAppliedKind = kind;
107
+ mAppliedZOrderOnTop = zOrderOnTop;
108
+ mAppliedHighBitDepth = highBitDepth;
109
+ mView = kind == KIND_SURFACE_VIEW
110
+ ? new SkiaSurfaceView(getContext(), this, debug, zOrderOnTop, mOpaque)
111
+ : new SkiaTextureView(getContext(), this, debug, mOpaque);
112
+ addView(mView);
113
+ // React Native sizes native children explicitly through onLayout, so
114
+ // the requestLayout triggered by addView is ignored; size the new
115
+ // child ourselves or it stays 0x0 and never gets a surface.
116
+ if (getWidth() > 0 || getHeight() > 0) {
117
+ mView.layout(0, 0, getWidth(), getHeight());
118
+ }
119
+ } else if (kind == KIND_SURFACE_VIEW) {
120
+ ((SkiaSurfaceView) mView).setOpaque(mOpaque);
121
+ } else {
122
+ ((SkiaTextureView) mView).setOpaque(mOpaque);
123
+ }
124
+ }
125
+
126
+ void dropInstance() {
127
+ unregisterView();
128
+ }
129
+
130
+ @Override
131
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
132
+ super.onLayout(changed, left, top, right, bottom);
133
+ if (mView != null) {
134
+ mView.layout(0, 0, right - left, bottom - top);
135
+ }
136
+ }
137
+
138
+ // SurfaceView callbacks: the native side receives an android.view.Surface.
139
+
140
+ @Override
141
+ public void onSurfaceCreated(Surface surface, int width, int height) {
142
+ surfaceAvailable(surface, width, height, true, mAppliedHighBitDepth);
143
+ }
144
+
145
+ @Override
146
+ public void onSurfaceChanged(Surface surface, int width, int height) {
147
+ Log.i(tag, "onSurfaceChanged " + width + "/" + height);
148
+ surfaceSizeChanged(surface, width, height, true, mAppliedHighBitDepth);
149
+ }
150
+
151
+ // TextureView callbacks: the native side receives a SurfaceTexture and
152
+ // drives updateTexImage itself. The 10-bit format is never used here.
153
+
154
+ @Override
155
+ public void onSurfaceTextureCreated(SurfaceTexture surface, int width, int height) {
156
+ surfaceAvailable(surface, width, height, false, false);
157
+ }
158
+
159
+ @Override
160
+ public void onSurfaceTextureChanged(SurfaceTexture surface, int width, int height) {
161
+ Log.i(tag, "onSurfaceTextureSizeChanged " + width + "/" + height);
162
+ surfaceSizeChanged(surface, width, height, false, false);
163
+ }
164
+
165
+ @Override
166
+ public void onSurfaceDestroyed() {
167
+ surfaceDestroyed();
168
+ }
169
+
170
+ // isSurface tells the native side whether `surface` is an
171
+ // android.view.Surface (SurfaceView) or a SurfaceTexture (TextureView).
172
+ protected abstract void surfaceAvailable(Object surface, int width, int height, boolean isSurface, boolean highBitDepth);
173
+
174
+ protected abstract void surfaceSizeChanged(Object surface, int width, int height, boolean isSurface, boolean highBitDepth);
175
+
176
+ protected abstract void surfaceDestroyed();
177
+
178
+ protected abstract void setDebugMode(boolean show);
179
+
180
+ protected abstract void registerView(int nativeId);
181
+
182
+ protected abstract void unregisterView();
183
+
184
+ protected abstract int[] getBitmap(int width, int height);
185
+ }
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import com.facebook.react.uimanager.PointerEvents;
4
4
  import com.facebook.react.uimanager.ViewProps;
@@ -33,6 +33,25 @@ public abstract class SkiaBaseViewManager<T extends SkiaBaseView> extends ReactV
33
33
  ((SkiaBaseView)view).setHighBitDepth(value);
34
34
  }
35
35
 
36
+ @ReactProp(name = "androidSurfaceType")
37
+ public void setAndroidSurfaceType(T view, @Nullable String value) {
38
+ ((SkiaBaseView)view).setSurfaceType(value);
39
+ }
40
+
41
+ @ReactProp(name = "androidZOrderOnTop")
42
+ public void setAndroidZOrderOnTop(T view, boolean value) {
43
+ ((SkiaBaseView)view).setZOrderOnTop(value);
44
+ }
45
+
46
+ // The backing view depends on several props (opaque, androidSurfaceType,
47
+ // androidZOrderOnTop, highBitDepth), so it is resolved once per transaction
48
+ // rather than in each setter.
49
+ @Override
50
+ protected void onAfterUpdateTransaction(@NonNull ReactViewGroup view) {
51
+ super.onAfterUpdateTransaction(view);
52
+ ((SkiaBaseView)view).updateView();
53
+ }
54
+
36
55
  @ReactProp(name = ViewProps.POINTER_EVENTS)
37
56
  public void setPointerEvents(T view, @Nullable String pointerEventsStr) {
38
57
  view.setPointerEvents(PointerEvents.parsePointerEvents(pointerEventsStr));
@@ -1,9 +1,10 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import com.facebook.jni.HybridData;
4
4
  import com.facebook.proguard.annotations.DoNotStrip;
5
5
  import com.facebook.react.bridge.ReactContext;
6
- import com.facebook.react.bridge.RuntimeExecutor;
6
+ import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
7
+ import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
7
8
 
8
9
  @DoNotStrip
9
10
  public class SkiaManager {
@@ -22,11 +23,15 @@ public class SkiaManager {
22
23
  super();
23
24
  mContext = context;
24
25
 
25
- RuntimeExecutor runtimeExecutor = ReactNativeCompatible.getRuntimeExecutor(context);
26
+ CallInvokerHolder jsCallInvokerHolder = context.getJSCallInvokerHolder();
27
+ if (jsCallInvokerHolder == null) {
28
+ throw new IllegalStateException("React instance is not ready: no JS CallInvoker available");
29
+ }
26
30
 
27
31
  mPlatformContext = new PlatformContext(context);
28
32
 
29
- mHybridData = initHybrid(context.getJavaScriptContextHolder().get(), runtimeExecutor, mPlatformContext);
33
+ mHybridData = initHybrid(context.getJavaScriptContextHolder().get(),
34
+ (CallInvokerHolderImpl) jsCallInvokerHolder, mPlatformContext);
30
35
 
31
36
  initializeRuntime();
32
37
  }
@@ -44,10 +49,10 @@ public class SkiaManager {
44
49
  }
45
50
 
46
51
  // private C++ functions
47
- private native HybridData initHybrid(long jsContext, RuntimeExecutor runtimeExecutor,
52
+ private native HybridData initHybrid(long jsContext, CallInvokerHolderImpl jsCallInvokerHolder,
48
53
  PlatformContext platformContext);
49
54
 
50
55
  private native void initializeRuntime();
51
56
  public native void invalidate();
52
57
 
53
- }
58
+ }
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.graphics.Bitmap;
@@ -67,9 +67,9 @@ public class SkiaPictureView extends SkiaBaseView {
67
67
 
68
68
  private native HybridData initHybrid(SkiaManager skiaManager);
69
69
 
70
- protected native void surfaceAvailable(Object surface, int width, int height, boolean opaque, boolean highBitDepth);
70
+ protected native void surfaceAvailable(Object surface, int width, int height, boolean isSurface, boolean highBitDepth);
71
71
 
72
- protected native void surfaceSizeChanged(Object surface, int width, int height, boolean opaque, boolean highBitDepth);
72
+ protected native void surfaceSizeChanged(Object surface, int width, int height, boolean isSurface, boolean highBitDepth);
73
73
 
74
74
  protected native void surfaceDestroyed();
75
75
 
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import com.facebook.react.uimanager.ThemedReactContext;
4
4
  import com.facebook.react.viewmanagers.SkiaPictureViewManagerDelegate;
@@ -1,7 +1,8 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.annotation.SuppressLint;
4
4
  import android.content.Context;
5
+ import android.graphics.PixelFormat;
5
6
  import android.view.SurfaceHolder;
6
7
  import android.view.SurfaceView;
7
8
  import androidx.annotation.NonNull;
@@ -12,13 +13,22 @@ public class SkiaSurfaceView extends SurfaceView implements SurfaceHolder.Callba
12
13
  SkiaViewAPI mApi;
13
14
  boolean mDebug;
14
15
 
15
- public SkiaSurfaceView(Context context, SkiaViewAPI api, boolean debug) {
16
+ public SkiaSurfaceView(Context context, SkiaViewAPI api, boolean debug, boolean zOrderOnTop, boolean opaque) {
16
17
  super(context);
17
18
  mApi = api;
18
19
  mDebug = debug;
20
+ // Must be set before the surface is created.
21
+ setZOrderOnTop(zOrderOnTop);
22
+ setOpaque(opaque);
19
23
  getHolder().addCallback(this);
20
24
  }
21
25
 
26
+ // The format drives the compositor's opaque flag for this layer. It can
27
+ // change on a live surface: SurfaceView reports it through surfaceChanged.
28
+ public void setOpaque(boolean opaque) {
29
+ getHolder().setFormat(opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT);
30
+ }
31
+
22
32
  @Override
23
33
  protected void onDetachedFromWindow() {
24
34
  super.onDetachedFromWindow();
@@ -39,4 +49,4 @@ public class SkiaSurfaceView extends SurfaceView implements SurfaceHolder.Callba
39
49
  public void surfaceDestroyed(@NonNull SurfaceHolder holder) {
40
50
  mApi.onSurfaceDestroyed();
41
51
  }
42
- }
52
+ }
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.annotation.SuppressLint;
4
4
  import android.content.Context;
@@ -16,11 +16,13 @@ public class SkiaTextureView extends TextureView implements TextureView.SurfaceT
16
16
  SkiaViewAPI mApi;
17
17
  boolean mDebug;
18
18
 
19
- public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug) {
19
+ public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug, boolean opaque) {
20
20
  super(context);
21
21
  mApi = api;
22
22
  mDebug = debug;
23
- setOpaque(false);
23
+ // An opaque TextureView lets the UI toolkit skip blending it; it can be
24
+ // toggled on a live view.
25
+ setOpaque(opaque);
24
26
  setSurfaceTextureListener(this);
25
27
  }
26
28
 
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.graphics.SurfaceTexture;
4
4
  import android.view.Surface;
@@ -1,4 +1,4 @@
1
- package com.shopify.reactnative.skia;
1
+ package com.reactnative.skia;
2
2
 
3
3
  import android.graphics.Bitmap;
4
4
  import android.graphics.Canvas;
@@ -19,10 +19,11 @@ import android.widget.ScrollView;
19
19
  import androidx.annotation.NonNull;
20
20
  import com.facebook.react.bridge.ReactContext;
21
21
  import com.facebook.react.bridge.UIManager;
22
+ import com.facebook.react.uimanager.BackgroundStyleApplicator;
22
23
  import com.facebook.react.uimanager.UIManagerHelper;
24
+ import com.facebook.react.uimanager.ViewProps;
23
25
  import com.facebook.react.views.view.ReactViewGroup;
24
26
 
25
- import java.lang.reflect.Method;
26
27
  import java.util.concurrent.CountDownLatch;
27
28
  import java.util.concurrent.TimeUnit;
28
29
 
@@ -118,17 +119,13 @@ public class ViewScreenshotService {
118
119
  }
119
120
 
120
121
  private static void drawChildren(Canvas canvas, ViewGroup group, Paint paint, float parentOpacity) {
121
- // Handle clipping for ReactViewGroup
122
- if (group instanceof ReactViewGroup) {
123
- try {
124
- Class[] cArg = new Class[1];
125
- cArg[0] = Canvas.class;
126
- Method method = ReactViewGroup.class.getDeclaredMethod("dispatchOverflowDraw", cArg);
127
- method.setAccessible(true);
128
- method.invoke(group, canvas);
129
- } catch (Exception e) {
130
- Log.e(TAG, "couldn't invoke dispatchOverflowDraw() on ReactViewGroup", e);
131
- }
122
+ // ReactViewGroup applies `overflow: hidden` / `overflow: scroll` clipping from its
123
+ // dispatchDraw() override. We never call dispatchDraw() here because children are
124
+ // walked manually (TextureView / SurfaceView need special handling), so the clip has
125
+ // to be replicated explicitly, exactly as ReactViewGroup.dispatchDraw() does it.
126
+ if (group instanceof ReactViewGroup
127
+ && !ViewProps.VISIBLE.equals(((ReactViewGroup) group).getOverflow())) {
128
+ BackgroundStyleApplicator.clipToPaddingBox(group, canvas);
132
129
  }
133
130
  for (int i = 0; i < group.getChildCount(); i++) {
134
131
  View child = group.getChildAt(i);
@@ -31,7 +31,7 @@ MetalContext::MetalContext() {
31
31
  GrContextOptions grContextOptions; // set different options here.
32
32
 
33
33
  // Create the Skia Direct Context
34
- _directContext = GrDirectContexts::MakeMetal(backendContext);
34
+ _directContext = GrDirectContexts::MakeMetal(backendContext, grContextOptions);
35
35
  if (_directContext == nullptr) {
36
36
  RNSkia::RNSkLogger::logToConsole("Couldn't create a Skia Metal Context");
37
37
  }
@@ -63,9 +63,6 @@ public:
63
63
 
64
64
  std::shared_ptr<RNSkVideo> createVideo(const std::string &url) override;
65
65
 
66
- std::shared_ptr<WindowContext>
67
- makeContextFromNativeSurface(void *surface, int width, int height) override;
68
-
69
66
  virtual void performStreamOperation(
70
67
  const std::string &sourceUri,
71
68
  const std::function<void(std::unique_ptr<SkStreamAsset>)> &op) override;
@@ -307,17 +307,6 @@ RNSkApplePlatformContext::createVideo(const std::string &url) {
307
307
  return std::make_shared<RNSkAppleVideo>(url, this);
308
308
  }
309
309
 
310
- std::shared_ptr<WindowContext>
311
- RNSkApplePlatformContext::makeContextFromNativeSurface(void *surface, int width,
312
- int height) {
313
- #if defined(SK_GRAPHITE)
314
- return DawnContext::getInstance().MakeWindow(surface, width, height);
315
- #else
316
- return MetalContext::getInstance().MakeWindow((__bridge CALayer *)surface,
317
- width, height);
318
- #endif
319
- }
320
-
321
310
  void RNSkApplePlatformContext::raiseError(const std::exception &err) {
322
311
  RCTFatal(RCTErrorWithMessage([NSString stringWithUTF8String:err.what()]));
323
312
  }
@@ -1,19 +1,10 @@
1
1
  #pragma once
2
2
 
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
3
  #import <rnskia/rnskia.h>
5
- #else
6
- #import <React/RCTBridgeModule.h>
7
- #endif
8
4
 
9
5
  #include "SkiaManager.h"
10
6
 
11
- @interface RNSkiaModule : NSObject
12
- #ifdef RCT_NEW_ARCH_ENABLED
13
- <NativeSkiaModuleSpec>
14
- #else
15
- <RCTBridgeModule>
16
- #endif
7
+ @interface RNSkiaModule : NSObject <NativeSkiaModuleSpec>
17
8
 
18
9
  - (SkiaManager *)manager;
19
10
 
@@ -1,6 +1,5 @@
1
1
 
2
2
  #import "RNSkiaModule.h"
3
- #import <React/RCTBridge+Private.h>
4
3
  #import <ReactCommon/RCTTurboModule.h>
5
4
 
6
5
  @implementation RNSkiaModule {
@@ -35,14 +34,9 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
35
34
  // Already initialized, ignore call.
36
35
  return @true;
37
36
  }
38
- #ifndef RCT_REMOVE_LEGACY_ARCH
39
37
  if (!jsInvoker) {
40
- RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
41
- jsInvoker = cxxBridge.jsCallInvoker;
42
- }
43
- #endif
44
- if (!jsInvoker) {
45
- NSLog(@"[RNSkiaModule] Failed to install SkiaManager: jsInvoker is not initialized.");
38
+ NSLog(@"[RNSkiaModule] Failed to install SkiaManager: jsInvoker is not "
39
+ @"initialized.");
46
40
  return @false;
47
41
  }
48
42
  skiaManager = [[SkiaManager alloc] initWithBridge:self.bridge
@@ -50,12 +44,10 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
50
44
  return @true;
51
45
  }
52
46
 
53
- #ifdef RCT_NEW_ARCH_ENABLED
54
47
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
55
48
  (const facebook::react::ObjCTurboModule::InitParams &)params {
56
49
  jsInvoker = params.jsInvoker;
57
50
  return std::make_shared<facebook::react::NativeSkiaModuleSpecJSI>(params);
58
51
  }
59
- #endif
60
52
 
61
53
  @end
@@ -16,10 +16,8 @@
16
16
  jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)
17
17
  jsInvoker;
18
18
 
19
- #ifdef RCT_NEW_ARCH_ENABLED
20
19
  // Fabric components do not have a better way to interact with TurboModules.
21
20
  // Workaround to get the SkManager instance from singleton.
22
21
  + (std::shared_ptr<RNSkia::RNSkManager>)latestActiveSkManager;
23
- #endif // RCT_NEW_ARCH_ENABLED
24
22
 
25
23
  @end
@@ -7,10 +7,9 @@
7
7
 
8
8
  #import "RNSkApplePlatformContext.h"
9
9
 
10
- // Forward-declared runtime accessor that is satisfied by RCTCxxBridge
11
- // (legacy/transitional) and RCTBridgeProxy (bridgeless). Avoids referencing
12
- // RCTCxxBridge directly, which is compiled out when RCT_REMOVE_LEGACY_ARCH
13
- // is set (React Native 0.82+).
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+).
14
13
  @interface RCTBridge (RNSkiaRuntime)
15
14
  - (void *)runtime;
16
15
  @end
@@ -54,12 +53,11 @@ static __weak SkiaManager *sharedInstance = nil;
54
53
  sharedInstance = nil;
55
54
  }
56
55
 
57
- #ifdef RCT_NEW_ARCH_ENABLED
58
56
  + (std::shared_ptr<RNSkia::RNSkManager>)latestActiveSkManager {
59
57
  if (sharedInstance != nil) {
60
58
  return [sharedInstance skManager];
61
59
  }
62
60
  return nullptr;
63
61
  }
64
- #endif // RCT_NEW_ARCH_ENABLED
62
+
65
63
  @end
@@ -1,7 +1,7 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
1
+ #pragma once
2
+
2
3
  #import "SkiaUIView.h"
3
4
 
4
5
  @interface SkiaPictureView : SkiaUIView
5
6
 
6
7
  @end
7
- #endif // RCT_NEW_ARCH_ENABLED
@@ -1,4 +1,3 @@
1
- #ifdef RCT_NEW_ARCH_ENABLED
2
1
  #import "SkiaPictureView.h"
3
2
 
4
3
  #import "RNSkAppleView.h"
@@ -9,7 +8,6 @@
9
8
  #import "SkiaManager.h"
10
9
  #import "SkiaUIView.h"
11
10
 
12
- #import <React/RCTBridge+Private.h>
13
11
  #import <React/RCTConversions.h>
14
12
  #import <React/RCTFabricComponentsPlugins.h>
15
13
 
@@ -70,5 +68,3 @@ using namespace facebook::react;
70
68
  Class<RCTComponentViewProtocol> SkiaPictureViewCls(void) {
71
69
  return SkiaPictureView.class;
72
70
  }
73
-
74
- #endif // RCT_NEW_ARCH_ENABLED