@symbiote-native/react 3.0.0 → 3.0.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/build/host-config.js +19 -3
- package/package.json +5 -5
package/build/host-config.js
CHANGED
|
@@ -29,11 +29,24 @@ import { resolveIntrinsicTag } from '@symbiote-native/components/resolve-intrins
|
|
|
29
29
|
function isReservedProp(key) {
|
|
30
30
|
return key === 'children' || key === 'ref' || key === 'key';
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* `Object.keys`, not `Object.entries`, and it is measured rather than stylistic.
|
|
34
|
+
*
|
|
35
|
+
* `entries` allocates the outer array AND a two-element array per key, eagerly, before the loop
|
|
36
|
+
* starts; `keys` allocates one array of strings and the lookup is a property read the engine is
|
|
37
|
+
* about to do anyway. This runs ONCE PER NODE CREATED — ten thousand times on a thousand-row create.
|
|
38
|
+
* Priced on `-O` Hermes by `object-iteration-cost.itest.ts` over a four-key bag: 0.42 us against
|
|
39
|
+
* 0.23, so **0.19 us per node, ~1.9 ms of a 102 ms create**.
|
|
40
|
+
*
|
|
41
|
+
* `for…in` is cheaper still (0.14) and is NOT used: it walks the prototype chain, and an inherited
|
|
42
|
+
* key would be routed as a prop. A reconciler's props object has no prototype today, which is a fact
|
|
43
|
+
* about today rather than a contract.
|
|
44
|
+
*/
|
|
32
45
|
function applyProps(node, props) {
|
|
33
|
-
for (const
|
|
46
|
+
for (const key of Object.keys(props)) {
|
|
34
47
|
if (isReservedProp(key))
|
|
35
48
|
continue;
|
|
36
|
-
routeProp(node, key,
|
|
49
|
+
routeProp(node, key, props[key]);
|
|
37
50
|
}
|
|
38
51
|
}
|
|
39
52
|
function applyUpdate(node, oldProps, newProps) {
|
|
@@ -43,9 +56,12 @@ function applyUpdate(node, oldProps, newProps) {
|
|
|
43
56
|
if (!Object.hasOwn(newProps, key))
|
|
44
57
|
routeProp(node, key, undefined);
|
|
45
58
|
}
|
|
46
|
-
|
|
59
|
+
// Same `Object.keys` reason as `applyProps` above — this walk runs once per UPDATED node, which on
|
|
60
|
+
// a `partial` step is every row on the screen.
|
|
61
|
+
for (const key of Object.keys(newProps)) {
|
|
47
62
|
if (isReservedProp(key))
|
|
48
63
|
continue;
|
|
64
|
+
const value = newProps[key];
|
|
49
65
|
if (value !== oldProps[key])
|
|
50
66
|
routeProp(node, key, value);
|
|
51
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "SymbioteNative's React adapter — a react-reconciler host config (mutation mode) driving real native iOS/Android views through stock React Native Fabric.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -57,20 +57,20 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"react-reconciler": "^0.33.0",
|
|
60
|
-
"@symbiote-native/components": "3.0.
|
|
60
|
+
"@symbiote-native/components": "3.0.1",
|
|
61
61
|
"@symbiote-native/css-parser": "0.5.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"react": ">=19.0.0",
|
|
65
65
|
"react-native": ">=0.86",
|
|
66
|
-
"@symbiote-native/engine": "^1.
|
|
66
|
+
"@symbiote-native/engine": "^1.2.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/react": "^19.2.0",
|
|
70
70
|
"@types/react-reconciler": "^0.32.2",
|
|
71
71
|
"react": "19.2.3",
|
|
72
|
-
"@symbiote-native/engine": "1.
|
|
73
|
-
"@symbiote-native/test-utils": "0.
|
|
72
|
+
"@symbiote-native/engine": "1.2.0",
|
|
73
|
+
"@symbiote-native/test-utils": "0.4.1"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"typecheck": "tsc --build",
|