@tamagui/native-registry 3.0.0-beta.647.1 → 3.0.0-beta.649.1
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/dist/cjs/processStyleColors.cjs +7 -6
- package/dist/cjs/processStyleColors.native.cjs +7 -6
- package/dist/cjs/processStyleColors.native.js +7 -6
- package/dist/cjs/processStyleColors.native.js.map +1 -1
- package/dist/esm/processStyleColors.mjs +7 -6
- package/dist/esm/processStyleColors.mjs.map +1 -1
- package/dist/esm/processStyleColors.native.js +7 -6
- package/dist/esm/processStyleColors.native.js.map +1 -1
- package/package.json +2 -2
- package/src/processStyleColors.ts +21 -13
- package/types/processStyleColors.d.ts.map +2 -2
|
@@ -50,12 +50,13 @@ function processStyleColors(props) {
|
|
|
50
50
|
out ??= { ...props };
|
|
51
51
|
const processed = (0, import_react_native.processColor)(value);
|
|
52
52
|
if (typeof processed === "number") {
|
|
53
|
-
out[key] =
|
|
54
|
-
|
|
55
|
-
(processed >>>
|
|
56
|
-
(processed & 255) / 255,
|
|
57
|
-
(processed
|
|
58
|
-
|
|
53
|
+
out[key] = {
|
|
54
|
+
space: "srgb",
|
|
55
|
+
r: (processed >>> 16 & 255) / 255,
|
|
56
|
+
g: (processed >>> 8 & 255) / 255,
|
|
57
|
+
b: (processed & 255) / 255,
|
|
58
|
+
a: (processed >>> 24 & 255) / 255
|
|
59
|
+
};
|
|
59
60
|
} else if (processed != null) {
|
|
60
61
|
out[key] = processed;
|
|
61
62
|
}
|
|
@@ -52,12 +52,13 @@ function processStyleColors(props) {
|
|
|
52
52
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
53
53
|
var processed = (0, import_react_native.processColor)(value);
|
|
54
54
|
if (typeof processed === "number") {
|
|
55
|
-
out[key] =
|
|
56
|
-
|
|
57
|
-
(processed >>>
|
|
58
|
-
(processed & 255) / 255,
|
|
59
|
-
(processed
|
|
60
|
-
|
|
55
|
+
out[key] = {
|
|
56
|
+
space: "srgb",
|
|
57
|
+
r: (processed >>> 16 & 255) / 255,
|
|
58
|
+
g: (processed >>> 8 & 255) / 255,
|
|
59
|
+
b: (processed & 255) / 255,
|
|
60
|
+
a: (processed >>> 24 & 255) / 255
|
|
61
|
+
};
|
|
61
62
|
} else if (processed != null) {
|
|
62
63
|
out[key] = processed;
|
|
63
64
|
}
|
|
@@ -52,12 +52,13 @@ function processStyleColors(props) {
|
|
|
52
52
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
53
53
|
var processed = (0, import_react_native.processColor)(value);
|
|
54
54
|
if (typeof processed === "number") {
|
|
55
|
-
out[key] =
|
|
56
|
-
|
|
57
|
-
(processed >>>
|
|
58
|
-
(processed & 255) / 255,
|
|
59
|
-
(processed
|
|
60
|
-
|
|
55
|
+
out[key] = {
|
|
56
|
+
space: "srgb",
|
|
57
|
+
r: (processed >>> 16 & 255) / 255,
|
|
58
|
+
g: (processed >>> 8 & 255) / 255,
|
|
59
|
+
b: (processed & 255) / 255,
|
|
60
|
+
a: (processed >>> 24 & 255) / 255
|
|
61
|
+
};
|
|
61
62
|
} else if (processed != null) {
|
|
62
63
|
out[key] = processed;
|
|
63
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["cjs/processStyleColors.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar processStyleColors_exports = {};\n__export(processStyleColors_exports, {\n processStyleColors: () => processStyleColors\n});\nmodule.exports = __toCommonJS(processStyleColors_exports);\nvar import_react_native = require(\"react-native\");\nvar COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n var out = null;\n for (var key in props) {\n var value = props[key];\n if (COLOR_PROPS.has(key) && typeof value === \"string\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n var processed = (0, import_react_native.processColor)(value);\n if (typeof processed === \"number\") {\n out[key] =
|
|
1
|
+
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["cjs/processStyleColors.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar processStyleColors_exports = {};\n__export(processStyleColors_exports, {\n processStyleColors: () => processStyleColors\n});\nmodule.exports = __toCommonJS(processStyleColors_exports);\nvar import_react_native = require(\"react-native\");\nvar COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n var out = null;\n for (var key in props) {\n var value = props[key];\n if (COLOR_PROPS.has(key) && typeof value === \"string\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n var processed = (0, import_react_native.processColor)(value);\n if (typeof processed === \"number\") {\n out[key] = {\n space: \"srgb\",\n r: (processed >>> 16 & 255) / 255,\n g: (processed >>> 8 & 255) / 255,\n b: (processed & 255) / 255,\n a: (processed >>> 24 & 255) / 255\n };\n } else if (processed != null) {\n out[key] = processed;\n }\n }\n }\n return out !== null && out !== void 0 ? out : props;\n}\n//# sourceMappingURL=processStyleColors.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,6BAA6B,CAAC;AAClC,SAAS,4BAA4B,EACnC,0BAA0B,mBAC5B,CAAC;AACD,OAAO,UAAU,aAAa,0BAA0B;AACxD,IAAI,sBAAsB,QAAQ,cAAc;AAChD,IAAI,8BAA8B,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,mBAAmB,OAAO;CACjC,IAAI,MAAM;CACV,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI,QAAQ,MAAM;EAClB,IAAI,YAAY,IAAI,GAAG,KAAK,OAAO,UAAU,UAAU;GACrD,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;GACA,IAAI,aAAa,GAAG,oBAAoB,cAAc,KAAK;GAC3D,IAAI,OAAO,cAAc,UAAU;IACjC,IAAI,OAAO;KACT,OAAO;KACP,IAAI,cAAc,KAAK,OAAO;KAC9B,IAAI,cAAc,IAAI,OAAO;KAC7B,IAAI,YAAY,OAAO;KACvB,IAAI,cAAc,KAAK,OAAO;IAChC;GACF,OAAO,IAAI,aAAa,MAAM;IAC5B,IAAI,OAAO;GACb;EACF;CACF;CACA,OAAO,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM;AAChD"}
|
|
@@ -27,12 +27,13 @@ function processStyleColors(props) {
|
|
|
27
27
|
out ??= { ...props };
|
|
28
28
|
const processed = processColor(value);
|
|
29
29
|
if (typeof processed === "number") {
|
|
30
|
-
out[key] =
|
|
31
|
-
|
|
32
|
-
(processed >>>
|
|
33
|
-
(processed & 255) / 255,
|
|
34
|
-
(processed
|
|
35
|
-
|
|
30
|
+
out[key] = {
|
|
31
|
+
space: "srgb",
|
|
32
|
+
r: (processed >>> 16 & 255) / 255,
|
|
33
|
+
g: (processed >>> 8 & 255) / 255,
|
|
34
|
+
b: (processed & 255) / 255,
|
|
35
|
+
a: (processed >>> 24 & 255) / 255
|
|
36
|
+
};
|
|
36
37
|
} else if (processed != null) {
|
|
37
38
|
out[key] = processed;
|
|
38
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStyleColors.js","names":[],"sources":["esm/processStyleColors.js"],"sourcesContent":["import { processColor } from \"react-native-web\";\nconst COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n let out = null;\n for (const key in props) {\n const value = props[key];\n if (COLOR_PROPS.has(key) && typeof value === \"string\") {\n out ??= { ...props };\n const processed = processColor(value);\n if (typeof processed === \"number\") {\n out[key] =
|
|
1
|
+
{"version":3,"file":"processStyleColors.js","names":[],"sources":["esm/processStyleColors.js"],"sourcesContent":["import { processColor } from \"react-native-web\";\nconst COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n let out = null;\n for (const key in props) {\n const value = props[key];\n if (COLOR_PROPS.has(key) && typeof value === \"string\") {\n out ??= { ...props };\n const processed = processColor(value);\n if (typeof processed === \"number\") {\n out[key] = {\n space: \"srgb\",\n r: (processed >>> 16 & 255) / 255,\n g: (processed >>> 8 & 255) / 255,\n b: (processed & 255) / 255,\n a: (processed >>> 24 & 255) / 255\n };\n } else if (processed != null) {\n out[key] = processed;\n }\n }\n }\n return out ?? props;\n}\nexport {\n processStyleColors\n};\n//# sourceMappingURL=processStyleColors.js.map\n"],"mappings":";;;AACA,MAAM,8BAA8B,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,mBAAmB,OAAO;CACjC,IAAI,MAAM;CACV,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,QAAQ,MAAM;EACpB,IAAI,YAAY,IAAI,GAAG,KAAK,OAAO,UAAU,UAAU;GACrD,QAAQ,EAAE,GAAG,MAAM;GACnB,MAAM,YAAY,aAAa,KAAK;GACpC,IAAI,OAAO,cAAc,UAAU;IACjC,IAAI,OAAO;KACT,OAAO;KACP,IAAI,cAAc,KAAK,OAAO;KAC9B,IAAI,cAAc,IAAI,OAAO;KAC7B,IAAI,YAAY,OAAO;KACvB,IAAI,cAAc,KAAK,OAAO;IAChC;GACF,OAAO,IAAI,aAAa,MAAM;IAC5B,IAAI,OAAO;GACb;EACF;CACF;CACA,OAAO,OAAO;AAChB"}
|
|
@@ -27,12 +27,13 @@ function processStyleColors(props) {
|
|
|
27
27
|
out !== null && out !== void 0 ? out : out = { ...props };
|
|
28
28
|
var processed = processColor(value);
|
|
29
29
|
if (typeof processed === "number") {
|
|
30
|
-
out[key] =
|
|
31
|
-
|
|
32
|
-
(processed >>>
|
|
33
|
-
(processed & 255) / 255,
|
|
34
|
-
(processed
|
|
35
|
-
|
|
30
|
+
out[key] = {
|
|
31
|
+
space: "srgb",
|
|
32
|
+
r: (processed >>> 16 & 255) / 255,
|
|
33
|
+
g: (processed >>> 8 & 255) / 255,
|
|
34
|
+
b: (processed & 255) / 255,
|
|
35
|
+
a: (processed >>> 24 & 255) / 255
|
|
36
|
+
};
|
|
36
37
|
} else if (processed != null) {
|
|
37
38
|
out[key] = processed;
|
|
38
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["esm/processStyleColors.native.js"],"sourcesContent":["import { processColor } from \"react-native\";\nvar COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n var out = null;\n for (var key in props) {\n var value = props[key];\n if (COLOR_PROPS.has(key) && typeof value === \"string\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n var processed = processColor(value);\n if (typeof processed === \"number\") {\n out[key] =
|
|
1
|
+
{"version":3,"file":"processStyleColors.native.js","names":[],"sources":["esm/processStyleColors.native.js"],"sourcesContent":["import { processColor } from \"react-native\";\nvar COLOR_PROPS = /* @__PURE__ */ new Set([\n \"color\",\n \"backgroundColor\",\n \"borderColor\",\n \"borderTopColor\",\n \"borderBottomColor\",\n \"borderLeftColor\",\n \"borderRightColor\",\n \"borderStartColor\",\n \"borderEndColor\",\n \"borderBlockColor\",\n \"borderBlockStartColor\",\n \"borderBlockEndColor\",\n \"shadowColor\",\n \"textShadowColor\",\n \"textDecorationColor\",\n \"tintColor\",\n \"overlayColor\"\n]);\nfunction processStyleColors(props) {\n var out = null;\n for (var key in props) {\n var value = props[key];\n if (COLOR_PROPS.has(key) && typeof value === \"string\") {\n out !== null && out !== void 0 ? out : out = {\n ...props\n };\n var processed = processColor(value);\n if (typeof processed === \"number\") {\n out[key] = {\n space: \"srgb\",\n r: (processed >>> 16 & 255) / 255,\n g: (processed >>> 8 & 255) / 255,\n b: (processed & 255) / 255,\n a: (processed >>> 24 & 255) / 255\n };\n } else if (processed != null) {\n out[key] = processed;\n }\n }\n }\n return out !== null && out !== void 0 ? out : props;\n}\nexport {\n processStyleColors\n};\n//# sourceMappingURL=processStyleColors.js.map\n"],"mappings":";;;AACA,IAAI,8BAA8B,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,mBAAmB,OAAO;CACjC,IAAI,MAAM;CACV,KAAK,IAAI,OAAO,OAAO;EACrB,IAAI,QAAQ,MAAM;EAClB,IAAI,YAAY,IAAI,GAAG,KAAK,OAAO,UAAU,UAAU;GACrD,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM,MAAM,EAC3C,GAAG,MACL;GACA,IAAI,YAAY,aAAa,KAAK;GAClC,IAAI,OAAO,cAAc,UAAU;IACjC,IAAI,OAAO;KACT,OAAO;KACP,IAAI,cAAc,KAAK,OAAO;KAC9B,IAAI,cAAc,IAAI,OAAO;KAC7B,IAAI,YAAY,OAAO;KACvB,IAAI,cAAc,KAAK,OAAO;IAChC;GACF,OAAO,IAAI,aAAa,MAAM;IAC5B,IAAI,OAAO;GACb;EACF;CACF;CACA,OAAO,QAAQ,QAAQ,QAAQ,KAAK,IAAI,MAAM;AAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/native-registry",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.649.1",
|
|
4
4
|
"description": "Generic native style registry: zero-re-render style updates via Fabric ShadowTree commits",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tamagui/build": "3.0.0-beta.
|
|
48
|
+
"@tamagui/build": "3.0.0-beta.649.1",
|
|
49
49
|
"react": ">=19",
|
|
50
50
|
"react-native": "0.86.2",
|
|
51
51
|
"react-native-nitro-modules": "^0.36.5",
|
|
@@ -4,13 +4,20 @@
|
|
|
4
4
|
* and runtime-mode pushes both use this exact runtime processor before props
|
|
5
5
|
* cross into the engine.
|
|
6
6
|
*
|
|
7
|
-
* Colors go over as `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* Colors go over as `{ space: 'srgb', r, g, b, a }` with each channel a float
|
|
8
|
+
* in 0..1. That shape is the only one both prop parsers a themed view can reach
|
|
9
|
+
* will accept:
|
|
10
|
+
*
|
|
11
|
+
* - C++ `fromRawValueShared` reads it through its `space` branch. The packed
|
|
12
|
+
* ARGB int `processColor` returns is misread here: an opaque grey
|
|
13
|
+
* `0xFFE3E3E3` rendered as `rgb(254, 229, 229)`, taking `0xFF` as red and
|
|
14
|
+
* the real red as alpha, so every themed surface came out tinted pink.
|
|
15
|
+
* - Android additionally mounts some of these props through Java
|
|
16
|
+
* `SurfaceMountingManager.updateProps` -> `ColorPropConverter`, which takes
|
|
17
|
+
* a number or a map and throws `ColorValue: the value must be a number or
|
|
18
|
+
* Object` on anything else. A plain `[r, g, b, a]` array satisfies the C++
|
|
19
|
+
* parser but not this one, and the throw kills the mount-item dispatch and
|
|
20
|
+
* tears the whole React surface down.
|
|
14
21
|
*/
|
|
15
22
|
import { processColor } from 'react-native'
|
|
16
23
|
|
|
@@ -47,12 +54,13 @@ export function processStyleColors(
|
|
|
47
54
|
// Fabric unpacks that shape itself, so it goes over untouched
|
|
48
55
|
if (typeof processed === 'number') {
|
|
49
56
|
// processColor packs ARGB, and is signed on Android, hence >>>
|
|
50
|
-
out[key] =
|
|
51
|
-
|
|
52
|
-
((processed >>>
|
|
53
|
-
(processed & 0xff) / 255,
|
|
54
|
-
(
|
|
55
|
-
|
|
57
|
+
out[key] = {
|
|
58
|
+
space: 'srgb',
|
|
59
|
+
r: ((processed >>> 16) & 0xff) / 255,
|
|
60
|
+
g: ((processed >>> 8) & 0xff) / 255,
|
|
61
|
+
b: (processed & 0xff) / 255,
|
|
62
|
+
a: ((processed >>> 24) & 0xff) / 255,
|
|
63
|
+
}
|
|
56
64
|
} else if (processed != null) {
|
|
57
65
|
out[key] = processed
|
|
58
66
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "
|
|
2
|
+
"mappings": "AA2CA,OAAO,iBAAS,mBACd,OAAO,0BACN",
|
|
3
3
|
"names": [],
|
|
4
4
|
"sources": [
|
|
5
5
|
"src/processStyleColors.ts"
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"/**\n * Fabric's C++ prop parser cannot take colors as CSS strings, so every color\n * prop must be converted before props reach the engine. The compiler mappings\n * and runtime-mode pushes both use this exact runtime processor before props\n * cross into the engine.\n *\n * Colors go over as `
|
|
9
|
+
"/**\n * Fabric's C++ prop parser cannot take colors as CSS strings, so every color\n * prop must be converted before props reach the engine. The compiler mappings\n * and runtime-mode pushes both use this exact runtime processor before props\n * cross into the engine.\n *\n * Colors go over as `{ space: 'srgb', r, g, b, a }` with each channel a float\n * in 0..1. That shape is the only one both prop parsers a themed view can reach\n * will accept:\n *\n * - C++ `fromRawValueShared` reads it through its `space` branch. The packed\n * ARGB int `processColor` returns is misread here: an opaque grey\n * `0xFFE3E3E3` rendered as `rgb(254, 229, 229)`, taking `0xFF` as red and\n * the real red as alpha, so every themed surface came out tinted pink.\n * - Android additionally mounts some of these props through Java\n * `SurfaceMountingManager.updateProps` -> `ColorPropConverter`, which takes\n * a number or a map and throws `ColorValue: the value must be a number or\n * Object` on anything else. A plain `[r, g, b, a]` array satisfies the C++\n * parser but not this one, and the throw kills the mount-item dispatch and\n * tears the whole React surface down.\n */\nimport { processColor } from 'react-native'\n\nconst COLOR_PROPS = new Set([\n 'color',\n 'backgroundColor',\n 'borderColor',\n 'borderTopColor',\n 'borderBottomColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderEndColor',\n 'borderBlockColor',\n 'borderBlockStartColor',\n 'borderBlockEndColor',\n 'shadowColor',\n 'textShadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'overlayColor',\n])\n\nexport function processStyleColors(\n props: Record<string, unknown>\n): Record<string, unknown> {\n let out: Record<string, unknown> | null = null\n for (const key in props) {\n const value = props[key]\n if (COLOR_PROPS.has(key) && typeof value === 'string') {\n out ??= { ...props }\n const processed = processColor(value)\n // a platform color resolves to an opaque object rather than a number, and\n // Fabric unpacks that shape itself, so it goes over untouched\n if (typeof processed === 'number') {\n // processColor packs ARGB, and is signed on Android, hence >>>\n out[key] = {\n space: 'srgb',\n r: ((processed >>> 16) & 0xff) / 255,\n g: ((processed >>> 8) & 0xff) / 255,\n b: (processed & 0xff) / 255,\n a: ((processed >>> 24) & 0xff) / 255,\n }\n } else if (processed != null) {\n out[key] = processed\n }\n }\n }\n return out ?? props\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|