@shopify/react-native-skia 1.4.1 → 1.5.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 (136) hide show
  1. package/android/CMakeLists.txt +38 -6
  2. package/android/build.gradle +1 -0
  3. package/android/cpp/jni/JniSkiaManager.cpp +1 -1
  4. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -3
  5. package/android/cpp/jni/include/JniSkiaDomView.h +0 -6
  6. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -5
  7. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +3 -3
  8. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +2 -2
  9. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -20
  10. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +2 -2
  11. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +3 -3
  12. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -72
  13. package/cpp/api/JsiSkSurface.h +1 -1
  14. package/cpp/rnskia/RNSkDomView.cpp +0 -79
  15. package/cpp/rnskia/RNSkDomView.h +1 -39
  16. package/cpp/rnskia/RNSkPictureView.h +0 -1
  17. package/cpp/rnskia/RNSkView.h +0 -17
  18. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +1 -1
  19. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +2 -2
  20. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +2 -2
  21. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +1 -1
  22. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +1 -1
  23. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +2 -2
  24. package/ios/RNSkia-iOS/SkiaUIView.mm +0 -51
  25. package/lib/commonjs/mock/index.js +0 -1
  26. package/lib/commonjs/mock/index.js.map +1 -1
  27. package/lib/commonjs/renderer/Canvas.d.ts +1 -2
  28. package/lib/commonjs/renderer/Canvas.js +0 -3
  29. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  30. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  31. package/lib/commonjs/views/SkiaBaseWebView.d.ts +2 -11
  32. package/lib/commonjs/views/SkiaBaseWebView.js +3 -31
  33. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  34. package/lib/commonjs/views/SkiaDomView.js +0 -12
  35. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  36. package/lib/commonjs/views/SkiaDomView.web.d.ts +2 -2
  37. package/lib/commonjs/views/SkiaDomView.web.js +1 -6
  38. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  39. package/lib/commonjs/views/SkiaJSDomView.js +0 -12
  40. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
  41. package/lib/commonjs/views/index.d.ts +0 -1
  42. package/lib/commonjs/views/index.js +0 -11
  43. package/lib/commonjs/views/index.js.map +1 -1
  44. package/lib/commonjs/views/types.d.ts +0 -26
  45. package/lib/commonjs/views/types.js +0 -8
  46. package/lib/commonjs/views/types.js.map +1 -1
  47. package/lib/module/mock/index.js +0 -1
  48. package/lib/module/mock/index.js.map +1 -1
  49. package/lib/module/renderer/Canvas.d.ts +1 -2
  50. package/lib/module/renderer/Canvas.js +0 -3
  51. package/lib/module/renderer/Canvas.js.map +1 -1
  52. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  53. package/lib/module/views/SkiaBaseWebView.d.ts +2 -11
  54. package/lib/module/views/SkiaBaseWebView.js +3 -31
  55. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  56. package/lib/module/views/SkiaDomView.js +0 -12
  57. package/lib/module/views/SkiaDomView.js.map +1 -1
  58. package/lib/module/views/SkiaDomView.web.d.ts +2 -2
  59. package/lib/module/views/SkiaDomView.web.js +1 -6
  60. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  61. package/lib/module/views/SkiaJSDomView.js +0 -12
  62. package/lib/module/views/SkiaJSDomView.js.map +1 -1
  63. package/lib/module/views/index.d.ts +0 -1
  64. package/lib/module/views/index.js +0 -1
  65. package/lib/module/views/index.js.map +1 -1
  66. package/lib/module/views/types.d.ts +0 -26
  67. package/lib/module/views/types.js +1 -7
  68. package/lib/module/views/types.js.map +1 -1
  69. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  70. package/lib/typescript/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -3
  71. package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +1 -1
  72. package/lib/typescript/lib/commonjs/views/types.d.ts +0 -1
  73. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  74. package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +0 -3
  75. package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +1 -1
  76. package/lib/typescript/lib/module/views/index.d.ts +0 -1
  77. package/lib/typescript/lib/module/views/types.d.ts +1 -1
  78. package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
  79. package/lib/typescript/src/views/SkiaBaseWebView.d.ts +2 -11
  80. package/lib/typescript/src/views/SkiaDomView.web.d.ts +2 -2
  81. package/lib/typescript/src/views/index.d.ts +0 -1
  82. package/lib/typescript/src/views/types.d.ts +0 -26
  83. package/libs/ios/libskunicode_core.xcframework/Info.plist +46 -0
  84. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  85. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  86. package/libs/ios/libskunicode_libgrapheme.xcframework/Info.plist +46 -0
  87. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  88. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  89. package/package.json +2 -8
  90. package/react-native-skia.podspec +5 -4
  91. package/src/mock/index.ts +0 -1
  92. package/src/renderer/Canvas.tsx +1 -5
  93. package/src/renderer/__tests__/setup.tsx +0 -2
  94. package/src/skia/web/JsiSkia.ts +1 -1
  95. package/src/views/SkiaBaseWebView.tsx +5 -42
  96. package/src/views/SkiaDomView.tsx +2 -14
  97. package/src/views/SkiaDomView.web.tsx +2 -9
  98. package/src/views/SkiaJSDomView.tsx +2 -14
  99. package/src/views/index.ts +0 -1
  100. package/src/views/types.ts +0 -32
  101. package/cpp/rnskia/RNSkInfoParameter.h +0 -92
  102. package/cpp/skia/include/gpu/GrBackendSemaphore.h +0 -8
  103. package/cpp/skia/include/gpu/GrBackendSurface.h +0 -8
  104. package/cpp/skia/include/gpu/GrContextOptions.h +0 -8
  105. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +0 -8
  106. package/cpp/skia/include/gpu/GrDirectContext.h +0 -8
  107. package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +0 -8
  108. package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +0 -6
  109. package/cpp/skia/include/gpu/GrRecordingContext.h +0 -8
  110. package/cpp/skia/include/gpu/GrTypes.h +0 -8
  111. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +0 -8
  112. package/cpp/skia/include/gpu/d3d/GrD3DBackendContext.h +0 -8
  113. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +0 -8
  114. package/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h +0 -8
  115. package/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h +0 -8
  116. package/cpp/skia/include/gpu/gl/GrGLConfig.h +0 -8
  117. package/cpp/skia/include/gpu/gl/GrGLExtensions.h +0 -8
  118. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +0 -8
  119. package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -8
  120. package/cpp/skia/include/gpu/gl/GrGLTypes.h +0 -8
  121. package/cpp/skia/include/gpu/mock/GrMockTypes.h +0 -8
  122. package/cpp/skia/include/gpu/vk/GrVkTypes.h +0 -8
  123. package/lib/commonjs/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  124. package/lib/commonjs/views/useTouchHandler.d.ts +0 -22
  125. package/lib/commonjs/views/useTouchHandler.js +0 -83
  126. package/lib/commonjs/views/useTouchHandler.js.map +0 -1
  127. package/lib/module/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  128. package/lib/module/views/useTouchHandler.d.ts +0 -22
  129. package/lib/module/views/useTouchHandler.js +0 -75
  130. package/lib/module/views/useTouchHandler.js.map +0 -1
  131. package/lib/typescript/lib/commonjs/views/useTouchHandler.d.ts +0 -12
  132. package/lib/typescript/lib/module/views/useTouchHandler.d.ts +0 -2
  133. package/lib/typescript/src/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  134. package/lib/typescript/src/views/useTouchHandler.d.ts +0 -22
  135. package/src/renderer/__tests__/TouchHandler.spec.tsx +0 -113
  136. package/src/views/useTouchHandler.ts +0 -107
@@ -1 +1 @@
1
- {"version":3,"names":["Skia","JsiDrawingContext","SkiaBaseWebView","SkiaDomView","constructor","props","renderInCanvas","canvas","touches","onTouch","console","warn","onSize","width","height","getSize","value","root","ctx","render"],"sources":["SkiaDomView.web.tsx"],"sourcesContent":["import { Skia } from \"../skia\";\nimport type { SkCanvas } from \"../skia/types\";\nimport { JsiDrawingContext } from \"../dom/types/DrawingContext\";\n\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\nimport type { SkiaDomViewProps, TouchInfo } from \"./types\";\n\nexport class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void {\n if (this.props.onTouch) {\n console.warn(\n `The onTouch property is deprecated and will be removed in the next Skia release.\nSee: https://shopify.github.io/react-native-skia/docs/animations/gestures`\n );\n this.props.onTouch([touches]);\n }\n if (this.props.onSize) {\n const { width, height } = this.getSize();\n this.props.onSize.value = { width, height };\n }\n if (this.props.root) {\n const ctx = new JsiDrawingContext(Skia, canvas);\n this.props.root.render(ctx);\n }\n }\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,SAAS;AAE9B,SAASC,iBAAiB,QAAQ,6BAA6B;AAE/D,SAASC,eAAe,QAAQ,mBAAmB;AAGnD,OAAO,MAAMC,WAAW,SAASD,eAAe,CAAmB;EACjEE,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,CAAC;EACd;EAEUC,cAAcA,CAACC,MAAgB,EAAEC,OAAoB,EAAQ;IACrE,IAAI,IAAI,CAACH,KAAK,CAACI,OAAO,EAAE;MACtBC,OAAO,CAACC,IAAI,CACV;AACR,0EACM,CAAC;MACD,IAAI,CAACN,KAAK,CAACI,OAAO,CAAC,CAACD,OAAO,CAAC,CAAC;IAC/B;IACA,IAAI,IAAI,CAACH,KAAK,CAACO,MAAM,EAAE;MACrB,MAAM;QAAEC,KAAK;QAAEC;MAAO,CAAC,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;MACxC,IAAI,CAACV,KAAK,CAACO,MAAM,CAACI,KAAK,GAAG;QAAEH,KAAK;QAAEC;MAAO,CAAC;IAC7C;IACA,IAAI,IAAI,CAACT,KAAK,CAACY,IAAI,EAAE;MACnB,MAAMC,GAAG,GAAG,IAAIjB,iBAAiB,CAACD,IAAI,EAAEO,MAAM,CAAC;MAC/C,IAAI,CAACF,KAAK,CAACY,IAAI,CAACE,MAAM,CAACD,GAAG,CAAC;IAC7B;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Skia","JsiDrawingContext","SkiaBaseWebView","SkiaDomView","constructor","props","renderInCanvas","canvas","onSize","width","height","getSize","value","root","ctx","render"],"sources":["SkiaDomView.web.tsx"],"sourcesContent":["import { Skia } from \"../skia\";\nimport type { SkCanvas } from \"../skia/types\";\nimport { JsiDrawingContext } from \"../dom/types/DrawingContext\";\n\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\nimport type { SkiaDomViewProps } from \"./types\";\n\nexport class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas): void {\n if (this.props.onSize) {\n const { width, height } = this.getSize();\n this.props.onSize.value = { width, height };\n }\n if (this.props.root) {\n const ctx = new JsiDrawingContext(Skia, canvas);\n this.props.root.render(ctx);\n }\n }\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,SAAS;AAE9B,SAASC,iBAAiB,QAAQ,6BAA6B;AAE/D,SAASC,eAAe,QAAQ,mBAAmB;AAGnD,OAAO,MAAMC,WAAW,SAASD,eAAe,CAAmB;EACjEE,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,CAAC;EACd;EAEUC,cAAcA,CAACC,MAAgB,EAAQ;IAC/C,IAAI,IAAI,CAACF,KAAK,CAACG,MAAM,EAAE;MACrB,MAAM;QAAEC,KAAK;QAAEC;MAAO,CAAC,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;MACxC,IAAI,CAACN,KAAK,CAACG,MAAM,CAACI,KAAK,GAAG;QAAEH,KAAK;QAAEC;MAAO,CAAC;IAC7C;IACA,IAAI,IAAI,CAACL,KAAK,CAACQ,IAAI,EAAE;MACnB,MAAMC,GAAG,GAAG,IAAIb,iBAAiB,CAACD,IAAI,EAAEO,MAAM,CAAC;MAC/C,IAAI,CAACF,KAAK,CAACQ,IAAI,CAACE,MAAM,CAACD,GAAG,CAAC;IAC7B;EACF;AACF","ignoreList":[]}
@@ -18,19 +18,12 @@ export class SkiaJSDomView extends React.Component {
18
18
  this._nativeId = SkiaViewNativeId.current++;
19
19
  const {
20
20
  root,
21
- onTouch,
22
21
  onSize
23
22
  } = props;
24
23
  if (root) {
25
24
  assertSkiaViewApi();
26
25
  SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
27
26
  }
28
- if (onTouch) {
29
- assertSkiaViewApi();
30
- console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
31
- See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
32
- SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
33
- }
34
27
  if (onSize) {
35
28
  assertSkiaViewApi();
36
29
  SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
@@ -42,17 +35,12 @@ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
42
35
  componentDidUpdate(prevProps) {
43
36
  const {
44
37
  root,
45
- onTouch,
46
38
  onSize
47
39
  } = this.props;
48
40
  if (root !== prevProps.root && root !== undefined) {
49
41
  assertSkiaViewApi();
50
42
  this.draw();
51
43
  }
52
- if (onTouch !== prevProps.onTouch) {
53
- assertSkiaViewApi();
54
- SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
55
- }
56
44
  if (onSize !== prevProps.onSize) {
57
45
  assertSkiaViewApi();
58
46
  SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","SkiaPictureViewNativeComponent","JsiDrawingContext","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","OS","SkiaJSDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onTouch","onSize","assertSkiaViewApi","setJsiProperty","console","warn","nativeId","componentDidUpdate","prevProps","undefined","draw","makeImageSnapshot","rect","redraw","Skia","rec","PictureRecorder","canvas","beginRecording","ctx","render","picture","finishRecordingAsPicture","componentWillUnmount","mode","debug","viewProps","createElement","_extends","collapsable","nativeID","requestRedraw","Error"],"sources":["SkiaJSDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { Skia, SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport { JsiDrawingContext } from \"../dom/types\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps, SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView: HostComponent<SkiaPictureViewProps> =\n Platform.OS !== \"web\"\n ? SkiaPictureViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaJSDomView extends React.Component<\n SkiaDomViewProps & { Skia: Skia }\n> {\n constructor(props: SkiaDomViewProps & { Skia: Skia }) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onTouch, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onTouch) {\n assertSkiaViewApi();\n console.warn(\n `The onTouch property is deprecated and will be removed in the next Skia release.\nSee: https://shopify.github.io/react-native-skia/docs/animations/gestures`\n );\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps & { Skia: Skia }) {\n const { root, onTouch, onSize } = this.props;\n if (root !== prevProps.root && root !== undefined) {\n assertSkiaViewApi();\n this.draw();\n }\n if (onTouch !== prevProps.onTouch) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n this.draw();\n //SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n private draw() {\n const { root, Skia } = this.props;\n if (root !== undefined) {\n assertSkiaViewApi();\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.render(ctx);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n }\n\n /**\n * Clear up the dom node when unmounting to release resources.\n */\n componentWillUnmount(): void {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", null);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAASC,QAAQ,QAAQ,aAAa;AACtC,OAAOC,8BAA8B,MAAM,yCAAyC;AACpF,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAA0D,GAC9DL,QAAQ,CAACM,EAAE,KAAK,KAAK,GACjBL,8BAA8B;AAC9B;AACC,IAAY;AAEnB,OAAO,MAAMM,aAAa,SAASR,KAAK,CAACS,SAAS,CAEhD;EACAC,WAAWA,CAACC,KAAwC,EAAE;IACpD,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IACb,IAAI,CAACC,SAAS,GAAGR,gBAAgB,CAACS,OAAO,EAAE;IAC3C,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGN,KAAK;IACvC,IAAII,IAAI,EAAE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;AACF;AAEA,MAAMxB,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEd,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACe,cAAc,KAAK,IAAI,IACnCf,WAAW,CAAC2C,aAAa,KAAK,IAAI,IAClC3C,WAAW,CAACuB,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMqB,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Platform","SkiaPictureViewNativeComponent","JsiDrawingContext","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","OS","SkiaJSDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onSize","assertSkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","undefined","draw","makeImageSnapshot","rect","redraw","Skia","rec","PictureRecorder","canvas","beginRecording","ctx","render","picture","finishRecordingAsPicture","componentWillUnmount","mode","debug","viewProps","createElement","_extends","collapsable","nativeID","requestRedraw","Error"],"sources":["SkiaJSDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { Skia, SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport { JsiDrawingContext } from \"../dom/types\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps, SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView: HostComponent<SkiaPictureViewProps> =\n Platform.OS !== \"web\"\n ? SkiaPictureViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaJSDomView extends React.Component<\n SkiaDomViewProps & { Skia: Skia }\n> {\n constructor(props: SkiaDomViewProps & { Skia: Skia }) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps & { Skia: Skia }) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root && root !== undefined) {\n assertSkiaViewApi();\n this.draw();\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n this.draw();\n //SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n private draw() {\n const { root, Skia } = this.props;\n if (root !== undefined) {\n assertSkiaViewApi();\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.render(ctx);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n }\n\n /**\n * Clear up the dom node when unmounting to release resources.\n */\n componentWillUnmount(): void {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", null);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw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GAAG,IAAI,CAAC5B,KAAK;IACxD,oBACEX,KAAA,CAAAwC,aAAA,CAAClC,qBAAqB,EAAAmC,QAAA;MACpBC,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAAC9B,SAAS,EAAG;MAC9BwB,IAAI,EAAEA,IAAK;MACXC,KAAK,EAAEA;IAAM,GACTC,SAAS,CACd,CAAC;EAEN;AACF;AAEA,MAAMtB,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEb,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACc,cAAc,KAAK,IAAI,IACnCd,WAAW,CAACwC,aAAa,KAAK,IAAI,IAClCxC,WAAW,CAACoB,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMqB,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
1
  export * from "./SkiaPictureView";
2
2
  export * from "./SkiaDomView";
3
3
  export * from "./types";
4
- export * from "./useTouchHandler";
@@ -1,5 +1,4 @@
1
1
  export * from "./SkiaPictureView";
2
2
  export * from "./SkiaDomView";
3
3
  export * from "./types";
4
- export * from "./useTouchHandler";
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./SkiaDomView\";\nexport * from \"./types\";\nexport * from \"./useTouchHandler\";\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./SkiaDomView\";\nexport * from \"./types\";\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,SAAS","ignoreList":[]}
@@ -7,36 +7,11 @@ export type NativeSkiaViewProps = ViewProps & {
7
7
  mode?: DrawMode;
8
8
  debug?: boolean;
9
9
  };
10
- export declare enum TouchType {
11
- Start = 0,
12
- Active = 1,
13
- End = 2,
14
- Cancelled = 3
15
- }
16
- export interface TouchInfo {
17
- x: number;
18
- y: number;
19
- force: number;
20
- type: TouchType;
21
- id: number;
22
- timestamp: number;
23
- }
24
10
  export interface DrawingInfo {
25
11
  width: number;
26
12
  height: number;
27
13
  timestamp: number;
28
- touches: Array<Array<TouchInfo>>;
29
14
  }
30
- export type ExtendedTouchInfo = TouchInfo & {
31
- velocityX: number;
32
- velocityY: number;
33
- };
34
- export type TouchHandlers = {
35
- onStart?: (touchInfo: TouchInfo) => void;
36
- onActive?: (touchInfo: ExtendedTouchInfo) => void;
37
- onEnd?: (touchInfo: ExtendedTouchInfo) => void;
38
- };
39
- export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
40
15
  export interface ISkiaViewApi {
41
16
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
42
17
  requestRedraw: (nativeId: number) => void;
@@ -68,5 +43,4 @@ export interface SkiaPictureViewProps extends SkiaBaseViewProps {
68
43
  }
69
44
  export interface SkiaDomViewProps extends SkiaBaseViewProps {
70
45
  root?: RenderNode<GroupProps>;
71
- onTouch?: TouchHandler;
72
46
  }
@@ -1,8 +1,2 @@
1
- export let TouchType = /*#__PURE__*/function (TouchType) {
2
- TouchType[TouchType["Start"] = 0] = "Start";
3
- TouchType[TouchType["Active"] = 1] = "Active";
4
- TouchType[TouchType["End"] = 2] = "End";
5
- TouchType[TouchType["Cancelled"] = 3] = "Cancelled";
6
- return TouchType;
7
- }({});
1
+ export {};
8
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValueType<SkSize>;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAaA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValueType<SkSize>;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -7,7 +7,6 @@ export function Mock(CanvasKit: any): {
7
7
  useComputedValue: () => {
8
8
  current: number;
9
9
  };
10
- useTouchHandler: () => undefined;
11
10
  useTiming: () => {
12
11
  current: number;
13
12
  };
@@ -32,7 +32,6 @@ export class SkiaBaseWebView extends SkiaBaseWebView_base {
32
32
  */
33
33
  tick(): void;
34
34
  _redrawRequests: number | undefined;
35
- _touches: any[] | undefined;
36
35
  requestId: number | undefined;
37
36
  redraw(): void;
38
37
  /**
@@ -45,8 +44,6 @@ export class SkiaBaseWebView extends SkiaBaseWebView_base {
45
44
  * @param mode Drawing mode to use.
46
45
  */
47
46
  setDrawMode(mode: any): void;
48
- handleTouchEvent(evt: any, touchType: any): void;
49
- createTouchHandler(touchType: any): (evt: any) => void;
50
47
  render(): any;
51
48
  }
52
49
  import _JsiSkSurface = require("../skia/web/JsiSkSurface");
@@ -1,5 +1,5 @@
1
1
  export const __esModule: boolean;
2
2
  export class SkiaDomView extends _SkiaBaseWebView.SkiaBaseWebView {
3
- renderInCanvas(canvas: any, touches: any): void;
3
+ renderInCanvas(canvas: any): void;
4
4
  }
5
5
  import _SkiaBaseWebView = require("./SkiaBaseWebView");
@@ -1,2 +1 @@
1
1
  export const __esModule: boolean;
2
- export const TouchType: {};
@@ -6,7 +6,6 @@ export function Mock(CanvasKit: any): {
6
6
  useComputedValue: () => {
7
7
  current: number;
8
8
  };
9
- useTouchHandler: () => undefined;
10
9
  useTiming: () => {
11
10
  current: number;
12
11
  };
@@ -29,7 +29,6 @@ export class SkiaBaseWebView extends React.Component<any, any, any> {
29
29
  */
30
30
  tick(): void;
31
31
  _redrawRequests: number | undefined;
32
- _touches: any[] | undefined;
33
32
  requestId: number | undefined;
34
33
  redraw(): void;
35
34
  /**
@@ -42,8 +41,6 @@ export class SkiaBaseWebView extends React.Component<any, any, any> {
42
41
  * @param mode Drawing mode to use.
43
42
  */
44
43
  setDrawMode(mode: any): void;
45
- handleTouchEvent(evt: any, touchType: any): void;
46
- createTouchHandler(touchType: any): (evt: any) => void;
47
44
  render(): React.CElement<import("react-native").ViewProps, import("react-native").View>;
48
45
  }
49
46
  import React from "react";
@@ -1,4 +1,4 @@
1
1
  export class SkiaDomView extends SkiaBaseWebView {
2
- renderInCanvas(canvas: any, touches: any): void;
2
+ renderInCanvas(canvas: any): void;
3
3
  }
4
4
  import { SkiaBaseWebView } from "./SkiaBaseWebView";
@@ -1,4 +1,3 @@
1
1
  export * from "./SkiaPictureView";
2
2
  export * from "./SkiaDomView";
3
3
  export * from "./types";
4
- export * from "./useTouchHandler";
@@ -1 +1 @@
1
- export let TouchType: {};
1
+ export {};
@@ -1,11 +1,10 @@
1
1
  import React from "react";
2
2
  import type { RefObject, ReactNode, FunctionComponent } from "react";
3
3
  import { SkiaDomView } from "../views";
4
- import type { TouchHandler, SkiaBaseViewProps } from "../views";
4
+ import type { SkiaBaseViewProps } from "../views";
5
5
  export declare const useCanvasRef: () => React.RefObject<SkiaDomView>;
6
6
  export interface CanvasProps extends SkiaBaseViewProps {
7
7
  ref?: RefObject<SkiaDomView>;
8
8
  children: ReactNode;
9
- onTouch?: TouchHandler;
10
9
  }
11
10
  export declare const Canvas: FunctionComponent<CanvasProps & React.RefAttributes<SkiaDomView>>;
@@ -1,13 +1,10 @@
1
1
  import React from "react";
2
- import type { PointerEvent } from "react";
3
2
  import type { SkRect, SkCanvas } from "../skia/types";
4
- import type { DrawMode, SkiaBaseViewProps, TouchInfo } from "./types";
5
- import { TouchType } from "./types";
3
+ import type { DrawMode, SkiaBaseViewProps } from "./types";
6
4
  export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps> extends React.Component<TProps> {
7
5
  constructor(props: TProps);
8
6
  private _surface;
9
7
  private _unsubscriptions;
10
- private _touches;
11
8
  private _canvas;
12
9
  private _canvasRef;
13
10
  private _mode;
@@ -33,7 +30,7 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
33
30
  /**
34
31
  * Override to render
35
32
  */
36
- protected abstract renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void;
33
+ protected abstract renderInCanvas(canvas: SkCanvas): void;
37
34
  /**
38
35
  * Sends a redraw request to the native SkiaView.
39
36
  */
@@ -49,12 +46,6 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
49
46
  * @param mode Drawing mode to use.
50
47
  */
51
48
  setDrawMode(mode: DrawMode): void;
52
- private handleTouchEvent;
53
- createTouchHandler(touchType: TouchType): (evt: PointerEvent) => void;
54
- private onStart;
55
- private onActive;
56
- private onCancel;
57
- private onEnd;
58
49
  private onLayout;
59
50
  render(): React.JSX.Element;
60
51
  }
@@ -1,7 +1,7 @@
1
1
  import type { SkCanvas } from "../skia/types";
2
2
  import { SkiaBaseWebView } from "./SkiaBaseWebView";
3
- import type { SkiaDomViewProps, TouchInfo } from "./types";
3
+ import type { SkiaDomViewProps } from "./types";
4
4
  export declare class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {
5
5
  constructor(props: SkiaDomViewProps);
6
- protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void;
6
+ protected renderInCanvas(canvas: SkCanvas): void;
7
7
  }
@@ -1,4 +1,3 @@
1
1
  export * from "./SkiaPictureView";
2
2
  export * from "./SkiaDomView";
3
3
  export * from "./types";
4
- export * from "./useTouchHandler";
@@ -7,36 +7,11 @@ export type NativeSkiaViewProps = ViewProps & {
7
7
  mode?: DrawMode;
8
8
  debug?: boolean;
9
9
  };
10
- export declare enum TouchType {
11
- Start = 0,
12
- Active = 1,
13
- End = 2,
14
- Cancelled = 3
15
- }
16
- export interface TouchInfo {
17
- x: number;
18
- y: number;
19
- force: number;
20
- type: TouchType;
21
- id: number;
22
- timestamp: number;
23
- }
24
10
  export interface DrawingInfo {
25
11
  width: number;
26
12
  height: number;
27
13
  timestamp: number;
28
- touches: Array<Array<TouchInfo>>;
29
14
  }
30
- export type ExtendedTouchInfo = TouchInfo & {
31
- velocityX: number;
32
- velocityY: number;
33
- };
34
- export type TouchHandlers = {
35
- onStart?: (touchInfo: TouchInfo) => void;
36
- onActive?: (touchInfo: ExtendedTouchInfo) => void;
37
- onEnd?: (touchInfo: ExtendedTouchInfo) => void;
38
- };
39
- export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
40
15
  export interface ISkiaViewApi {
41
16
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
42
17
  requestRedraw: (nativeId: number) => void;
@@ -68,5 +43,4 @@ export interface SkiaPictureViewProps extends SkiaBaseViewProps {
68
43
  }
69
44
  export interface SkiaDomViewProps extends SkiaBaseViewProps {
70
45
  root?: RenderNode<GroupProps>;
71
- onTouch?: TouchHandler;
72
46
  }
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>libskunicode_core.a</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64_arm64e</string>
12
+ <key>LibraryPath</key>
13
+ <string>libskunicode_core.a</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ <string>arm64e</string>
18
+ </array>
19
+ <key>SupportedPlatform</key>
20
+ <string>ios</string>
21
+ </dict>
22
+ <dict>
23
+ <key>BinaryPath</key>
24
+ <string>libskunicode_core.a</string>
25
+ <key>LibraryIdentifier</key>
26
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
27
+ <key>LibraryPath</key>
28
+ <string>libskunicode_core.a</string>
29
+ <key>SupportedArchitectures</key>
30
+ <array>
31
+ <string>arm64</string>
32
+ <string>arm64e</string>
33
+ <string>x86_64</string>
34
+ </array>
35
+ <key>SupportedPlatform</key>
36
+ <string>ios</string>
37
+ <key>SupportedPlatformVariant</key>
38
+ <string>simulator</string>
39
+ </dict>
40
+ </array>
41
+ <key>CFBundlePackageType</key>
42
+ <string>XFWK</string>
43
+ <key>XCFrameworkFormatVersion</key>
44
+ <string>1.0</string>
45
+ </dict>
46
+ </plist>
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>libskunicode_libgrapheme.a</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64_arm64e</string>
12
+ <key>LibraryPath</key>
13
+ <string>libskunicode_libgrapheme.a</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ <string>arm64e</string>
18
+ </array>
19
+ <key>SupportedPlatform</key>
20
+ <string>ios</string>
21
+ </dict>
22
+ <dict>
23
+ <key>BinaryPath</key>
24
+ <string>libskunicode_libgrapheme.a</string>
25
+ <key>LibraryIdentifier</key>
26
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
27
+ <key>LibraryPath</key>
28
+ <string>libskunicode_libgrapheme.a</string>
29
+ <key>SupportedArchitectures</key>
30
+ <array>
31
+ <string>arm64</string>
32
+ <string>arm64e</string>
33
+ <string>x86_64</string>
34
+ </array>
35
+ <key>SupportedPlatform</key>
36
+ <string>ios</string>
37
+ <key>SupportedPlatformVariant</key>
38
+ <string>simulator</string>
39
+ </dict>
40
+ </array>
41
+ <key>CFBundlePackageType</key>
42
+ <string>XFWK</string>
43
+ <key>XCFrameworkFormatVersion</key>
44
+ <string>1.0</string>
45
+ </dict>
46
+ </plist>
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": "1.4.1",
10
+ "version": "1.5.0",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -29,13 +29,7 @@
29
29
  "jestEnv.mjs",
30
30
  "cpp/**/*.{h,cpp}",
31
31
  "ios/**",
32
- "libs/ios/libskia.xcframework/**",
33
- "libs/ios/libskshaper.xcframework/**",
34
- "libs/ios/libsvg.xcframework/**",
35
- "libs/ios/libskottie.xcframework/**",
36
- "libs/ios/libsksg.xcframework/**",
37
- "libs/ios/libskparagraph.xcframework/**",
38
- "libs/ios/libskunicode.xcframework/**",
32
+ "libs/ios/*.xcframework/**",
39
33
  "react-native-skia.podspec",
40
34
  "scripts/setup-canvaskit.js",
41
35
  "dist/**"
@@ -12,11 +12,12 @@ Pod::Spec.new do |s|
12
12
  @shopify/react-native-skia
13
13
  DESC
14
14
  s.homepage = "https://github.com/shopify/react-native-skia"
15
- # brief license entry:
16
15
  s.license = "MIT"
17
- # optional - use expanded license entry instead:
18
- # s.license = { :type => "MIT", :file => "LICENSE" }
19
- s.authors = { "Your Name" => "yourname@email.com" }
16
+ s.license = { :type => "MIT", :file => "LICENSE.md" }
17
+ s.authors = {
18
+ "Christian Falch" => "christian.falch@gmail.com",
19
+ "William Candillon" => "wcandillon@gmail.com"
20
+ }
20
21
  s.platforms = { :ios => "13.0" }
21
22
  s.source = { :git => "https://github.com/shopify/react-native-skia/react-native-skia.git", :tag => "#{s.version}" }
22
23
 
package/src/mock/index.ts CHANGED
@@ -26,7 +26,6 @@ export const Mock = (CanvasKit: CanvasKit) => {
26
26
  // Skia Animations
27
27
  useValue: NoopValue,
28
28
  useComputedValue: NoopValue,
29
- useTouchHandler: Noop,
30
29
  useTiming: NoopValue,
31
30
  useLoop: NoopValue,
32
31
  useSpring: NoopValue,
@@ -16,7 +16,7 @@ import type { LayoutChangeEvent } from "react-native";
16
16
 
17
17
  import { SkiaDomView } from "../views";
18
18
  import { Skia } from "../skia/Skia";
19
- import type { TouchHandler, SkiaBaseViewProps } from "../views";
19
+ import type { SkiaBaseViewProps } from "../views";
20
20
  import { SkiaJSDomView } from "../views/SkiaJSDomView";
21
21
 
22
22
  import { SkiaRoot } from "./Reconciler";
@@ -27,7 +27,6 @@ export const useCanvasRef = () => useRef<SkiaDomView>(null);
27
27
  export interface CanvasProps extends SkiaBaseViewProps {
28
28
  ref?: RefObject<SkiaDomView>;
29
29
  children: ReactNode;
30
- onTouch?: TouchHandler;
31
30
  }
32
31
 
33
32
  const useOnSizeEvent = (
@@ -56,7 +55,6 @@ export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
56
55
  style,
57
56
  debug,
58
57
  mode,
59
- onTouch,
60
58
  onSize: _onSize,
61
59
  onLayout: _onLayout,
62
60
  ...props
@@ -96,7 +94,6 @@ export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
96
94
  ref={ref}
97
95
  style={style}
98
96
  root={root.dom}
99
- onTouch={onTouch}
100
97
  onLayout={onLayout}
101
98
  mode={mode}
102
99
  debug={debug}
@@ -111,7 +108,6 @@ export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
111
108
  ref={ref as any}
112
109
  style={style}
113
110
  root={root.dom}
114
- onTouch={onTouch}
115
111
  onLayout={onLayout}
116
112
  mode={mode}
117
113
  debug={debug}
@@ -164,13 +164,11 @@ export const importSkia = (): typeof SkiaExports => {
164
164
  const offscreen = require("../Offscreen");
165
165
  // TODO: to remove
166
166
  const animation = require("../../animation");
167
- const useTouchHandler = require("../../views/useTouchHandler");
168
167
  return {
169
168
  ...skia,
170
169
  ...renderer,
171
170
  ...animation,
172
171
  ...offscreen,
173
- ...useTouchHandler,
174
172
  };
175
173
  };
176
174
 
@@ -131,5 +131,5 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
131
131
  Video: createVideo.bind(null, CanvasKit),
132
132
  Context: (_surface: bigint, _width: number, _height: number) => {
133
133
  throw new Error("Not implemented on React Native Web");
134
- }
134
+ },
135
135
  });