Skip to content

Commit 6a122c6

Browse files
authored
Merge branch 'main' into fix/skia-value-name
2 parents e5e4df3 + 51c85c6 commit 6a122c6

File tree

110 files changed

+246
-237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+246
-237
lines changed

example/src/Examples/API/Images.tsx

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,24 @@ const rects = [
2626
];
2727

2828
export const Images = () => {
29+
// Verifies that the error handler for images are working correctly.
30+
useImage(new Uint8Array([0, 0, 0, 255]), (err) => {
31+
if (err.message !== "Could not load data") {
32+
throw new Error(
33+
`Expected error message to be 'Could not load data' - got '${err.message}'`
34+
);
35+
}
36+
});
37+
useImage("https://reactjs.org/invalid.jpg", (err) => {
38+
if (err.message !== "Could not load data") {
39+
throw new Error(
40+
`Expected error message to be 'Could not load data' - got '${err.message}'`
41+
);
42+
}
43+
});
44+
2945
const oslo = useImage(require("../../assets/oslo.jpg"));
30-
if (oslo === null) {
31-
return null;
32-
}
46+
3347
return (
3448
<ScrollView>
3549
{fits.map((fit, i) => (
@@ -47,14 +61,16 @@ export const Images = () => {
4761
height={height}
4862
color="lightblue"
4963
/>
50-
<Image
51-
image={oslo}
52-
x={x}
53-
y={y}
54-
width={width}
55-
height={height}
56-
fit={fit}
57-
/>
64+
{oslo ? (
65+
<Image
66+
image={oslo}
67+
x={x}
68+
y={y}
69+
width={width}
70+
height={height}
71+
fit={fit}
72+
/>
73+
) : null}
5874
</React.Fragment>
5975
);
6076
})}

example/src/Examples/API/SVG.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ const { width, height } = Dimensions.get("window");
66

77
export const SVG = () => {
88
const svg = useSVG(require("./tiger.svg"));
9-
if (svg === null) {
10-
return null;
11-
}
129
return (
1310
<Canvas style={{ flex: 1 }}>
14-
<ImageSVG svg={svg} x={0} y={0} width={width / 2} height={height / 2} />
11+
{svg ? (
12+
<ImageSVG svg={svg} x={0} y={0} width={width / 2} height={height / 2} />
13+
) : null}
1514
</Canvas>
1615
);
1716
};

package/src/animation/functions/interpolateColors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { mix } from "../../renderer";
2-
import type { Color } from "../../skia";
2+
import type { Color, SkColor } from "../../skia";
33
import { Skia } from "../../skia";
4-
import type { SkColor } from "../../skia/Color";
54

65
import { interpolate } from "./interpolate";
76

package/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import "./skia/NativeSetup";
2-
32
export * from "./renderer";
43
export * from "./views";
54
export * from "./skia";

package/src/renderer/Canvas.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ import ReactReconciler from "react-reconciler";
1919

2020
import { SkiaView, useDrawCallback } from "../views";
2121
import type { TouchHandler } from "../views";
22-
import { Skia } from "../skia";
23-
import type { FontMgr } from "../skia/FontMgr/FontMgr";
22+
import { Skia, SkiaPaint } from "../skia";
23+
import type { FontMgr } from "../skia";
2424
import { useValue } from "../values/hooks/useValue";
2525
import type { SkiaValue } from "../values/types";
26-
import { SkiaPaint } from "../skia/Paint/Paint";
2726

2827
import { debug as hostDebug, skHostConfig } from "./HostConfig";
2928
// import { debugTree } from "./nodes";

package/src/renderer/DrawingContext.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { RefObject } from "react";
22

33
import type { DrawingInfo, SkiaView } from "../views";
4-
import type { SkCanvas, SkPaint } from "../skia";
5-
import type { FontMgr } from "../skia/FontMgr/FontMgr";
4+
import type { FontMgr, SkCanvas, SkPaint } from "../skia";
65

76
import type { Vector } from "./processors/math/Vector";
87

package/src/renderer/components/Blend.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import type { ReactNode } from "react";
22
import React from "react";
33

4-
import { isImageFilter, Skia, BlendMode } from "../../skia";
4+
import { isImageFilter, Skia, BlendMode, isShader } from "../../skia";
55
import { createDeclaration } from "../nodes";
66
import type { AnimatedProps, SkEnum } from "../processors";
7-
import { isShader } from "../../skia/Shader/Shader";
87
import { enumKey } from "../processors/Paint";
98

109
interface BlendProps {

package/src/renderer/components/Compose.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React from "react";
22
import type { ReactNode } from "react";
33

4-
import { Skia } from "../../skia";
4+
import { Skia, isImageFilter, isColorFilter } from "../../skia";
55
import { createDeclaration } from "../nodes/Declaration";
66
import type { AnimatedProps } from "../processors/Animations/Animations";
7-
import { isColorFilter } from "../../skia/ColorFilter/ColorFilter";
8-
import { isImageFilter } from "../../skia/ImageFilter/ImageFilter";
97

108
export interface ComposeProps {
119
children: ReactNode | ReactNode[];

package/src/renderer/components/colorFilters/Lerp.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from "react";
22
import type { ReactNode } from "react";
33

4-
import { Skia } from "../../../skia";
4+
import { Skia, isColorFilter } from "../../../skia";
55
import { createDeclaration } from "../../nodes/Declaration";
66
import type { AnimatedProps } from "../../processors/Animations/Animations";
7-
import { isColorFilter } from "../../../skia/ColorFilter/ColorFilter";
87

98
import { composeColorFilter } from "./Compose";
109

package/src/renderer/components/imageFilters/DisplacementMap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from "react";
22
import type { ReactNode } from "react";
33

4-
import { Skia } from "../../../skia";
4+
import { Skia, ColorChannel } from "../../../skia";
55
import { createDeclaration } from "../../nodes";
66
import type { SkEnum, AnimatedProps } from "../../processors";
77
import { enumKey } from "../../processors";
8-
import { ColorChannel } from "../../../skia/ImageFilter/ImageFilterFactory";
98

109
import { getInput } from "./getInput";
1110

0 commit comments

Comments
 (0)