@shopify/react-native-skia 1.5.0 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -1
  2. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -1
  3. package/android/cpp/rnskia-android/OpenGLContext.h +40 -0
  4. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -5
  5. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +2 -2
  6. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +49 -14
  7. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +5 -2
  8. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +19 -133
  9. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +30 -138
  10. package/cpp/api/JsiSkTypefaceFontProvider.h +1 -1
  11. package/cpp/api/JsiSkiaContext.h +6 -3
  12. package/cpp/jsi/JsiValue.cpp +1 -2
  13. package/cpp/rnskia/RNSkPlatformContext.h +2 -2
  14. package/cpp/rnskia/{SkiaContext.h → WindowContext.h} +5 -2
  15. package/ios/RNSkia-iOS/DisplayLink.mm +7 -0
  16. package/ios/RNSkia-iOS/MetalContext.h +46 -0
  17. package/ios/RNSkia-iOS/MetalContext.mm +33 -0
  18. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +8 -28
  19. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +1 -1
  20. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +8 -9
  21. package/ios/RNSkia-iOS/RNSkiOSView.mm +0 -2
  22. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +28 -32
  23. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +18 -60
  24. package/ios/RNSkia-iOS/SkiaUIView.h +0 -2
  25. package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -8
  26. package/lib/commonjs/web/WithSkiaWeb.js +4 -1
  27. package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
  28. package/lib/module/web/WithSkiaWeb.js +4 -1
  29. package/lib/module/web/WithSkiaWeb.js.map +1 -1
  30. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  31. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  32. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  33. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  34. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  35. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  36. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  37. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  38. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  39. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  40. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  41. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  42. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  43. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  44. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  45. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  46. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  47. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  48. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  49. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  50. package/package.json +3 -6
  51. package/src/web/WithSkiaWeb.tsx +3 -1
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMemo","lazy","Suspense","Platform","LoadSkiaWeb","WithSkiaWeb","getComponent","fallback","opts","componentProps","Inner","OS","console","warn","createElement"],"sources":["WithSkiaWeb.tsx"],"sourcesContent":["import type { ComponentProps, ComponentType } from \"react\";\nimport React, { useMemo, lazy, Suspense } from \"react\";\n\nimport { Platform } from \"../Platform\";\n\nimport { LoadSkiaWeb } from \"./LoadSkiaWeb\";\n\ntype NonOptionalKeys<T> = {\n [k in keyof T]-?: undefined extends T[k] ? never : k;\n}[keyof T];\n\ntype WithSkiaProps<TProps> = {\n fallback?: ComponentProps<typeof Suspense>[\"fallback\"];\n getComponent: () => Promise<{ default: ComponentType<TProps> }>;\n opts?: Parameters<typeof LoadSkiaWeb>[0];\n} & (NonOptionalKeys<TProps> extends never\n ? {\n componentProps?: TProps;\n }\n : {\n componentProps: TProps;\n });\n\nexport const WithSkiaWeb = <TProps extends object>({\n getComponent,\n fallback,\n opts,\n componentProps,\n}: WithSkiaProps<TProps>) => {\n const Inner = useMemo(\n // TODO: investigate\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (): any =>\n lazy(async () => {\n if (Platform.OS === \"web\") {\n await LoadSkiaWeb(opts);\n } else {\n console.warn(\n \"<WithSkiaWeb /> is only necessary on web. Consider not using on native.\"\n );\n }\n return getComponent();\n }),\n [getComponent, opts]\n );\n return (\n <Suspense fallback={fallback ?? null}>\n <Inner {...componentProps} />\n </Suspense>\n );\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAEtD,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,WAAW,QAAQ,eAAe;AAkB3C,OAAO,MAAMC,WAAW,GAAGA,CAAwB;EACjDC,YAAY;EACZC,QAAQ;EACRC,IAAI;EACJC;AACqB,CAAC,KAAK;EAC3B,MAAMC,KAAK,GAAGV,OAAO;EACnB;EACA;EACA,mBACEC,IAAI,CAAC,YAAY;IACf,IAAIE,QAAQ,CAACQ,EAAE,KAAK,KAAK,EAAE;MACzB,MAAMP,WAAW,CAACI,IAAI,CAAC;IACzB,CAAC,MAAM;MACLI,OAAO,CAACC,IAAI,CACV,yEACF,CAAC;IACH;IACA,OAAOP,YAAY,CAAC,CAAC;EACvB,CAAC,CAAC,EACJ,CAACA,YAAY,EAAEE,IAAI,CACrB,CAAC;EACD,oBACET,KAAA,CAAAe,aAAA,CAACZ,QAAQ;IAACK,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI;EAAK,gBACnCR,KAAA,CAAAe,aAAA,CAACJ,KAAK,EAAKD,cAAiB,CACpB,CAAC;AAEf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","lazy","Suspense","Platform","LoadSkiaWeb","WithSkiaWeb","getComponent","fallback","opts","componentProps","Inner","OS","console","warn","createElement"],"sources":["WithSkiaWeb.tsx"],"sourcesContent":["import type { ComponentProps, ComponentType } from \"react\";\nimport React, { useMemo, lazy, Suspense } from \"react\";\n\nimport { Platform } from \"../Platform\";\n\nimport { LoadSkiaWeb } from \"./LoadSkiaWeb\";\n\ntype NonOptionalKeys<T> = {\n [k in keyof T]-?: undefined extends T[k] ? never : k;\n}[keyof T];\n\ntype WithSkiaProps<TProps> = {\n fallback?: ComponentProps<typeof Suspense>[\"fallback\"];\n getComponent: () => Promise<{ default: ComponentType<TProps> }>;\n opts?: Parameters<typeof LoadSkiaWeb>[0];\n} & (NonOptionalKeys<TProps> extends never\n ? {\n componentProps?: TProps;\n }\n : {\n componentProps: TProps;\n });\n\nexport const WithSkiaWeb = <TProps extends object>({\n getComponent,\n fallback,\n opts,\n componentProps,\n}: WithSkiaProps<TProps>) => {\n const Inner = useMemo(\n // TODO: investigate\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (): any =>\n lazy(async () => {\n if (Platform.OS === \"web\") {\n await LoadSkiaWeb(opts);\n } else {\n console.warn(\n \"<WithSkiaWeb /> is only necessary on web. Consider not using on native.\"\n );\n }\n return getComponent();\n }),\n // We we to run this only once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n return (\n <Suspense fallback={fallback ?? null}>\n <Inner {...componentProps} />\n </Suspense>\n );\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAEtD,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,WAAW,QAAQ,eAAe;AAkB3C,OAAO,MAAMC,WAAW,GAAGA,CAAwB;EACjDC,YAAY;EACZC,QAAQ;EACRC,IAAI;EACJC;AACqB,CAAC,KAAK;EAC3B,MAAMC,KAAK,GAAGV,OAAO;EACnB;EACA;EACA,mBACEC,IAAI,CAAC,YAAY;IACf,IAAIE,QAAQ,CAACQ,EAAE,KAAK,KAAK,EAAE;MACzB,MAAMP,WAAW,CAACI,IAAI,CAAC;IACzB,CAAC,MAAM;MACLI,OAAO,CAACC,IAAI,CACV,yEACF,CAAC;IACH;IACA,OAAOP,YAAY,CAAC,CAAC;EACvB,CAAC,CAAC;EACJ;EACA;EACA,EACF,CAAC;EACD,oBACEP,KAAA,CAAAe,aAAA,CAACZ,QAAQ;IAACK,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI;EAAK,gBACnCR,KAAA,CAAAe,aAAA,CAACJ,KAAK,EAAKD,cAAiB,CACpB,CAAC;AAEf,CAAC","ignoreList":[]}
@@ -8,34 +8,34 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libskottie.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_arm64e_x86_64-simulator</string>
11
+ <string>ios-arm64_arm64e</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libskottie.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
17
  <string>arm64e</string>
18
- <string>x86_64</string>
19
18
  </array>
20
19
  <key>SupportedPlatform</key>
21
20
  <string>ios</string>
22
- <key>SupportedPlatformVariant</key>
23
- <string>simulator</string>
24
21
  </dict>
25
22
  <dict>
26
23
  <key>BinaryPath</key>
27
24
  <string>libskottie.a</string>
28
25
  <key>LibraryIdentifier</key>
29
- <string>ios-arm64_arm64e</string>
26
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
30
27
  <key>LibraryPath</key>
31
28
  <string>libskottie.a</string>
32
29
  <key>SupportedArchitectures</key>
33
30
  <array>
34
31
  <string>arm64</string>
35
32
  <string>arm64e</string>
33
+ <string>x86_64</string>
36
34
  </array>
37
35
  <key>SupportedPlatform</key>
38
36
  <string>ios</string>
37
+ <key>SupportedPlatformVariant</key>
38
+ <string>simulator</string>
39
39
  </dict>
40
40
  </array>
41
41
  <key>CFBundlePackageType</key>
@@ -8,34 +8,34 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libskparagraph.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_arm64e_x86_64-simulator</string>
11
+ <string>ios-arm64_arm64e</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libskparagraph.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
17
  <string>arm64e</string>
18
- <string>x86_64</string>
19
18
  </array>
20
19
  <key>SupportedPlatform</key>
21
20
  <string>ios</string>
22
- <key>SupportedPlatformVariant</key>
23
- <string>simulator</string>
24
21
  </dict>
25
22
  <dict>
26
23
  <key>BinaryPath</key>
27
24
  <string>libskparagraph.a</string>
28
25
  <key>LibraryIdentifier</key>
29
- <string>ios-arm64_arm64e</string>
26
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
30
27
  <key>LibraryPath</key>
31
28
  <string>libskparagraph.a</string>
32
29
  <key>SupportedArchitectures</key>
33
30
  <array>
34
31
  <string>arm64</string>
35
32
  <string>arm64e</string>
33
+ <string>x86_64</string>
36
34
  </array>
37
35
  <key>SupportedPlatform</key>
38
36
  <string>ios</string>
37
+ <key>SupportedPlatformVariant</key>
38
+ <string>simulator</string>
39
39
  </dict>
40
40
  </array>
41
41
  <key>CFBundlePackageType</key>
@@ -8,34 +8,34 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libskshaper.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_arm64e_x86_64-simulator</string>
11
+ <string>ios-arm64_arm64e</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libskshaper.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
17
  <string>arm64e</string>
18
- <string>x86_64</string>
19
18
  </array>
20
19
  <key>SupportedPlatform</key>
21
20
  <string>ios</string>
22
- <key>SupportedPlatformVariant</key>
23
- <string>simulator</string>
24
21
  </dict>
25
22
  <dict>
26
23
  <key>BinaryPath</key>
27
24
  <string>libskshaper.a</string>
28
25
  <key>LibraryIdentifier</key>
29
- <string>ios-arm64_arm64e</string>
26
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
30
27
  <key>LibraryPath</key>
31
28
  <string>libskshaper.a</string>
32
29
  <key>SupportedArchitectures</key>
33
30
  <array>
34
31
  <string>arm64</string>
35
32
  <string>arm64e</string>
33
+ <string>x86_64</string>
36
34
  </array>
37
35
  <key>SupportedPlatform</key>
38
36
  <string>ios</string>
37
+ <key>SupportedPlatformVariant</key>
38
+ <string>simulator</string>
39
39
  </dict>
40
40
  </array>
41
41
  <key>CFBundlePackageType</key>
@@ -8,34 +8,34 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libsvg.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_arm64e</string>
11
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libsvg.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
17
  <string>arm64e</string>
18
+ <string>x86_64</string>
18
19
  </array>
19
20
  <key>SupportedPlatform</key>
20
21
  <string>ios</string>
22
+ <key>SupportedPlatformVariant</key>
23
+ <string>simulator</string>
21
24
  </dict>
22
25
  <dict>
23
26
  <key>BinaryPath</key>
24
27
  <string>libsvg.a</string>
25
28
  <key>LibraryIdentifier</key>
26
- <string>ios-arm64_arm64e_x86_64-simulator</string>
29
+ <string>ios-arm64_arm64e</string>
27
30
  <key>LibraryPath</key>
28
31
  <string>libsvg.a</string>
29
32
  <key>SupportedArchitectures</key>
30
33
  <array>
31
34
  <string>arm64</string>
32
35
  <string>arm64e</string>
33
- <string>x86_64</string>
34
36
  </array>
35
37
  <key>SupportedPlatform</key>
36
38
  <string>ios</string>
37
- <key>SupportedPlatformVariant</key>
38
- <string>simulator</string>
39
39
  </dict>
40
40
  </array>
41
41
  <key>CFBundlePackageType</key>
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.5.0",
10
+ "version": "1.5.2",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -41,12 +41,9 @@
41
41
  "e2e": "E2E=true yarn test -i e2e",
42
42
  "release": "semantic-release",
43
43
  "build": "bob build && merge-dirs lib/typescript/src lib/commonjs && merge-dirs lib/typescript/src lib/module",
44
- "build-skia-ios-framework": "ts-node ./scripts/build-skia-ios-framework.ts",
45
- "build-skia-ios": "ts-node ./scripts/build-skia-ios.ts && yarn build-skia-ios-framework",
46
- "build-skia-android": "ts-node ./scripts/build-skia-android.ts",
47
44
  "clean-skia": "yarn rimraf ./libs && yarn rimraf ../../externals/skia/out",
48
- "copy-skia-headers": "ts-node ./scripts/copy-skia-module-headers.ts",
49
- "build-skia": "yarn rimraf ./libs && yarn build-skia-ios && yarn build-skia-android && yarn copy-skia-headers",
45
+ "build-skia": "ts-node ./scripts/build-skia.ts",
46
+ "copy-skia-headers": "ts-node ./scripts/copy-skia-headers.ts",
50
47
  "clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common",
51
48
  "clang-format-ios": "find ios/ -iname '*.h' -o -iname '*.mm' -o -iname '*.cpp' | xargs clang-format -i",
52
49
  "clang-format-android": "find android/cpp/ -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' | xargs clang-format -i",
@@ -41,7 +41,9 @@ export const WithSkiaWeb = <TProps extends object>({
41
41
  }
42
42
  return getComponent();
43
43
  }),
44
- [getComponent, opts]
44
+ // We we to run this only once.
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
46
+ []
45
47
  );
46
48
  return (
47
49
  <Suspense fallback={fallback ?? null}>