Skip to content

Commit 0d8454e

Browse files
authored
Merge pull request #530 from Shopify/decouple-reconciller
Decouple Skia from Reconciller
2 parents 9726c4a + 1b52680 commit 0d8454e

File tree

134 files changed

+714
-539
lines changed

Some content is hidden

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

134 files changed

+714
-539
lines changed

docs/yarn.lock

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,9 +2735,8 @@
27352735
integrity sha512-W/J0fNYVO01tioHjvYWQ9m6RgndVtbElzYozBq1ZPrHO/iCzlqoySHl4gO/fpCl9QEFjvJfjPgtPMTMlsoq5DQ==
27362736

27372737
"@shopify/react-native-skia@link:../package":
2738-
version "0.1.100"
2739-
dependencies:
2740-
react-reconciler "^0.26.2"
2738+
version "0.0.0"
2739+
uid ""
27412740

27422741
"@sideway/address@^4.1.3":
27432742
version "4.1.3"
@@ -4089,20 +4088,10 @@ caniuse-api@^3.0.0:
40894088
lodash.memoize "^4.1.2"
40904089
lodash.uniq "^4.5.0"
40914090

4092-
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001272, caniuse-lite@^1.0.30001280:
4093-
version "1.0.30001283"
4094-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001283.tgz#8573685bdae4d733ef18f78d44ba0ca5fe9e896b"
4095-
integrity sha512-9RoKo841j1GQFSJz/nCXOj0sD7tHBtlowjYlrqIUS812x9/emfBLBt6IyMz1zIaYc/eRL8Cs6HPUVi2Hzq4sIg==
4096-
4097-
caniuse-lite@^1.0.30001312:
4098-
version "1.0.30001312"
4099-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz#e11eba4b87e24d22697dae05455d5aea28550d5f"
4100-
integrity sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==
4101-
4102-
caniuse-lite@^1.0.30001317:
4103-
version "1.0.30001327"
4104-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001327.tgz#c1546d7d7bb66506f0ccdad6a7d07fc6d668c858"
4105-
integrity sha512-1/Cg4jlD9qjZzhbzkzEaAC2JHsP0WrOc8Rd/3a3LuajGzGWR/hD7TVyvq99VqmTy99eVh8Zkmdq213OgvgXx7w==
4091+
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001272, caniuse-lite@^1.0.30001280, caniuse-lite@^1.0.30001312, caniuse-lite@^1.0.30001317:
4092+
version "1.0.30001344"
4093+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001344.tgz"
4094+
integrity sha512-0ZFjnlCaXNOAYcV7i+TtdKBp0L/3XEU2MF/x6Du1lrh+SRX4IfzIVL4HNJg5pB2PmFb8rszIGyOvsZnqqRoc2g==
41064095

41074096
ccount@^1.0.0, ccount@^1.0.3:
41084097
version "1.1.0"

example/src/Examples/API/Gradients.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from "react";
22
import { StyleSheet, Dimensions, ScrollView } from "react-native";
33
import {
4+
bottomRight,
5+
center,
6+
topLeft,
47
Skia,
58
rect,
69
Canvas,
710
Rect,
811
LinearGradient,
9-
topLeft,
10-
bottomRight,
11-
center,
1212
RadialGradient,
1313
TwoPointConicalGradient,
1414
SweepGradient,

package/cpp/api/JsiSkPaint.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,11 @@ Returns the underlying object from a host object of this type
215215
static const jsi::HostFunctionType
216216
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
217217
return JSI_HOST_FUNCTION_LAMBDA {
218+
auto paint = SkPaint();
219+
paint.setAntiAlias(true);
218220
// Return the newly constructed object
219221
return jsi::Object::createFromHostObject(
220-
runtime, std::make_shared<JsiSkPaint>(std::move(context), SkPaint()));
222+
runtime, std::make_shared<JsiSkPaint>(std::move(context), paint));
221223
};
222224
}
223225
};

package/jest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,12 @@ module.exports = {
55
// Ignore lib folder - contains build artifacts and should
66
// not be probed for tests
77
modulePathIgnorePatterns: ["<rootDir>/lib/typescript", "setup.ts$"],
8+
transform: {
9+
"^.+\\.(js|jsx)$": "ts-jest",
10+
},
11+
globals: {
12+
"ts-jest": {
13+
tsconfig: "./tsconfig.test.json",
14+
},
15+
},
816
};

package/src/__tests__/setup.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import path from "path";
2+
import fs from "fs";
3+
4+
import type { Surface } from "canvaskit-wasm";
5+
6+
import type { SkSurface } from "../skia";
7+
import { toValue } from "../skia/web/api/Host";
8+
9+
export const processResult = (
10+
surface: SkSurface,
11+
relPath: string,
12+
overwrite = false
13+
) => {
14+
toValue<Surface>(surface).flush();
15+
const image = surface.makeImageSnapshot();
16+
const png = image.encodeToBytes();
17+
const p = path.resolve(__dirname, relPath);
18+
if (fs.existsSync(p) && !overwrite) {
19+
const ref = fs.readFileSync(p);
20+
expect(ref.equals(png)).toBe(true);
21+
} else {
22+
fs.writeFileSync(p, png);
23+
}
24+
};

0 commit comments

Comments
 (0)