@shopify/react-native-skia 0.1.174 → 0.1.176
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.
- package/android/CMakeLists.txt +5 -5
- package/android/build.gradle +27 -7
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaModule.java +1 -1
- package/cpp/rnskia/RNSkJsView.cpp +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +12 -8
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +8 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +8 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +7 -26
- package/src/skia/web/JsiSkSurfaceFactory.ts +6 -3
package/android/CMakeLists.txt
CHANGED
@@ -5,7 +5,7 @@ set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
5
|
set (CMAKE_CXX_STANDARD 17)
|
6
6
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
|
7
7
|
|
8
|
-
set (PACKAGE_NAME "
|
8
|
+
set (PACKAGE_NAME "rnskia")
|
9
9
|
set (SKIA_LIB "skia")
|
10
10
|
set (SKIA_SVG_LIB "svg")
|
11
11
|
set (SKIA_SKSHAPER_LIB "skshaper")
|
@@ -31,7 +31,7 @@ link_directories(../libs/android/${ANDROID_ABI}/)
|
|
31
31
|
|
32
32
|
if(${REACT_NATIVE_VERSION} LESS 66)
|
33
33
|
file(
|
34
|
-
TO_CMAKE_PATH
|
34
|
+
TO_CMAKE_PATH
|
35
35
|
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
|
36
36
|
INCLUDE_JSI_CPP
|
37
37
|
)
|
@@ -59,7 +59,7 @@ add_library(
|
|
59
59
|
"${PROJECT_SOURCE_DIR}/cpp/rnskia/dom/base/ConcatablePaint.cpp"
|
60
60
|
|
61
61
|
"${PROJECT_SOURCE_DIR}/cpp/api/third_party/CSSColorParser.cpp"
|
62
|
-
|
62
|
+
|
63
63
|
)
|
64
64
|
|
65
65
|
target_include_directories(
|
@@ -92,7 +92,7 @@ target_include_directories(
|
|
92
92
|
cpp/rnskia/dom/base
|
93
93
|
cpp/rnskia/dom/nodes
|
94
94
|
cpp/rnskia/dom/props
|
95
|
-
cpp/utils
|
95
|
+
cpp/utils
|
96
96
|
|
97
97
|
${libfbjni_include_DIRS}
|
98
98
|
)
|
@@ -205,4 +205,4 @@ target_link_libraries(
|
|
205
205
|
-lGLESv2
|
206
206
|
-lEGL
|
207
207
|
-landroid
|
208
|
-
)
|
208
|
+
)
|
package/android/build.gradle
CHANGED
@@ -80,6 +80,7 @@ def reactProperties = new Properties()
|
|
80
80
|
file("$nodeModules/react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
81
81
|
def FULL_RN_VERSION = (System.getenv("REACT_NATIVE_OVERRIDE_VERSION") ?: reactProperties.getProperty("VERSION_NAME"))
|
82
82
|
def REACT_NATIVE_VERSION = FULL_RN_VERSION.split("\\.")[1].toInteger()
|
83
|
+
def ENABLE_PREFAB = REACT_NATIVE_VERSION > 68
|
83
84
|
|
84
85
|
logger.warn("react-native-skia: RN Version: ${REACT_NATIVE_VERSION} / ${FULL_RN_VERSION}")
|
85
86
|
logger.warn("react-native-skia: isSourceBuild: ${sourceBuild}")
|
@@ -87,6 +88,7 @@ logger.warn("react-native-skia: PrebuiltDir: ${prebuiltDir}")
|
|
87
88
|
logger.warn("react-native-skia: buildType: ${buildType}")
|
88
89
|
logger.warn("react-native-skia: buildDir: ${buildDir}")
|
89
90
|
logger.warn("react-native-skia: node_modules: ${nodeModules}")
|
91
|
+
logger.warn("react-native-skia: Enable Prefab: ${ENABLE_PREFAB}")
|
90
92
|
|
91
93
|
buildscript {
|
92
94
|
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
@@ -132,14 +134,10 @@ android {
|
|
132
134
|
|
133
135
|
externalNativeBuild {
|
134
136
|
cmake {
|
135
|
-
path file('CMakeLists.txt')
|
137
|
+
path file('CMakeLists.txt')
|
136
138
|
}
|
137
139
|
}
|
138
140
|
|
139
|
-
buildFeatures {
|
140
|
-
prefab true
|
141
|
-
}
|
142
|
-
|
143
141
|
packagingOptions {
|
144
142
|
excludes = [
|
145
143
|
"**/libc++_shared.so",
|
@@ -150,6 +148,18 @@ android {
|
|
150
148
|
]
|
151
149
|
}
|
152
150
|
|
151
|
+
if (ENABLE_PREFAB) {
|
152
|
+
buildFeatures {
|
153
|
+
prefab true
|
154
|
+
prefabPublishing true
|
155
|
+
}
|
156
|
+
prefab {
|
157
|
+
rnskia {
|
158
|
+
headers "${project.buildDir}/headers/rnskia/"
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
153
163
|
// Create new configurations that can be referred to in dependencies.
|
154
164
|
// The Android Gradle Plugin 3.* does not allow hooking into existing
|
155
165
|
// configurations like `implementation`.
|
@@ -255,6 +265,16 @@ task extractJNIFiles {
|
|
255
265
|
|
256
266
|
extractJNIFiles.mustRunAfter extractAARHeaders
|
257
267
|
|
268
|
+
if (ENABLE_PREFAB) {
|
269
|
+
// Package everything with the original file structure
|
270
|
+
task prepareHeaders(type: Copy) {
|
271
|
+
from('./cpp')
|
272
|
+
into "${project.buildDir}/headers/rnskia/"
|
273
|
+
includeEmptyDirs = false
|
274
|
+
}
|
275
|
+
preBuild.dependsOn(prepareHeaders)
|
276
|
+
}
|
277
|
+
|
258
278
|
def nativeBuildDependsOn(dependsOnTask, variant) {
|
259
279
|
def buildTasks = tasks.findAll({ task ->
|
260
280
|
!task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake")) })
|
@@ -266,5 +286,5 @@ def nativeBuildDependsOn(dependsOnTask, variant) {
|
|
266
286
|
|
267
287
|
afterEvaluate {
|
268
288
|
nativeBuildDependsOn(extractAARHeaders, null)
|
269
|
-
nativeBuildDependsOn(extractJNIFiles, null)
|
270
|
-
}
|
289
|
+
nativeBuildDependsOn(extractJNIFiles, null)
|
290
|
+
}
|
@@ -57,7 +57,7 @@ public class RNSkiaModule extends ReactContextBaseJavaModule implements Lifecycl
|
|
57
57
|
}
|
58
58
|
|
59
59
|
try {
|
60
|
-
System.loadLibrary("
|
60
|
+
System.loadLibrary("rnskia");
|
61
61
|
ReactApplicationContext context = weakReactContext.get();
|
62
62
|
if (context == null) {
|
63
63
|
Log.e(NAME, "React Application Context was null!");
|
@@ -8,7 +8,7 @@ RNSkJsRenderer::RNSkJsRenderer(std::function<void()> requestRedraw,
|
|
8
8
|
std::shared_ptr<RNSkPlatformContext> context)
|
9
9
|
: RNSkRenderer(requestRedraw),
|
10
10
|
_jsiCanvas(std::make_shared<JsiSkCanvas>(context)),
|
11
|
-
_platformContext(
|
11
|
+
_platformContext(context),
|
12
12
|
_infoObject(std::make_shared<RNSkInfoObject>()),
|
13
13
|
_jsDrawingLock(std::make_shared<std::timed_mutex>()),
|
14
14
|
_gpuDrawingLock(std::make_shared<std::timed_mutex>()),
|
@@ -73,14 +73,18 @@ void RNSkMetalCanvasProvider::renderToCanvas(
|
|
73
73
|
// background or inactive. This will cause an error that might clear the
|
74
74
|
// CAMetalLayer so that the canvas is empty when the app receives focus again.
|
75
75
|
// Reference: https://github.com/Shopify/react-native-skia/issues/1257
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
// NOTE: UIApplication.sharedApplication.applicationState can only be
|
77
|
+
// accessed from the main thread so we need to check here.
|
78
|
+
if ([[NSThread currentThread] isMainThread]) {
|
79
|
+
auto state = UIApplication.sharedApplication.applicationState;
|
80
|
+
if (state == UIApplicationStateBackground ||
|
81
|
+
state == UIApplicationStateInactive) {
|
82
|
+
// Request a redraw in the next run loop callback
|
83
|
+
_requestRedraw();
|
84
|
+
// and don't draw now since it might cause errors in the metal renderer if
|
85
|
+
// we try to render while in the background. (see above issue)
|
86
|
+
return;
|
87
|
+
}
|
84
88
|
}
|
85
89
|
|
86
90
|
// Get render context for current thread
|
@@ -34,7 +34,14 @@ class JsiSkSurfaceFactory extends _Host.Host {
|
|
34
34
|
surface = this.CanvasKit.MakeSurface(width, height);
|
35
35
|
} else {
|
36
36
|
const offscreen = new OC(width, height);
|
37
|
-
|
37
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
38
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
39
|
+
|
40
|
+
if (!grContext) {
|
41
|
+
throw new Error("Could not make a graphics context");
|
42
|
+
}
|
43
|
+
|
44
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
38
45
|
}
|
39
46
|
|
40
47
|
if (!surface) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkSurfaceFactory","Host","constructor","CanvasKit","Make","width","height","surface","MakeSurface","JsiSkSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","
|
1
|
+
{"version":3,"names":["JsiSkSurfaceFactory","Host","constructor","CanvasKit","Make","width","height","surface","MakeSurface","JsiSkSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","webglContext","GetWebGLContext","grContext","MakeWebGLContext","Error","MakeRenderTarget"],"sources":["JsiSkSurfaceFactory.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SurfaceFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkSurfaceFactory extends Host implements SurfaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(width: number, height: number) {\n const surface = this.CanvasKit.MakeSurface(width, height);\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n\n MakeOffscreen(width: number, height: number) {\n // OffscreenCanvas may be unvailable in some environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OC = (globalThis as any).OffscreenCanvas;\n let surface: Surface | null;\n if (OC === undefined) {\n surface = this.CanvasKit.MakeSurface(width, height);\n } else {\n const offscreen = new OC(width, height);\n const webglContext = this.CanvasKit.GetWebGLContext(offscreen);\n const grContext = this.CanvasKit.MakeWebGLContext(webglContext);\n if (!grContext) {\n throw new Error(\"Could not make a graphics context\");\n }\n surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);\n }\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n}\n"],"mappings":";;;;;;;AAIA;;AACA;;AAEO,MAAMA,mBAAN,SAAkCC,UAAlC,CAAiE;EACtEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,IAAI,CAACC,KAAD,EAAgBC,MAAhB,EAAgC;IAClC,MAAMC,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAhB;;IACA,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIE,0BAAJ,CAAiB,KAAKN,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;EAEDG,aAAa,CAACL,KAAD,EAAgBC,MAAhB,EAAgC;IAC3C;IACA;IACA,MAAMK,EAAE,GAAIC,UAAD,CAAoBC,eAA/B;IACA,IAAIN,OAAJ;;IACA,IAAII,EAAE,KAAKG,SAAX,EAAsB;MACpBP,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAV;IACD,CAFD,MAEO;MACL,MAAMS,SAAS,GAAG,IAAIJ,EAAJ,CAAON,KAAP,EAAcC,MAAd,CAAlB;MACA,MAAMU,YAAY,GAAG,KAAKb,SAAL,CAAec,eAAf,CAA+BF,SAA/B,CAArB;MACA,MAAMG,SAAS,GAAG,KAAKf,SAAL,CAAegB,gBAAf,CAAgCH,YAAhC,CAAlB;;MACA,IAAI,CAACE,SAAL,EAAgB;QACd,MAAM,IAAIE,KAAJ,CAAU,mCAAV,CAAN;MACD;;MACDb,OAAO,GAAG,KAAKJ,SAAL,CAAekB,gBAAf,CAAgCH,SAAhC,EAA2Cb,KAA3C,EAAkDC,MAAlD,CAAV;IACD;;IACD,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIE,0BAAJ,CAAiB,KAAKN,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;AAjCqE"}
|
@@ -25,7 +25,14 @@ export class JsiSkSurfaceFactory extends Host {
|
|
25
25
|
surface = this.CanvasKit.MakeSurface(width, height);
|
26
26
|
} else {
|
27
27
|
const offscreen = new OC(width, height);
|
28
|
-
|
28
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
29
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
30
|
+
|
31
|
+
if (!grContext) {
|
32
|
+
throw new Error("Could not make a graphics context");
|
33
|
+
}
|
34
|
+
|
35
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
29
36
|
}
|
30
37
|
|
31
38
|
if (!surface) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Host","JsiSkSurface","JsiSkSurfaceFactory","constructor","CanvasKit","Make","width","height","surface","MakeSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","
|
1
|
+
{"version":3,"names":["Host","JsiSkSurface","JsiSkSurfaceFactory","constructor","CanvasKit","Make","width","height","surface","MakeSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","undefined","offscreen","webglContext","GetWebGLContext","grContext","MakeWebGLContext","Error","MakeRenderTarget"],"sources":["JsiSkSurfaceFactory.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SurfaceFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkSurfaceFactory extends Host implements SurfaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(width: number, height: number) {\n const surface = this.CanvasKit.MakeSurface(width, height);\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n\n MakeOffscreen(width: number, height: number) {\n // OffscreenCanvas may be unvailable in some environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OC = (globalThis as any).OffscreenCanvas;\n let surface: Surface | null;\n if (OC === undefined) {\n surface = this.CanvasKit.MakeSurface(width, height);\n } else {\n const offscreen = new OC(width, height);\n const webglContext = this.CanvasKit.GetWebGLContext(offscreen);\n const grContext = this.CanvasKit.MakeWebGLContext(webglContext);\n if (!grContext) {\n throw new Error(\"Could not make a graphics context\");\n }\n surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);\n }\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n}\n"],"mappings":"AAIA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,OAAO,MAAMC,mBAAN,SAAkCF,IAAlC,CAAiE;EACtEG,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,IAAI,CAACC,KAAD,EAAgBC,MAAhB,EAAgC;IAClC,MAAMC,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAhB;;IACA,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIP,YAAJ,CAAiB,KAAKG,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;EAEDE,aAAa,CAACJ,KAAD,EAAgBC,MAAhB,EAAgC;IAC3C;IACA;IACA,MAAMI,EAAE,GAAIC,UAAD,CAAoBC,eAA/B;IACA,IAAIL,OAAJ;;IACA,IAAIG,EAAE,KAAKG,SAAX,EAAsB;MACpBN,OAAO,GAAG,KAAKJ,SAAL,CAAeK,WAAf,CAA2BH,KAA3B,EAAkCC,MAAlC,CAAV;IACD,CAFD,MAEO;MACL,MAAMQ,SAAS,GAAG,IAAIJ,EAAJ,CAAOL,KAAP,EAAcC,MAAd,CAAlB;MACA,MAAMS,YAAY,GAAG,KAAKZ,SAAL,CAAea,eAAf,CAA+BF,SAA/B,CAArB;MACA,MAAMG,SAAS,GAAG,KAAKd,SAAL,CAAee,gBAAf,CAAgCH,YAAhC,CAAlB;;MACA,IAAI,CAACE,SAAL,EAAgB;QACd,MAAM,IAAIE,KAAJ,CAAU,mCAAV,CAAN;MACD;;MACDZ,OAAO,GAAG,KAAKJ,SAAL,CAAeiB,gBAAf,CAAgCH,SAAhC,EAA2CZ,KAA3C,EAAkDC,MAAlD,CAAV;IACD;;IACD,IAAI,CAACC,OAAL,EAAc;MACZ,OAAO,IAAP;IACD;;IACD,OAAO,IAAIP,YAAJ,CAAiB,KAAKG,SAAtB,EAAiCI,OAAjC,CAAP;EACD;;AAjCqE"}
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskia.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
-
<string>x86_64</string>
|
17
16
|
</array>
|
18
17
|
<key>SupportedPlatform</key>
|
19
18
|
<string>ios</string>
|
20
|
-
<key>SupportedPlatformVariant</key>
|
21
|
-
<string>simulator</string>
|
22
19
|
</dict>
|
23
20
|
<dict>
|
24
21
|
<key>LibraryIdentifier</key>
|
25
|
-
<string>ios-
|
22
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
26
23
|
<key>LibraryPath</key>
|
27
24
|
<string>libskia.a</string>
|
28
25
|
<key>SupportedArchitectures</key>
|
29
26
|
<array>
|
30
27
|
<string>arm64</string>
|
31
28
|
<string>arm64e</string>
|
29
|
+
<string>x86_64</string>
|
32
30
|
</array>
|
33
31
|
<key>SupportedPlatform</key>
|
34
32
|
<string>ios</string>
|
33
|
+
<key>SupportedPlatformVariant</key>
|
34
|
+
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskottie.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
-
<string>x86_64</string>
|
17
16
|
</array>
|
18
17
|
<key>SupportedPlatform</key>
|
19
18
|
<string>ios</string>
|
20
|
-
<key>SupportedPlatformVariant</key>
|
21
|
-
<string>simulator</string>
|
22
19
|
</dict>
|
23
20
|
<dict>
|
24
21
|
<key>LibraryIdentifier</key>
|
25
|
-
<string>ios-
|
22
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
26
23
|
<key>LibraryPath</key>
|
27
24
|
<string>libskottie.a</string>
|
28
25
|
<key>SupportedArchitectures</key>
|
29
26
|
<array>
|
30
27
|
<string>arm64</string>
|
31
28
|
<string>arm64e</string>
|
29
|
+
<string>x86_64</string>
|
32
30
|
</array>
|
33
31
|
<key>SupportedPlatform</key>
|
34
32
|
<string>ios</string>
|
33
|
+
<key>SupportedPlatformVariant</key>
|
34
|
+
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libsksg.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
16
17
|
</array>
|
17
18
|
<key>SupportedPlatform</key>
|
18
19
|
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
19
22
|
</dict>
|
20
23
|
<dict>
|
21
24
|
<key>LibraryIdentifier</key>
|
22
|
-
<string>ios-
|
25
|
+
<string>ios-arm64_arm64e</string>
|
23
26
|
<key>LibraryPath</key>
|
24
27
|
<string>libsksg.a</string>
|
25
28
|
<key>SupportedArchitectures</key>
|
26
29
|
<array>
|
27
30
|
<string>arm64</string>
|
28
31
|
<string>arm64e</string>
|
29
|
-
<string>x86_64</string>
|
30
32
|
</array>
|
31
33
|
<key>SupportedPlatform</key>
|
32
34
|
<string>ios</string>
|
33
|
-
<key>SupportedPlatformVariant</key>
|
34
|
-
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/package.json
CHANGED
@@ -24,7 +24,12 @@ Pod::Spec.new do |s|
|
|
24
24
|
s.pod_target_xcconfig = {
|
25
25
|
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SK_GL=1 SK_METAL=1',
|
26
26
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
27
|
-
'DEFINES_MODULE' => 'YES'
|
27
|
+
'DEFINES_MODULE' => 'YES',
|
28
|
+
"HEADER_SEARCH_PATHS" => '"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/" ' +
|
29
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/api/" ' +
|
30
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/rnskia/" ' +
|
31
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/rnskia/dom/" ' +
|
32
|
+
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/skia/"'
|
28
33
|
}
|
29
34
|
|
30
35
|
s.frameworks = 'GLKit', 'MetalKit'
|
@@ -40,33 +45,9 @@ Pod::Spec.new do |s|
|
|
40
45
|
# All iOS cpp/h files
|
41
46
|
s.source_files = [
|
42
47
|
"ios/**/*.{h,c,cc,cpp,m,mm,swift}",
|
48
|
+
"cpp/**/*.{h,cpp}"
|
43
49
|
]
|
44
50
|
|
45
|
-
s.subspec 'SkiaHeaders' do |ss|
|
46
|
-
ss.header_mappings_dir = 'cpp/skia'
|
47
|
-
ss.source_files = "cpp/skia/**/*.{h,cpp}"
|
48
|
-
end
|
49
|
-
|
50
|
-
s.subspec 'Utils' do |ss|
|
51
|
-
ss.header_mappings_dir = 'cpp/utils'
|
52
|
-
ss.source_files = "cpp/utils/**/*.{h,cpp}"
|
53
|
-
end
|
54
|
-
|
55
|
-
s.subspec 'Jsi' do |ss|
|
56
|
-
ss.header_mappings_dir = 'cpp/jsi'
|
57
|
-
ss.source_files = "cpp/jsi/**/*.{h,cpp}"
|
58
|
-
end
|
59
|
-
|
60
|
-
s.subspec 'Api' do |ss|
|
61
|
-
ss.header_mappings_dir = 'cpp/api'
|
62
|
-
ss.source_files = "cpp/api/**/*.{h,cpp}"
|
63
|
-
end
|
64
|
-
|
65
|
-
s.subspec 'RNSkia' do |ss|
|
66
|
-
ss.header_mappings_dir = 'cpp/rnskia'
|
67
|
-
ss.source_files = "cpp/rnskia/**/*.{h,cpp}"
|
68
|
-
end
|
69
|
-
|
70
51
|
s.dependency "React"
|
71
52
|
s.dependency "React-callinvoker"
|
72
53
|
s.dependency "React-Core"
|
@@ -27,9 +27,12 @@ export class JsiSkSurfaceFactory extends Host implements SurfaceFactory {
|
|
27
27
|
surface = this.CanvasKit.MakeSurface(width, height);
|
28
28
|
} else {
|
29
29
|
const offscreen = new OC(width, height);
|
30
|
-
|
31
|
-
|
32
|
-
)
|
30
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
31
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
32
|
+
if (!grContext) {
|
33
|
+
throw new Error("Could not make a graphics context");
|
34
|
+
}
|
35
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
33
36
|
}
|
34
37
|
if (!surface) {
|
35
38
|
return null;
|