The library for web and native user interfaces.
Short-circuit `updatePropertyByID`
When `ReactNativeComponent` updates, it calls `updatePropertyByID` in `ReactDOMIDOperations` which calls `DOMPropertyOperations`. However, in `ReactDOMIDOperations`, we will lookup the node for an ID using `ReactID.getNode`. This wastes time looking for nodes when we may not need to ever update it (e.g. `children`). This changes `ReactNativeComponent` to bail out sooner.
Tim Yung committed
Jul 10, 2013 at 14:44 UTC
7b68fcd408f8e7da33d3bccbd3fe885802b3bc60
1 file changed
+4
-1
src/core/ReactNativeComponent.js
+4
-1
@@ -20,6 +20,7 @@
20
"use strict";
21
22
var CSSPropertyOperations = require('CSSPropertyOperations');
23
+var DOMProperty = require('DOMProperty');
24
var DOMPropertyOperations = require('DOMPropertyOperations');
25
var ReactComponent = require('ReactComponent');
26
var ReactEventEmitter = require('ReactEventEmitter');
@@ -277,7 +278,9 @@ ReactNativeComponent.Mixin = {
278
}
279
} else if (registrationNames[propKey]) {
280
putListener(this._rootNodeID, propKey, nextProp);
280
- } else {
281
+ } else if (
282
+ DOMProperty.isStandardName[propKey] ||
283
+ DOMProperty.isCustomAttribute(propKey)) {
284
ReactComponent.DOMIDOperations.updatePropertyByID(
285
this._rootNodeID,
286
propKey,