@shopify/react-native-skia 0.1.190 → 0.1.192

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. package/cpp/api/JsiSkColorFilter.h +2 -17
  2. package/cpp/api/JsiSkContourMeasure.h +3 -17
  3. package/cpp/api/JsiSkContourMeasureIter.h +3 -18
  4. package/cpp/api/JsiSkData.h +1 -18
  5. package/cpp/api/JsiSkFont.h +4 -14
  6. package/cpp/api/JsiSkHostObjects.h +85 -10
  7. package/cpp/api/JsiSkImage.h +1 -12
  8. package/cpp/api/JsiSkImageFilter.h +1 -17
  9. package/cpp/api/JsiSkMaskFilter.h +1 -17
  10. package/cpp/api/JsiSkMatrix.h +3 -6
  11. package/cpp/api/JsiSkPaint.h +3 -15
  12. package/cpp/api/JsiSkPath.h +2 -15
  13. package/cpp/api/JsiSkPathEffect.h +2 -17
  14. package/cpp/api/JsiSkPicture.h +4 -18
  15. package/cpp/api/JsiSkPictureRecorder.h +4 -1
  16. package/cpp/api/JsiSkPoint.h +6 -1
  17. package/cpp/api/JsiSkRRect.h +6 -1
  18. package/cpp/api/JsiSkRSXform.h +4 -6
  19. package/cpp/api/JsiSkRect.h +6 -2
  20. package/cpp/api/JsiSkRuntimeEffect.h +4 -7
  21. package/cpp/api/JsiSkRuntimeShaderBuilder.h +2 -10
  22. package/cpp/api/JsiSkSVG.h +1 -10
  23. package/cpp/api/JsiSkShader.h +2 -16
  24. package/cpp/api/JsiSkSurface.h +3 -16
  25. package/cpp/api/JsiSkTextBlob.h +2 -18
  26. package/cpp/api/JsiSkTypeface.h +1 -22
  27. package/cpp/api/JsiSkVertices.h +3 -17
  28. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +24 -3
  29. package/cpp/rnskia/dom/nodes/JsiPathNode.h +11 -11
  30. package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -2
  31. package/cpp/rnskia/values/RNSkValue.h +1 -1
  32. package/lib/commonjs/Platform/Platform.web.js +1 -1
  33. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  34. package/lib/commonjs/dom/nodes/drawings/ImageSVG.d.ts +7 -2
  35. package/lib/commonjs/dom/nodes/drawings/ImageSVG.js +29 -7
  36. package/lib/commonjs/dom/nodes/drawings/ImageSVG.js.map +1 -1
  37. package/lib/commonjs/dom/nodes/drawings/PathNode.js +6 -2
  38. package/lib/commonjs/dom/nodes/drawings/PathNode.js.map +1 -1
  39. package/lib/commonjs/dom/types/Drawings.d.ts +7 -2
  40. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  41. package/lib/commonjs/renderer/Canvas.js +17 -1
  42. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  43. package/lib/commonjs/renderer/processors/math/Math.d.ts +1 -0
  44. package/lib/commonjs/renderer/processors/math/Math.js +9 -1
  45. package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
  46. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  47. package/lib/commonjs/skia/core/Data.js.map +1 -1
  48. package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
  49. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  50. package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
  51. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  52. package/lib/commonjs/skia/types/JsiInstance.d.ts +4 -4
  53. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  54. package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
  55. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  56. package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
  57. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  58. package/lib/commonjs/skia/web/Host.d.ts +1 -0
  59. package/lib/commonjs/skia/web/Host.js +2 -0
  60. package/lib/commonjs/skia/web/Host.js.map +1 -1
  61. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -0
  62. package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -0
  63. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  64. package/lib/commonjs/skia/web/JsiSkColorFilter.d.ts +1 -0
  65. package/lib/commonjs/skia/web/JsiSkColorFilter.js +6 -0
  66. package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
  67. package/lib/commonjs/skia/web/JsiSkContourMeasure.d.ts +1 -0
  68. package/lib/commonjs/skia/web/JsiSkContourMeasure.js +6 -0
  69. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
  70. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  71. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +6 -0
  72. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  73. package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -1
  74. package/lib/commonjs/skia/web/JsiSkData.js +4 -2
  75. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  76. package/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -0
  77. package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
  78. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  79. package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -1
  80. package/lib/commonjs/skia/web/JsiSkImage.js +6 -4
  81. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  82. package/lib/commonjs/skia/web/JsiSkImageFilter.d.ts +1 -0
  83. package/lib/commonjs/skia/web/JsiSkImageFilter.js +6 -0
  84. package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
  85. package/lib/commonjs/skia/web/JsiSkMaskFilter.d.ts +1 -0
  86. package/lib/commonjs/skia/web/JsiSkMaskFilter.js +6 -0
  87. package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
  88. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +1 -0
  89. package/lib/commonjs/skia/web/JsiSkMatrix.js +5 -0
  90. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  91. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  92. package/lib/commonjs/skia/web/JsiSkPaint.js +6 -0
  93. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  94. package/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -0
  95. package/lib/commonjs/skia/web/JsiSkPath.js +6 -0
  96. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  97. package/lib/commonjs/skia/web/JsiSkPathEffect.d.ts +1 -0
  98. package/lib/commonjs/skia/web/JsiSkPathEffect.js +6 -0
  99. package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
  100. package/lib/commonjs/skia/web/JsiSkPicture.d.ts +1 -0
  101. package/lib/commonjs/skia/web/JsiSkPicture.js +6 -1
  102. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  103. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  104. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +6 -0
  105. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  106. package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -0
  107. package/lib/commonjs/skia/web/JsiSkPoint.js +5 -0
  108. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  109. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +1 -0
  110. package/lib/commonjs/skia/web/JsiSkRRect.js +5 -0
  111. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  112. package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -0
  113. package/lib/commonjs/skia/web/JsiSkRSXform.js +5 -0
  114. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  115. package/lib/commonjs/skia/web/JsiSkRect.d.ts +1 -0
  116. package/lib/commonjs/skia/web/JsiSkRect.js +5 -0
  117. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  118. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  119. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -0
  120. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  121. package/lib/commonjs/skia/web/JsiSkShader.d.ts +1 -0
  122. package/lib/commonjs/skia/web/JsiSkShader.js +6 -0
  123. package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
  124. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  125. package/lib/commonjs/skia/web/JsiSkSurface.js +6 -0
  126. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  127. package/lib/commonjs/skia/web/JsiSkTextBlob.d.ts +1 -0
  128. package/lib/commonjs/skia/web/JsiSkTextBlob.js +6 -0
  129. package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
  130. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -1
  131. package/lib/commonjs/skia/web/JsiSkTypeface.js +6 -4
  132. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  133. package/lib/commonjs/skia/web/JsiSkVertices.d.ts +1 -0
  134. package/lib/commonjs/skia/web/JsiSkVertices.js +6 -0
  135. package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
  136. package/lib/commonjs/values/hooks/useComputedValue.js +1 -1
  137. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  138. package/lib/commonjs/values/types.d.ts +1 -1
  139. package/lib/commonjs/values/types.js.map +1 -1
  140. package/lib/commonjs/values/web/RNSkComputedValue.d.ts +1 -1
  141. package/lib/commonjs/values/web/RNSkComputedValue.js +1 -1
  142. package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
  143. package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +1 -1
  144. package/lib/commonjs/values/web/RNSkReadonlyValue.js +1 -1
  145. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
  146. package/lib/commonjs/views/SkiaBaseWebView.js +9 -4
  147. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  148. package/lib/commonjs/views/SkiaDomView.web.js +14 -4
  149. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  150. package/lib/commonjs/views/types.d.ts +2 -1
  151. package/lib/commonjs/views/types.js.map +1 -1
  152. package/lib/module/Platform/Platform.web.js +1 -1
  153. package/lib/module/Platform/Platform.web.js.map +1 -1
  154. package/lib/module/dom/nodes/drawings/ImageSVG.d.ts +7 -2
  155. package/lib/module/dom/nodes/drawings/ImageSVG.js +29 -6
  156. package/lib/module/dom/nodes/drawings/ImageSVG.js.map +1 -1
  157. package/lib/module/dom/nodes/drawings/PathNode.js +5 -2
  158. package/lib/module/dom/nodes/drawings/PathNode.js.map +1 -1
  159. package/lib/module/dom/types/Drawings.d.ts +7 -2
  160. package/lib/module/dom/types/Drawings.js.map +1 -1
  161. package/lib/module/renderer/Canvas.js +15 -1
  162. package/lib/module/renderer/Canvas.js.map +1 -1
  163. package/lib/module/renderer/processors/math/Math.d.ts +1 -0
  164. package/lib/module/renderer/processors/math/Math.js +5 -0
  165. package/lib/module/renderer/processors/math/Math.js.map +1 -1
  166. package/lib/module/skia/core/Data.d.ts +2 -2
  167. package/lib/module/skia/core/Data.js.map +1 -1
  168. package/lib/module/skia/types/Data/Data.d.ts +2 -2
  169. package/lib/module/skia/types/Data/Data.js.map +1 -1
  170. package/lib/module/skia/types/Image/Image.d.ts +2 -2
  171. package/lib/module/skia/types/Image/Image.js.map +1 -1
  172. package/lib/module/skia/types/JsiInstance.d.ts +4 -4
  173. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  174. package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
  175. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  176. package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
  177. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  178. package/lib/module/skia/web/Host.d.ts +1 -0
  179. package/lib/module/skia/web/Host.js +2 -0
  180. package/lib/module/skia/web/Host.js.map +1 -1
  181. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -0
  182. package/lib/module/skia/web/JsiSkCanvas.js +6 -0
  183. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  184. package/lib/module/skia/web/JsiSkColorFilter.d.ts +1 -0
  185. package/lib/module/skia/web/JsiSkColorFilter.js +6 -0
  186. package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
  187. package/lib/module/skia/web/JsiSkContourMeasure.d.ts +1 -0
  188. package/lib/module/skia/web/JsiSkContourMeasure.js +6 -0
  189. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  190. package/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  191. package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -0
  192. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  193. package/lib/module/skia/web/JsiSkData.d.ts +1 -1
  194. package/lib/module/skia/web/JsiSkData.js +4 -2
  195. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  196. package/lib/module/skia/web/JsiSkFont.d.ts +1 -0
  197. package/lib/module/skia/web/JsiSkFont.js +6 -0
  198. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  199. package/lib/module/skia/web/JsiSkImage.d.ts +1 -1
  200. package/lib/module/skia/web/JsiSkImage.js +6 -4
  201. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkImageFilter.d.ts +1 -0
  203. package/lib/module/skia/web/JsiSkImageFilter.js +6 -0
  204. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
  205. package/lib/module/skia/web/JsiSkMaskFilter.d.ts +1 -0
  206. package/lib/module/skia/web/JsiSkMaskFilter.js +6 -0
  207. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
  208. package/lib/module/skia/web/JsiSkMatrix.d.ts +1 -0
  209. package/lib/module/skia/web/JsiSkMatrix.js +5 -0
  210. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  211. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  212. package/lib/module/skia/web/JsiSkPaint.js +6 -0
  213. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  214. package/lib/module/skia/web/JsiSkPath.d.ts +1 -0
  215. package/lib/module/skia/web/JsiSkPath.js +6 -0
  216. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  217. package/lib/module/skia/web/JsiSkPathEffect.d.ts +1 -0
  218. package/lib/module/skia/web/JsiSkPathEffect.js +6 -0
  219. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
  220. package/lib/module/skia/web/JsiSkPicture.d.ts +1 -0
  221. package/lib/module/skia/web/JsiSkPicture.js +6 -0
  222. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  223. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  224. package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -0
  225. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  226. package/lib/module/skia/web/JsiSkPoint.d.ts +1 -0
  227. package/lib/module/skia/web/JsiSkPoint.js +5 -0
  228. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  229. package/lib/module/skia/web/JsiSkRRect.d.ts +1 -0
  230. package/lib/module/skia/web/JsiSkRRect.js +5 -0
  231. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  232. package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -0
  233. package/lib/module/skia/web/JsiSkRSXform.js +5 -0
  234. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  235. package/lib/module/skia/web/JsiSkRect.d.ts +1 -0
  236. package/lib/module/skia/web/JsiSkRect.js +5 -0
  237. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  238. package/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  239. package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -0
  240. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  241. package/lib/module/skia/web/JsiSkShader.d.ts +1 -0
  242. package/lib/module/skia/web/JsiSkShader.js +6 -0
  243. package/lib/module/skia/web/JsiSkShader.js.map +1 -1
  244. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  245. package/lib/module/skia/web/JsiSkSurface.js +6 -0
  246. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  247. package/lib/module/skia/web/JsiSkTextBlob.d.ts +1 -0
  248. package/lib/module/skia/web/JsiSkTextBlob.js +6 -0
  249. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
  250. package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -1
  251. package/lib/module/skia/web/JsiSkTypeface.js +6 -4
  252. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  253. package/lib/module/skia/web/JsiSkVertices.d.ts +1 -0
  254. package/lib/module/skia/web/JsiSkVertices.js +6 -0
  255. package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
  256. package/lib/module/values/hooks/useComputedValue.js +1 -1
  257. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  258. package/lib/module/values/types.d.ts +1 -1
  259. package/lib/module/values/types.js.map +1 -1
  260. package/lib/module/values/web/RNSkComputedValue.d.ts +1 -1
  261. package/lib/module/values/web/RNSkComputedValue.js +1 -1
  262. package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
  263. package/lib/module/values/web/RNSkReadonlyValue.d.ts +1 -1
  264. package/lib/module/values/web/RNSkReadonlyValue.js +1 -1
  265. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
  266. package/lib/module/views/SkiaBaseWebView.js +9 -4
  267. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  268. package/lib/module/views/SkiaDomView.web.js +13 -4
  269. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  270. package/lib/module/views/types.d.ts +2 -1
  271. package/lib/module/views/types.js.map +1 -1
  272. package/lib/typescript/src/dom/nodes/drawings/ImageSVG.d.ts +7 -2
  273. package/lib/typescript/src/dom/types/Drawings.d.ts +7 -2
  274. package/lib/typescript/src/renderer/processors/math/Math.d.ts +1 -0
  275. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  276. package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
  277. package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
  278. package/lib/typescript/src/skia/types/JsiInstance.d.ts +4 -4
  279. package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
  280. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
  281. package/lib/typescript/src/skia/web/Host.d.ts +1 -0
  282. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -0
  283. package/lib/typescript/src/skia/web/JsiSkColorFilter.d.ts +1 -0
  284. package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +1 -0
  285. package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  286. package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -1
  287. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
  288. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -1
  289. package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +1 -0
  290. package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +1 -0
  291. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
  292. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  293. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +1 -0
  294. package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +1 -0
  295. package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +1 -0
  296. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  297. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -0
  298. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -0
  299. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -0
  300. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -0
  301. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  302. package/lib/typescript/src/skia/web/JsiSkShader.d.ts +1 -0
  303. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
  304. package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +1 -0
  305. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -1
  306. package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +1 -0
  307. package/lib/typescript/src/values/types.d.ts +1 -1
  308. package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -1
  309. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -1
  310. package/lib/typescript/src/views/types.d.ts +2 -1
  311. package/package.json +4 -1
  312. package/scripts/install-npm.js +2 -3
  313. package/src/Platform/Platform.web.tsx +1 -1
  314. package/src/dom/nodes/drawings/ImageSVG.ts +17 -6
  315. package/src/dom/nodes/drawings/PathNode.ts +10 -1
  316. package/src/dom/types/Drawings.ts +7 -2
  317. package/src/renderer/Canvas.tsx +21 -1
  318. package/src/renderer/processors/math/Math.ts +5 -0
  319. package/src/skia/core/Data.ts +3 -3
  320. package/src/skia/types/Data/Data.ts +2 -2
  321. package/src/skia/types/Image/Image.ts +2 -2
  322. package/src/skia/types/JsiInstance.ts +4 -4
  323. package/src/skia/types/SVG/SVG.ts +2 -2
  324. package/src/skia/types/Typeface/Typeface.ts +2 -2
  325. package/src/skia/web/Host.ts +2 -0
  326. package/src/skia/web/JsiSkCanvas.ts +4 -0
  327. package/src/skia/web/JsiSkColorFilter.ts +4 -0
  328. package/src/skia/web/JsiSkContourMeasure.ts +4 -0
  329. package/src/skia/web/JsiSkContourMeasureIter.ts +4 -0
  330. package/src/skia/web/JsiSkData.ts +3 -3
  331. package/src/skia/web/JsiSkFont.ts +4 -0
  332. package/src/skia/web/JsiSkImage.ts +2 -2
  333. package/src/skia/web/JsiSkImageFilter.ts +4 -0
  334. package/src/skia/web/JsiSkMaskFilter.ts +4 -0
  335. package/src/skia/web/JsiSkMatrix.ts +4 -0
  336. package/src/skia/web/JsiSkPaint.ts +4 -0
  337. package/src/skia/web/JsiSkPath.ts +4 -0
  338. package/src/skia/web/JsiSkPathEffect.ts +4 -0
  339. package/src/skia/web/JsiSkPicture.ts +4 -0
  340. package/src/skia/web/JsiSkPictureRecorder.ts +4 -0
  341. package/src/skia/web/JsiSkPoint.ts +4 -0
  342. package/src/skia/web/JsiSkRRect.ts +4 -0
  343. package/src/skia/web/JsiSkRSXform.ts +4 -0
  344. package/src/skia/web/JsiSkRect.ts +4 -0
  345. package/src/skia/web/JsiSkRuntimeEffect.ts +4 -0
  346. package/src/skia/web/JsiSkShader.ts +4 -0
  347. package/src/skia/web/JsiSkSurface.ts +4 -0
  348. package/src/skia/web/JsiSkTextBlob.ts +4 -0
  349. package/src/skia/web/JsiSkTypeface.ts +2 -2
  350. package/src/skia/web/JsiSkVertices.ts +4 -0
  351. package/src/values/hooks/useComputedValue.ts +1 -1
  352. package/src/values/types.ts +1 -1
  353. package/src/values/web/RNSkComputedValue.ts +1 -1
  354. package/src/values/web/RNSkReadonlyValue.ts +1 -1
  355. package/src/views/SkiaBaseWebView.tsx +9 -4
  356. package/src/views/SkiaDomView.web.tsx +6 -1
  357. package/src/views/types.ts +2 -1
@@ -8,5 +8,5 @@ export declare class RNSkReadonlyValue<T> implements SkiaValue<T> {
8
8
  readonly __typename__ = "RNSkValue";
9
9
  get current(): T;
10
10
  addListener(cb: (value: T) => void): () => void;
11
- __invalidate(): void;
11
+ dispose(): void;
12
12
  }
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
2
2
  import type { GroupProps, RenderNode } from "../dom/types";
3
3
  import type { SkCanvas, SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
4
4
  import type { SkiaMutableValue, SkiaValue } from "../values";
5
+ import type { SharedValueType } from "../renderer/processors/Animations/Animations";
5
6
  export declare type DrawMode = "continuous" | "default";
6
7
  export declare type NativeSkiaViewProps = ViewProps & {
7
8
  mode?: DrawMode;
@@ -70,7 +71,7 @@ export interface SkiaBaseViewProps extends ViewProps {
70
71
  * Pass an animated value to the onSize property to get updates when
71
72
  * the Skia view is resized.
72
73
  */
73
- onSize?: SkiaMutableValue<SkSize>;
74
+ onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;
74
75
  }
75
76
  export interface SkiaDrawViewProps extends SkiaBaseViewProps {
76
77
  /**
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.190",
10
+ "version": "0.1.192",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -76,6 +76,9 @@
76
76
  "peerDependenciesMeta": {
77
77
  "react-native-reanimated": {
78
78
  "optional": true
79
+ },
80
+ "react-native": {
81
+ "optional": true
79
82
  }
80
83
  },
81
84
  "devDependencies": {
@@ -8,10 +8,9 @@ const createSymlink = (p) => {
8
8
  const srcDir = path.resolve(`./cpp/${p}`);
9
9
  const dstDir = path.resolve(`./android/cpp/${p}`);
10
10
 
11
- if (fs.existsSync(dstDir)) {
12
- fs.unlinkSync(dstDir);
11
+ if (!fs.existsSync(dstDir) || !fs.lstatSync(dstDir).isSymbolicLink()) {
12
+ fs.symlinkSync(srcDir, dstDir, "junction");
13
13
  }
14
- fs.symlinkSync(srcDir, dstDir, "junction");
15
14
  };
16
15
 
17
16
  // Copy common cpp files from the package root to the android folder
@@ -99,7 +99,7 @@ const View = (({ children, onLayout, style: rawStyle }: ViewProps) => {
99
99
  return {
100
100
  ...style,
101
101
  display: "flex",
102
- flexDirection: style.flexDirection || "column",
102
+ flexDirection: style.flexDirection || "inherit",
103
103
  flexWrap: style.flexWrap || "nowrap",
104
104
  justifyContent: style.justifyContent || "flex-start",
105
105
  alignItems: style.alignItems || "stretch",
@@ -1,26 +1,37 @@
1
1
  import type { DrawingContext, ImageSVGProps } from "../../types";
2
2
  import { NodeType } from "../../types";
3
- import { processRect } from "../datatypes";
4
3
  import { JsiDrawingNode } from "../DrawingNode";
5
4
  import type { NodeContext } from "../Node";
6
5
 
7
- export class ImageSVGNode extends JsiDrawingNode<ImageSVGProps, null> {
6
+ export class ImageSVGNode extends JsiDrawingNode<
7
+ ImageSVGProps,
8
+ Pick<ImageSVGProps, "x" | "y" | "width" | "height">
9
+ > {
8
10
  constructor(ctx: NodeContext, props: ImageSVGProps) {
9
11
  super(ctx, NodeType.ImageSVG, props);
10
12
  }
11
13
 
12
14
  deriveProps() {
13
- return null;
15
+ if (this.props.rect) {
16
+ return this.props.rect;
17
+ }
18
+ const { x, y, width, height } = this.props;
19
+ return { x, y, width, height };
14
20
  }
15
21
 
16
22
  draw({ canvas }: DrawingContext) {
17
23
  const { svg } = this.props;
18
- if (!svg) {
24
+ if (!this.derived) {
25
+ throw new Error("ImageSVGNode: derived props unresolved");
26
+ }
27
+ const { x, y, width, height } = this.derived;
28
+ if (svg === null) {
19
29
  return;
20
30
  }
21
- const { x, y, width, height } = processRect(this.Skia, this.props);
22
31
  canvas.save();
23
- canvas.translate(x, y);
32
+ if (x && y) {
33
+ canvas.translate(x, y);
34
+ }
24
35
  canvas.drawSvg(svg, width, height);
25
36
  canvas.restore();
26
37
  }
@@ -1,3 +1,4 @@
1
+ import { saturate } from "../../../renderer/processors/math";
1
2
  import { FillType } from "../../../skia/types";
2
3
  import type { SkPath } from "../../../skia/types";
3
4
  import type { DrawingContext, PathProps } from "../../types";
@@ -12,7 +13,15 @@ export class PathNode extends JsiDrawingNode<PathProps, SkPath> {
12
13
  }
13
14
 
14
15
  protected deriveProps() {
15
- const { start, end, fillType, stroke, ...pathProps } = this.props;
16
+ const {
17
+ start: trimStart,
18
+ end: trimEnd,
19
+ fillType,
20
+ stroke,
21
+ ...pathProps
22
+ } = this.props;
23
+ const start = saturate(trimStart);
24
+ const end = saturate(trimEnd);
16
25
  const hasStartOffset = start !== 0;
17
26
  const hasEndOffset = end !== 1;
18
27
  const hasStrokeOptions = stroke !== undefined;
@@ -90,9 +90,14 @@ export interface VerticesProps extends DrawingNodeProps {
90
90
  indices?: number[];
91
91
  }
92
92
 
93
- export type ImageSVGProps = RectDef & {
93
+ export interface ImageSVGProps extends DrawingNodeProps {
94
94
  svg: SkSVG | null;
95
- } & DrawingNodeProps;
95
+ x?: number;
96
+ y?: number;
97
+ width?: number;
98
+ height?: number;
99
+ rect?: SkRect;
100
+ }
96
101
 
97
102
  export interface PictureProps extends DrawingNodeProps {
98
103
  picture: SkPicture;
@@ -17,9 +17,11 @@ import { Skia } from "../skia/Skia";
17
17
  import type { TouchHandler, SkiaBaseViewProps } from "../views";
18
18
  import type { SkiaValue } from "../values/types";
19
19
  import { JsiDrawingContext } from "../dom/types";
20
+ import { useValue } from "../values";
20
21
 
21
22
  import { SkiaRoot } from "./Reconciler";
22
23
  import { NATIVE_DOM } from "./HostComponents";
24
+ import { isValue } from "./processors";
23
25
 
24
26
  export const useCanvasRef = () => useRef<SkiaDomView>(null);
25
27
 
@@ -31,9 +33,27 @@ export interface CanvasProps extends SkiaBaseViewProps {
31
33
 
32
34
  export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
33
35
  (
34
- { children, style, debug, mode, onTouch, onSize, ...props },
36
+ {
37
+ children,
38
+ style,
39
+ debug,
40
+ mode,
41
+ onTouch,
42
+ onSize: onSizeReanimatedOrSkia,
43
+ ...props
44
+ },
35
45
  forwardedRef
36
46
  ) => {
47
+ const size = useValue({ width: 0, height: 0 });
48
+ const onSize = isValue(onSizeReanimatedOrSkia)
49
+ ? onSizeReanimatedOrSkia
50
+ : size;
51
+ useEffect(() => {
52
+ if (!isValue(onSizeReanimatedOrSkia) && onSizeReanimatedOrSkia) {
53
+ return size.addListener((v) => (onSizeReanimatedOrSkia.value = v));
54
+ }
55
+ return undefined;
56
+ }, [onSizeReanimatedOrSkia, size]);
37
57
  const innerRef = useCanvasRef();
38
58
  const ref = useCombinedRefs(forwardedRef, innerRef);
39
59
  const redraw = useCallback(() => {
@@ -24,3 +24,8 @@ export const clamp = (
24
24
  "worklet";
25
25
  return Math.min(Math.max(lowerBound, value), upperBound);
26
26
  };
27
+
28
+ export const saturate = (value: number) => {
29
+ "worklet";
30
+ return clamp(value, 0, 1);
31
+ };
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
 
3
3
  import { Skia } from "../Skia";
4
- import type { SkData, DataSourceParam, JsiDisposable } from "../types";
4
+ import type { SkData, DataSourceParam, BaseSkJSIInstance } from "../types";
5
5
  import { Platform } from "../../Platform";
6
6
 
7
7
  const factoryWrapper = <T>(
@@ -37,7 +37,7 @@ const loadData = <T>(
37
37
  );
38
38
  }
39
39
  };
40
- const useLoading = <T extends JsiDisposable>(
40
+ const useLoading = <T extends BaseSkJSIInstance>(
41
41
  source: DataSourceParam,
42
42
  loader: () => Promise<T | null>
43
43
  ) => {
@@ -61,7 +61,7 @@ const useLoading = <T extends JsiDisposable>(
61
61
  return data;
62
62
  };
63
63
 
64
- export const useRawData = <T extends JsiDisposable>(
64
+ export const useRawData = <T extends BaseSkJSIInstance>(
65
65
  source: DataSourceParam,
66
66
  factory: (data: SkData) => T | null,
67
67
  onError?: (err: Error) => void
@@ -1,6 +1,6 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export type SkData = SkJSIInstance<"Data"> & JsiDisposable;
3
+ export type SkData = SkJSIInstance<"Data">;
4
4
 
5
5
  type RNModule = number;
6
6
  type ESModule = {
@@ -1,5 +1,5 @@
1
1
  import type { SkMatrix } from "../Matrix";
2
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
+ import type { SkJSIInstance } from "../JsiInstance";
3
3
  import type { TileMode } from "../ImageFilter";
4
4
  import type { SkShader } from "../Shader";
5
5
 
@@ -20,7 +20,7 @@ export enum ImageFormat {
20
20
  WEBP = 6,
21
21
  }
22
22
 
23
- export interface SkImage extends SkJSIInstance<"Image">, JsiDisposable {
23
+ export interface SkImage extends SkJSIInstance<"Image"> {
24
24
  /**
25
25
  * Returns the possibly scaled height of the image.
26
26
  */
@@ -1,7 +1,7 @@
1
- export interface SkJSIInstance<T extends string> {
2
- __typename__: T;
1
+ export interface BaseSkJSIInstance {
2
+ dispose: () => void;
3
3
  }
4
4
 
5
- export interface JsiDisposable {
6
- dispose: () => void;
5
+ export interface SkJSIInstance<T extends string> extends BaseSkJSIInstance {
6
+ __typename__: T;
7
7
  }
@@ -1,6 +1,6 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export interface SkSVG extends SkJSIInstance<"SVG">, JsiDisposable {
3
+ export interface SkSVG extends SkJSIInstance<"SVG"> {
4
4
  width(): number;
5
5
  height(): number;
6
6
  }
@@ -1,3 +1,3 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export type SkTypeface = SkJSIInstance<"Typeface"> & JsiDisposable;
3
+ export type SkTypeface = SkJSIInstance<"Typeface">;
@@ -28,6 +28,8 @@ export abstract class BaseHostObject<T, N extends string>
28
28
  this.ref = ref;
29
29
  this.__typename__ = typename;
30
30
  }
31
+
32
+ abstract dispose: () => void;
31
33
  }
32
34
 
33
35
  export abstract class HostObject<T, N extends string> extends BaseHostObject<
@@ -46,6 +46,10 @@ export class JsiSkCanvas
46
46
  super(CanvasKit, ref, "Canvas");
47
47
  }
48
48
 
49
+ dispose = () => {
50
+ this.ref.delete();
51
+ };
52
+
49
53
  drawRect(rect: SkRect, paint: SkPaint) {
50
54
  this.ref.drawRect(
51
55
  JsiSkRect.fromValue(this.CanvasKit, rect),
@@ -11,4 +11,8 @@ export class JsiSkColorFilter
11
11
  constructor(CanvasKit: CanvasKit, ref: ColorFilter) {
12
12
  super(CanvasKit, ref, "ColorFilter");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -36,4 +36,8 @@ export class JsiSkContourMeasure
36
36
  length() {
37
37
  return this.ref.length();
38
38
  }
39
+
40
+ dispose = () => {
41
+ this.ref.delete();
42
+ };
39
43
  }
@@ -20,4 +20,8 @@ export class JsiSkContourMeasureIter
20
20
  }
21
21
  return new JsiSkContourMeasure(this.CanvasKit, result);
22
22
  }
23
+
24
+ dispose = () => {
25
+ this.ref.delete();
26
+ };
23
27
  }
@@ -11,7 +11,7 @@ export class JsiSkData extends HostObject<Data, "Data"> implements SkData {
11
11
  super(CanvasKit, ref, "Data");
12
12
  }
13
13
 
14
- dispose() {
15
- // Not implemented in data
16
- }
14
+ dispose = () => {
15
+ // Not implemented in data - since data is a raw ArrayBuffer
16
+ };
17
17
  }
@@ -20,6 +20,10 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
20
20
  super(CanvasKit, ref, "Font");
21
21
  }
22
22
 
23
+ dispose = () => {
24
+ this.ref.delete();
25
+ };
26
+
23
27
  getTextWidth(text: string, paint?: SkPaint | undefined) {
24
28
  const ids = this.getGlyphIDs(text);
25
29
  const widths = this.getGlyphWidths(ids, paint);
@@ -110,9 +110,9 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
110
110
  return toBase64String(bytes);
111
111
  }
112
112
 
113
- dispose() {
113
+ dispose = () => {
114
114
  this.ref.delete();
115
- }
115
+ };
116
116
 
117
117
  makeNonTextureImage(): SkImage {
118
118
  return new JsiSkImage(
@@ -11,4 +11,8 @@ export class JsiSkImageFilter
11
11
  constructor(CanvasKit: CanvasKit, ref: ImageFilter) {
12
12
  super(CanvasKit, ref, "ImageFilter");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -11,4 +11,8 @@ export class JsiSkMaskFilter
11
11
  constructor(CanvasKit: CanvasKit, ref: MaskFilter) {
12
12
  super(CanvasKit, ref, "MaskFilter");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -12,6 +12,10 @@ export class JsiSkMatrix
12
12
  super(CanvasKit, ref, "Matrix");
13
13
  }
14
14
 
15
+ dispose = () => {
16
+ // Do nothing - the matrix is represenetd by a Float32Array
17
+ };
18
+
15
19
  concat(matrix: SkMatrix) {
16
20
  this.ref.set(
17
21
  this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))
@@ -26,6 +26,10 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
26
26
  super(CanvasKit, ref, "Paint");
27
27
  }
28
28
 
29
+ dispose = () => {
30
+ this.ref.delete();
31
+ };
32
+
29
33
  copy() {
30
34
  return new JsiSkPaint(this.CanvasKit, this.ref.copy());
31
35
  }
@@ -33,6 +33,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
33
33
  super(CanvasKit, ref, "Path");
34
34
  }
35
35
 
36
+ dispose = () => {
37
+ this.ref.delete();
38
+ };
39
+
36
40
  addPath(src: SkPath, matrix?: SkMatrix, extend = false) {
37
41
  const args = [
38
42
  JsiSkPath.fromValue(src),
@@ -11,4 +11,8 @@ export class JsiSkPathEffect
11
11
  constructor(CanvasKit: CanvasKit, ref: PathEffect) {
12
12
  super(CanvasKit, ref, "PathEffect");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -22,6 +22,10 @@ export class JsiSkPicture
22
22
  super(CanvasKit, ref, "Picture");
23
23
  }
24
24
 
25
+ dispose = () => {
26
+ this.ref.delete();
27
+ };
28
+
25
29
  makeShader(
26
30
  tmx: TileMode,
27
31
  tmy: TileMode,
@@ -16,6 +16,10 @@ export class JsiSkPictureRecorder
16
16
  super(CanvasKit, ref, "PictureRecorder");
17
17
  }
18
18
 
19
+ dispose = () => {
20
+ this.ref.delete();
21
+ };
22
+
19
23
  beginRecording(bounds: SkRect) {
20
24
  return new JsiSkCanvas(
21
25
  this.CanvasKit,
@@ -19,6 +19,10 @@ export class JsiSkPoint
19
19
  super(CanvasKit, ref, "Point");
20
20
  }
21
21
 
22
+ dispose = () => {
23
+ // Float32Array
24
+ };
25
+
22
26
  get x() {
23
27
  return this.ref[0];
24
28
  }
@@ -9,6 +9,10 @@ export class JsiSkRRect
9
9
  extends BaseHostObject<RRect, "RRect">
10
10
  implements SkRRect
11
11
  {
12
+ dispose = () => {
13
+ // Float32Array
14
+ };
15
+
12
16
  static fromValue(CanvasKit: CanvasKit, rect: SkRRect) {
13
17
  if (rect instanceof JsiSkRect) {
14
18
  return rect.ref;
@@ -13,4 +13,8 @@ export class JsiSkRSXform
13
13
  constructor(CanvasKit: CanvasKit, ref: RSXform) {
14
14
  super(CanvasKit, ref, "RSXform");
15
15
  }
16
+
17
+ dispose = () => {
18
+ // Do nothing in the web implementation
19
+ };
16
20
  }
@@ -12,6 +12,10 @@ export class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkRect {
12
12
  return CanvasKit.XYWHRect(rect.x, rect.y, rect.width, rect.height);
13
13
  }
14
14
 
15
+ dispose = () => {
16
+ // Float32Array
17
+ };
18
+
15
19
  constructor(CanvasKit: CanvasKit, ref: Rect) {
16
20
  super(CanvasKit, ref, "Rect");
17
21
  }
@@ -15,6 +15,10 @@ export class JsiSkRuntimeEffect
15
15
  super(CanvasKit, ref, "RuntimeEffect");
16
16
  }
17
17
 
18
+ dispose = () => {
19
+ this.ref.delete();
20
+ };
21
+
18
22
  source() {
19
23
  return this.sksl;
20
24
  }
@@ -11,4 +11,8 @@ export class JsiSkShader
11
11
  constructor(CanvasKit: CanvasKit, ref: Shader) {
12
12
  super(CanvasKit, ref, "Shader");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -15,6 +15,10 @@ export class JsiSkSurface
15
15
  super(CanvasKit, ref, "Surface");
16
16
  }
17
17
 
18
+ dispose = () => {
19
+ this.ref.delete();
20
+ };
21
+
18
22
  flush() {
19
23
  this.ref.flush();
20
24
  }
@@ -11,4 +11,8 @@ export class JsiSkTextBlob
11
11
  constructor(CanvasKit: CanvasKit, ref: TextBlob) {
12
12
  super(CanvasKit, ref, "TextBlob");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -26,7 +26,7 @@ export class JsiSkTypeface
26
26
  return false;
27
27
  }
28
28
 
29
- dispose() {
29
+ dispose = () => {
30
30
  this.ref.delete();
31
- }
31
+ };
32
32
  }
@@ -13,6 +13,10 @@ export class JsiSkVertices
13
13
  super(CanvasKit, ref, "Vertices");
14
14
  }
15
15
 
16
+ dispose = () => {
17
+ this.ref.delete();
18
+ };
19
+
16
20
  bounds() {
17
21
  return new JsiSkRect(this.CanvasKit, this.ref.bounds());
18
22
  }
@@ -16,6 +16,6 @@ export const useComputedValue = <R>(cb: () => R, values: unknown[]) => {
16
16
  // eslint-disable-next-line react-hooks/exhaustive-deps
17
17
  values
18
18
  );
19
- useEffect(() => () => value.__invalidate(), [value]);
19
+ useEffect(() => () => value.dispose(), [value]);
20
20
  return value;
21
21
  };
@@ -11,7 +11,7 @@ export interface SkiaValue<T = number> {
11
11
  /**
12
12
  * Invalidates the value. Has different meaning depending on the type of the value.
13
13
  */
14
- __invalidate: () => void;
14
+ dispose: () => void;
15
15
  /**
16
16
  * Field to make typechecking easier
17
17
  */
@@ -42,7 +42,7 @@ export class RNSkComputedValue<T> extends RNSkReadonlyValue<T> {
42
42
  this._unsubscribers = [];
43
43
  }
44
44
 
45
- public __invalidate(): void {
45
+ public dispose(): void {
46
46
  this._unsubscribers.forEach((unsubscribe) => unsubscribe());
47
47
  this._unsubscribers = [];
48
48
  }
@@ -32,7 +32,7 @@ export class RNSkReadonlyValue<T> implements SkiaValue<T> {
32
32
  };
33
33
  }
34
34
 
35
- public __invalidate(): void {
35
+ public dispose(): void {
36
36
  this._listeners = [];
37
37
  }
38
38
  }
@@ -77,11 +77,16 @@ export abstract class SkiaBaseWebView<
77
77
  componentWillUnmount() {
78
78
  this.unsubscribeAll();
79
79
  cancelAnimationFrame(this.requestId);
80
+ // eslint-disable-next-line max-len
81
+ // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use
80
82
  // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context
81
- this._canvasRef.current
82
- ?.getContext("webgl2")
83
- ?.getExtension("WEBGL_lose_context")
84
- ?.loseContext();
83
+ // We delete the context, only if the context has been intialized
84
+ if (this._surface) {
85
+ this._canvasRef.current
86
+ ?.getContext("webgl2")
87
+ ?.getExtension("WEBGL_lose_context")
88
+ ?.loseContext();
89
+ }
85
90
  }
86
91
 
87
92
  /**