@shopify/react-native-skia 1.4.2 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +38 -6
- package/android/build.gradle +1 -0
- package/android/cpp/jni/include/JniSkiaBaseView.h +0 -4
- package/android/cpp/jni/include/JniSkiaDomView.h +0 -6
- package/android/cpp/jni/include/JniSkiaPictureView.h +0 -6
- package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -20
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -72
- package/cpp/rnskia/RNSkDomView.cpp +0 -79
- package/cpp/rnskia/RNSkDomView.h +1 -39
- package/cpp/rnskia/RNSkPictureView.h +0 -1
- package/cpp/rnskia/RNSkView.h +0 -17
- package/ios/RNSkia-iOS/DisplayLink.mm +7 -0
- package/ios/RNSkia-iOS/SkiaUIView.mm +0 -51
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +1 -2
- package/lib/commonjs/renderer/Canvas.js +0 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.d.ts +2 -11
- package/lib/commonjs/views/SkiaBaseWebView.js +3 -31
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +0 -12
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.d.ts +2 -2
- package/lib/commonjs/views/SkiaDomView.web.js +1 -6
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaJSDomView.js +0 -12
- package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +0 -26
- package/lib/commonjs/views/types.js +0 -8
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/commonjs/web/WithSkiaWeb.js +4 -1
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +1 -2
- package/lib/module/renderer/Canvas.js +0 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.d.ts +2 -11
- package/lib/module/views/SkiaBaseWebView.js +3 -31
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +0 -12
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.d.ts +2 -2
- package/lib/module/views/SkiaDomView.web.js +1 -6
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaJSDomView.js +0 -12
- package/lib/module/views/SkiaJSDomView.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.d.ts +0 -26
- package/lib/module/views/types.js +1 -7
- package/lib/module/views/types.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +4 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -3
- package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +1 -1
- package/lib/typescript/lib/commonjs/views/types.d.ts +0 -1
- package/lib/typescript/lib/module/mock/index.d.ts +0 -1
- package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +0 -3
- package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +1 -1
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/lib/module/views/types.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +2 -11
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +2 -2
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/lib/typescript/src/views/types.d.ts +0 -26
- 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/libskparagraph.xcframework/Info.plist +5 -5
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- 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/Info.plist +5 -5
- 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/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- 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 +3 -6
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +1 -5
- package/src/renderer/__tests__/setup.tsx +0 -2
- package/src/skia/web/JsiSkia.ts +1 -1
- package/src/views/SkiaBaseWebView.tsx +5 -42
- package/src/views/SkiaDomView.tsx +2 -14
- package/src/views/SkiaDomView.web.tsx +2 -9
- package/src/views/SkiaJSDomView.tsx +2 -14
- package/src/views/index.ts +0 -1
- package/src/views/types.ts +0 -32
- package/src/web/WithSkiaWeb.tsx +3 -1
- package/cpp/rnskia/RNSkInfoParameter.h +0 -92
- package/lib/commonjs/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
- package/lib/commonjs/views/useTouchHandler.d.ts +0 -22
- package/lib/commonjs/views/useTouchHandler.js +0 -83
- package/lib/commonjs/views/useTouchHandler.js.map +0 -1
- package/lib/module/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
- package/lib/module/views/useTouchHandler.d.ts +0 -22
- package/lib/module/views/useTouchHandler.js +0 -75
- package/lib/module/views/useTouchHandler.js.map +0 -1
- package/lib/typescript/lib/commonjs/views/useTouchHandler.d.ts +0 -12
- package/lib/typescript/lib/module/views/useTouchHandler.d.ts +0 -2
- package/lib/typescript/src/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
- package/lib/typescript/src/views/useTouchHandler.d.ts +0 -22
- package/src/renderer/__tests__/TouchHandler.spec.tsx +0 -113
- package/src/views/useTouchHandler.ts +0 -107
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./SkiaDomView\";\nexport * from \"./types\";\
|
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
|
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":[
|
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":[]}
|
@@ -17,7 +17,10 @@ export const WithSkiaWeb = ({
|
|
17
17
|
console.warn("<WithSkiaWeb /> is only necessary on web. Consider not using on native.");
|
18
18
|
}
|
19
19
|
return getComponent();
|
20
|
-
}),
|
20
|
+
}),
|
21
|
+
// We we to run this only once.
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
23
|
+
[]);
|
21
24
|
return /*#__PURE__*/React.createElement(Suspense, {
|
22
25
|
fallback: fallback !== null && fallback !== void 0 ? fallback : null
|
23
26
|
}, /*#__PURE__*/React.createElement(Inner, componentProps));
|
@@ -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 [
|
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":[]}
|
@@ -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");
|
@@ -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 +1 @@
|
|
1
|
-
export
|
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 {
|
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
|
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
|
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
|
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
|
6
|
+
protected renderInCanvas(canvas: SkCanvas): void;
|
7
7
|
}
|
@@ -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
|
}
|
Binary file
|
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskottie.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
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-
|
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>
|
Binary file
|
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskparagraph.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
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-
|
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>
|
Binary file
|
package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskshaper.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
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-
|
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>
|
Binary file
|
Binary file
|
Binary file
|
package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a
CHANGED
Binary file
|
package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a
CHANGED
Binary file
|
Binary file
|
@@ -8,34 +8,34 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libsvg.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
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-
|
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>
|
Binary file
|
Binary file
|
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.
|
10
|
+
"version": "1.5.1",
|
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
|
-
"
|
49
|
-
"
|
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",
|
package/src/mock/index.ts
CHANGED
package/src/renderer/Canvas.tsx
CHANGED
@@ -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 {
|
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
|
|
package/src/skia/web/JsiSkia.ts
CHANGED