@shopify/react-native-skia 0.1.188 → 0.1.190

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/cpp/api/JsiSkMatrix.h +6 -6
  2. package/ios/RNSkia-iOS/ViewScreenshotService.mm +13 -1
  3. package/jestSetup.js +17 -3
  4. package/lib/commonjs/Platform/IPlatform.d.ts +12 -0
  5. package/lib/commonjs/Platform/IPlatform.js +6 -0
  6. package/lib/commonjs/Platform/IPlatform.js.map +1 -0
  7. package/lib/commonjs/Platform/Platform.d.ts +2 -0
  8. package/lib/commonjs/Platform/Platform.js +24 -0
  9. package/lib/commonjs/Platform/Platform.js.map +1 -0
  10. package/lib/commonjs/Platform/Platform.web.d.ts +2 -0
  11. package/lib/commonjs/Platform/Platform.web.js +157 -0
  12. package/lib/commonjs/Platform/Platform.web.js.map +1 -0
  13. package/lib/commonjs/Platform/index.d.ts +1 -0
  14. package/lib/commonjs/Platform/index.js +19 -0
  15. package/lib/commonjs/Platform/index.js.map +1 -0
  16. package/lib/commonjs/skia/NativeSetup.js +3 -3
  17. package/lib/commonjs/skia/NativeSetup.js.map +1 -1
  18. package/lib/commonjs/skia/core/Data.js +2 -8
  19. package/lib/commonjs/skia/core/Data.js.map +1 -1
  20. package/lib/commonjs/skia/core/Image.js +3 -3
  21. package/lib/commonjs/skia/core/Image.js.map +1 -1
  22. package/lib/commonjs/skia/types/Matrix.d.ts +6 -6
  23. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  24. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +6 -6
  25. package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -0
  26. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  27. package/lib/commonjs/views/SkiaBaseWebView.d.ts +6 -1
  28. package/lib/commonjs/views/SkiaBaseWebView.js +32 -25
  29. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  30. package/lib/commonjs/views/SkiaDomView.js +2 -2
  31. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  32. package/lib/commonjs/views/SkiaPictureView.js +2 -2
  33. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  34. package/lib/commonjs/views/SkiaView.js +3 -2
  35. package/lib/commonjs/views/SkiaView.js.map +1 -1
  36. package/lib/commonjs/views/useTouchHandler.js +3 -3
  37. package/lib/commonjs/views/useTouchHandler.js.map +1 -1
  38. package/lib/commonjs/web/WithSkiaWeb.js +2 -2
  39. package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
  40. package/lib/module/Platform/IPlatform.d.ts +12 -0
  41. package/lib/module/Platform/IPlatform.js +2 -0
  42. package/lib/module/Platform/IPlatform.js.map +1 -0
  43. package/lib/module/Platform/Platform.d.ts +2 -0
  44. package/lib/module/Platform/Platform.js +14 -0
  45. package/lib/module/Platform/Platform.js.map +1 -0
  46. package/lib/module/Platform/Platform.web.d.ts +2 -0
  47. package/lib/module/Platform/Platform.web.js +143 -0
  48. package/lib/module/Platform/Platform.web.js.map +1 -0
  49. package/lib/module/Platform/index.d.ts +1 -0
  50. package/lib/module/Platform/index.js +2 -0
  51. package/lib/module/Platform/index.js.map +1 -0
  52. package/lib/module/skia/NativeSetup.js +2 -2
  53. package/lib/module/skia/NativeSetup.js.map +1 -1
  54. package/lib/module/skia/core/Data.js +2 -7
  55. package/lib/module/skia/core/Data.js.map +1 -1
  56. package/lib/module/skia/core/Image.js +2 -2
  57. package/lib/module/skia/core/Image.js.map +1 -1
  58. package/lib/module/skia/types/Matrix.d.ts +6 -6
  59. package/lib/module/skia/types/Matrix.js.map +1 -1
  60. package/lib/module/skia/web/JsiSkMatrix.d.ts +6 -6
  61. package/lib/module/skia/web/JsiSkMatrix.js +6 -0
  62. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  63. package/lib/module/views/SkiaBaseWebView.d.ts +6 -1
  64. package/lib/module/views/SkiaBaseWebView.js +31 -24
  65. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  66. package/lib/module/views/SkiaDomView.js +2 -2
  67. package/lib/module/views/SkiaDomView.js.map +1 -1
  68. package/lib/module/views/SkiaPictureView.js +2 -2
  69. package/lib/module/views/SkiaPictureView.js.map +1 -1
  70. package/lib/module/views/SkiaView.js +2 -2
  71. package/lib/module/views/SkiaView.js.map +1 -1
  72. package/lib/module/views/useTouchHandler.js +3 -3
  73. package/lib/module/views/useTouchHandler.js.map +1 -1
  74. package/lib/module/web/WithSkiaWeb.js +1 -1
  75. package/lib/module/web/WithSkiaWeb.js.map +1 -1
  76. package/lib/typescript/src/Platform/IPlatform.d.ts +12 -0
  77. package/lib/typescript/src/Platform/Platform.d.ts +2 -0
  78. package/lib/typescript/src/Platform/Platform.web.d.ts +2 -0
  79. package/lib/typescript/src/Platform/index.d.ts +1 -0
  80. package/lib/typescript/src/skia/types/Matrix.d.ts +6 -6
  81. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +6 -6
  82. package/lib/typescript/src/views/SkiaBaseWebView.d.ts +6 -1
  83. package/package.json +9 -9
  84. package/src/Platform/IPlatform.ts +20 -0
  85. package/src/Platform/Platform.ts +28 -0
  86. package/src/Platform/Platform.web.tsx +136 -0
  87. package/src/Platform/index.ts +1 -0
  88. package/src/skia/NativeSetup.ts +2 -2
  89. package/src/skia/core/Data.ts +4 -15
  90. package/src/skia/core/Image.ts +2 -3
  91. package/src/skia/types/Matrix.ts +6 -6
  92. package/src/skia/web/JsiSkMatrix.ts +6 -0
  93. package/src/views/SkiaBaseWebView.tsx +24 -19
  94. package/src/views/SkiaDomView.tsx +2 -2
  95. package/src/views/SkiaPictureView.tsx +2 -2
  96. package/src/views/SkiaView.tsx +2 -2
  97. package/src/views/useTouchHandler.ts +3 -3
  98. package/src/web/WithSkiaWeb.tsx +2 -1
@@ -1,8 +1,8 @@
1
1
  import type { DependencyList } from "react";
2
2
  import { useCallback, useRef } from "react";
3
- import { PixelRatio } from "react-native";
4
3
 
5
4
  import type { Vector } from "../skia/types";
5
+ import { Platform } from "../Platform";
6
6
 
7
7
  import type {
8
8
  ExtendedTouchInfo,
@@ -46,8 +46,8 @@ const useInternalTouchHandler = (
46
46
  timeDiffseconds > 0
47
47
  ) {
48
48
  prevVelocityRef.current[touch.id] = {
49
- x: distX / timeDiffseconds / PixelRatio.get(),
50
- y: distY / timeDiffseconds / PixelRatio.get(),
49
+ x: distX / timeDiffseconds / Platform.PixelRatio,
50
+ y: distY / timeDiffseconds / Platform.PixelRatio,
51
51
  };
52
52
  }
53
53
 
@@ -1,6 +1,7 @@
1
1
  import type { ComponentProps, ComponentType } from "react";
2
2
  import React, { useMemo, lazy, Suspense } from "react";
3
- import { Platform } from "react-native";
3
+
4
+ import { Platform } from "../Platform";
4
5
 
5
6
  import { LoadSkiaWeb } from "./LoadSkiaWeb";
6
7