react 15.1.0 → 15.2.0-rc.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/react-with-addons.js +2034 -1313
- package/dist/react-with-addons.min.js +7 -6
- package/dist/react.js +1832 -1244
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +3 -2
- package/lib/DOMChildrenOperations.js +9 -9
- package/lib/DOMLazyTree.js +3 -2
- package/lib/DOMProperty.js +6 -4
- package/lib/DOMPropertyOperations.js +17 -3
- package/lib/Danger.js +10 -8
- package/lib/DisabledInputUtils.js +5 -5
- package/lib/EventPluginHub.js +8 -2
- package/lib/EventPluginRegistry.js +13 -7
- package/lib/EventPluginUtils.js +3 -1
- package/lib/HTMLDOMPropertyConfig.js +1 -2
- package/lib/LinkedValueUtils.js +5 -3
- package/lib/NativeMethodsMixin.js +6 -4
- package/lib/PooledClass.js +3 -1
- package/lib/React.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +15 -8
- package/lib/ReactChildReconciler.js +15 -6
- package/lib/ReactClass.js +14 -13
- package/lib/ReactComponent.js +3 -6
- package/lib/ReactComponentEnvironment.js +3 -1
- package/lib/ReactComponentTreeDevtool.js +94 -16
- package/lib/ReactComponentTreeTestUtils.js +87 -0
- package/lib/ReactCompositeComponent.js +66 -106
- package/lib/ReactDOM.js +2 -2
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +130 -76
- package/lib/ReactDOMComponentTree.js +23 -21
- package/lib/ReactDOMDebugTool.js +7 -1
- package/lib/ReactDOMEmptyComponent.js +9 -9
- package/lib/ReactDOMFactories.js +1 -1
- package/lib/ReactDOMInput.js +52 -16
- package/lib/ReactDOMOption.js +40 -26
- package/lib/ReactDOMSelect.js +3 -3
- package/lib/ReactDOMTextComponent.js +21 -20
- package/lib/ReactDOMTextarea.js +59 -32
- package/lib/ReactDOMTreeTraversal.js +18 -16
- package/lib/ReactDOMUnknownPropertyDevtool.js +41 -15
- package/lib/ReactDebugTool.js +88 -27
- package/lib/ReactDefaultInjection.js +2 -2
- package/lib/ReactElement.js +64 -25
- package/lib/ReactElementValidator.js +26 -81
- package/lib/ReactEventListener.js +2 -2
- package/lib/ReactFragment.js +3 -1
- package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
- package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +5 -5
- package/lib/ReactInjection.js +2 -2
- package/lib/ReactInstanceHandles.js +8 -6
- package/lib/ReactMount.js +24 -16
- package/lib/ReactMultiChild.js +31 -9
- package/lib/ReactNativeAttributePayload.js +5 -2
- package/lib/ReactNativeBaseComponent.js +7 -7
- package/lib/ReactNativeBridgeEventPlugin.js +1 -1
- package/lib/ReactNativeComponentTree.js +8 -6
- package/lib/ReactNativeDOMIDOperations.js +1 -2
- package/lib/ReactNativeDefaultInjection.js +9 -7
- package/lib/ReactNativeGlobalResponderHandler.js +1 -1
- package/lib/ReactNativeMount.js +1 -1
- package/lib/ReactNativeTagHandles.js +3 -1
- package/lib/ReactNativeTextComponent.js +10 -9
- package/lib/ReactNativeTreeTraversal.js +11 -11
- package/lib/ReactNodeTypes.js +5 -3
- package/lib/ReactNoop.js +76 -0
- package/lib/ReactOwner.js +4 -2
- package/lib/ReactPerf.js +83 -7
- package/lib/ReactPropTypes.js +23 -0
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactReconciler.js +12 -7
- package/lib/ReactServerRendering.js +4 -2
- package/lib/ReactSimpleEmptyComponent.js +4 -4
- package/lib/ReactTestMount.js +126 -0
- package/lib/ReactTestReconcileTransaction.js +100 -0
- package/lib/ReactTestRenderer.js +133 -0
- package/lib/ReactTestUtils.js +17 -10
- package/lib/ReactTransitionChildMapping.js +7 -1
- package/lib/ReactTransitionGroup.js +40 -6
- package/lib/ReactUpdateQueue.js +9 -1
- package/lib/ReactUpdates.js +9 -8
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +8 -6
- package/lib/ResponderTouchHistoryStore.js +6 -4
- package/lib/SimpleEventPlugin.js +3 -1
- package/lib/SyntheticEvent.js +2 -3
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/Transaction.js +4 -2
- package/lib/accumulate.js +3 -1
- package/lib/accumulateInto.js +3 -1
- package/lib/checkReactTypeSpec.js +71 -0
- package/lib/createReactNativeComponentClass.js +2 -2
- package/lib/dangerousStyleValue.js +3 -1
- package/lib/escapeTextContentForBrowser.js +96 -12
- package/lib/findDOMNode.js +6 -4
- package/lib/findNodeHandle.js +5 -3
- package/lib/flattenChildren.js +13 -4
- package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
- package/lib/instantiateReactComponent.js +13 -12
- package/lib/onlyChild.js +3 -1
- package/lib/reactComponentExpect.js +3 -3
- package/lib/reactProdInvariant.js +38 -0
- package/lib/setInnerHTML.js +17 -1
- package/lib/setTextContent.js +8 -0
- package/lib/traverseAllChildren.js +3 -1
- package/lib/update.js +12 -11
- package/package.json +2 -2
- package/lib/MetaMatchers.js +0 -118
|
@@ -31,8 +31,8 @@ function findParent(inst) {
|
|
|
31
31
|
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
|
|
32
32
|
// traversal, but caching is difficult to do correctly without using a
|
|
33
33
|
// mutation observer to listen for all DOM changes.
|
|
34
|
-
while (inst.
|
|
35
|
-
inst = inst.
|
|
34
|
+
while (inst._hostParent) {
|
|
35
|
+
inst = inst._hostParent;
|
|
36
36
|
}
|
|
37
37
|
var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
38
38
|
var container = rootNode.parentNode;
|
package/lib/ReactFragment.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactChildren = require('./ReactChildren');
|
|
15
17
|
var ReactElement = require('./ReactElement');
|
|
16
18
|
|
|
@@ -46,7 +48,7 @@ var ReactFragment = {
|
|
|
46
48
|
return object;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
!(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM
|
|
51
|
+
!(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.') : _prodInvariant('0') : void 0;
|
|
50
52
|
|
|
51
53
|
var result = [];
|
|
52
54
|
|
|
@@ -6,22 +6,22 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule
|
|
9
|
+
* @providesModule ReactHostComponent
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant'),
|
|
15
|
+
_assign = require('object-assign');
|
|
15
16
|
|
|
16
17
|
var invariant = require('fbjs/lib/invariant');
|
|
17
18
|
|
|
18
|
-
var autoGenerateWrapperClass = null;
|
|
19
19
|
var genericComponentClass = null;
|
|
20
|
-
// This registry keeps track of wrapper classes around
|
|
20
|
+
// This registry keeps track of wrapper classes around host tags.
|
|
21
21
|
var tagToComponentClass = {};
|
|
22
22
|
var textComponentClass = null;
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var ReactHostComponentInjection = {
|
|
25
25
|
// This accepts a class that receives the tag string. This is a catch all
|
|
26
26
|
// that can render any kind of tag.
|
|
27
27
|
injectGenericComponentClass: function (componentClass) {
|
|
@@ -40,31 +40,13 @@ var ReactNativeComponentInjection = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Get a
|
|
44
|
-
*
|
|
45
|
-
* @param {ReactElement} element The tag for which to get the class.
|
|
46
|
-
* @return {function} The React class constructor function.
|
|
47
|
-
*/
|
|
48
|
-
function getComponentClassForElement(element) {
|
|
49
|
-
if (typeof element.type === 'function') {
|
|
50
|
-
return element.type;
|
|
51
|
-
}
|
|
52
|
-
var tag = element.type;
|
|
53
|
-
var componentClass = tagToComponentClass[tag];
|
|
54
|
-
if (componentClass == null) {
|
|
55
|
-
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
|
|
56
|
-
}
|
|
57
|
-
return componentClass;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Get a native internal component class for a specific tag.
|
|
43
|
+
* Get a host internal component class for a specific tag.
|
|
62
44
|
*
|
|
63
45
|
* @param {ReactElement} element The element to create.
|
|
64
46
|
* @return {function} The internal class constructor function.
|
|
65
47
|
*/
|
|
66
48
|
function createInternalComponent(element) {
|
|
67
|
-
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) :
|
|
49
|
+
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
|
|
68
50
|
return new genericComponentClass(element);
|
|
69
51
|
}
|
|
70
52
|
|
|
@@ -84,12 +66,11 @@ function isTextComponent(component) {
|
|
|
84
66
|
return component instanceof textComponentClass;
|
|
85
67
|
}
|
|
86
68
|
|
|
87
|
-
var
|
|
88
|
-
getComponentClassForElement: getComponentClassForElement,
|
|
69
|
+
var ReactHostComponent = {
|
|
89
70
|
createInternalComponent: createInternalComponent,
|
|
90
71
|
createInstanceForText: createInstanceForText,
|
|
91
72
|
isTextComponent: isTextComponent,
|
|
92
|
-
injection:
|
|
73
|
+
injection: ReactHostComponentInjection
|
|
93
74
|
};
|
|
94
75
|
|
|
95
|
-
module.exports =
|
|
76
|
+
module.exports = ReactHostComponent;
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule
|
|
9
|
+
* @providesModule ReactHostOperationHistoryDevtool
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var history = [];
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
16
|
+
var ReactHostOperationHistoryDevtool = {
|
|
17
|
+
onHostOperation: function (debugID, type, payload) {
|
|
18
18
|
history.push({
|
|
19
19
|
instanceID: debugID,
|
|
20
20
|
type: type,
|
|
@@ -22,7 +22,7 @@ var ReactNativeOperationHistoryDevtool = {
|
|
|
22
22
|
});
|
|
23
23
|
},
|
|
24
24
|
clearHistory: function () {
|
|
25
|
-
if (
|
|
25
|
+
if (ReactHostOperationHistoryDevtool._preventClearing) {
|
|
26
26
|
// Should only be used for tests.
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
@@ -34,4 +34,4 @@ var ReactNativeOperationHistoryDevtool = {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
module.exports =
|
|
37
|
+
module.exports = ReactHostOperationHistoryDevtool;
|
package/lib/ReactInjection.js
CHANGED
|
@@ -18,7 +18,7 @@ var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
|
18
18
|
var ReactClass = require('./ReactClass');
|
|
19
19
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
20
20
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
21
|
-
var
|
|
21
|
+
var ReactHostComponent = require('./ReactHostComponent');
|
|
22
22
|
var ReactUpdates = require('./ReactUpdates');
|
|
23
23
|
|
|
24
24
|
var ReactInjection = {
|
|
@@ -29,7 +29,7 @@ var ReactInjection = {
|
|
|
29
29
|
EventPluginHub: EventPluginHub.injection,
|
|
30
30
|
EventPluginUtils: EventPluginUtils.injection,
|
|
31
31
|
EventEmitter: ReactBrowserEventEmitter.injection,
|
|
32
|
-
|
|
32
|
+
HostComponent: ReactHostComponent.injection,
|
|
33
33
|
Updates: ReactUpdates.injection
|
|
34
34
|
};
|
|
35
35
|
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var invariant = require('fbjs/lib/invariant');
|
|
15
17
|
|
|
16
18
|
var SEPARATOR = '.';
|
|
@@ -88,8 +90,8 @@ function getParentID(id) {
|
|
|
88
90
|
* @private
|
|
89
91
|
*/
|
|
90
92
|
function getNextDescendantID(ancestorID, destinationID) {
|
|
91
|
-
!(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) :
|
|
92
|
-
!isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about
|
|
93
|
+
!(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : _prodInvariant('112', ancestorID, destinationID) : void 0;
|
|
94
|
+
!isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : _prodInvariant('113', ancestorID, destinationID) : void 0;
|
|
93
95
|
if (ancestorID === destinationID) {
|
|
94
96
|
return ancestorID;
|
|
95
97
|
}
|
|
@@ -131,7 +133,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
|
|
134
|
-
!isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) :
|
|
136
|
+
!isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : _prodInvariant('114', oneID, twoID, longestCommonID) : void 0;
|
|
135
137
|
return longestCommonID;
|
|
136
138
|
}
|
|
137
139
|
|
|
@@ -151,9 +153,9 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
151
153
|
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
152
154
|
start = start || '';
|
|
153
155
|
stop = stop || '';
|
|
154
|
-
!(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) :
|
|
156
|
+
!(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : _prodInvariant('115', start) : void 0;
|
|
155
157
|
var traverseUp = isAncestorIDOf(stop, start);
|
|
156
|
-
!(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do
|
|
158
|
+
!(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do not have a parent path.', start, stop) : _prodInvariant('116', start, stop) : void 0;
|
|
157
159
|
// Traverse from `start` to `stop` one depth at a time.
|
|
158
160
|
var depth = 0;
|
|
159
161
|
var traverse = traverseUp ? getParentID : getNextDescendantID;
|
|
@@ -166,7 +168,7 @@ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
|
166
168
|
// Only break //after// visiting `stop`.
|
|
167
169
|
break;
|
|
168
170
|
}
|
|
169
|
-
!(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while
|
|
171
|
+
!(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : _prodInvariant('117', start, stop, id) : void 0;
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
|
package/lib/ReactMount.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var DOMLazyTree = require('./DOMLazyTree');
|
|
15
17
|
var DOMProperty = require('./DOMProperty');
|
|
16
18
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
@@ -134,7 +136,13 @@ function batchedMountComponentIntoNode(componentInstance, container, shouldReuse
|
|
|
134
136
|
* @see {ReactMount.unmountComponentAtNode}
|
|
135
137
|
*/
|
|
136
138
|
function unmountComponentFromNode(instance, container, safely) {
|
|
139
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
140
|
+
ReactInstrumentation.debugTool.onBeginFlush();
|
|
141
|
+
}
|
|
137
142
|
ReactReconciler.unmountComponent(instance, safely);
|
|
143
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
144
|
+
ReactInstrumentation.debugTool.onEndFlush();
|
|
145
|
+
}
|
|
138
146
|
|
|
139
147
|
if (container.nodeType === DOC_NODE_TYPE) {
|
|
140
148
|
container = container.documentElement;
|
|
@@ -160,19 +168,19 @@ function hasNonRootReactChild(container) {
|
|
|
160
168
|
var rootEl = getReactRootElementInContainer(container);
|
|
161
169
|
if (rootEl) {
|
|
162
170
|
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
|
|
163
|
-
return !!(inst && inst.
|
|
171
|
+
return !!(inst && inst._hostParent);
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
174
|
|
|
167
|
-
function
|
|
175
|
+
function getHostRootInstanceInContainer(container) {
|
|
168
176
|
var rootEl = getReactRootElementInContainer(container);
|
|
169
|
-
var
|
|
170
|
-
return
|
|
177
|
+
var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
|
|
178
|
+
return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
|
|
171
179
|
}
|
|
172
180
|
|
|
173
181
|
function getTopLevelWrapperInContainer(container) {
|
|
174
|
-
var root =
|
|
175
|
-
return root ? root.
|
|
182
|
+
var root = getHostRootInstanceInContainer(container);
|
|
183
|
+
return root ? root._hostContainerInfo._topLevelWrapper : null;
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
/**
|
|
@@ -268,7 +276,7 @@ var ReactMount = {
|
|
|
268
276
|
// verify that that's the case.
|
|
269
277
|
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
|
|
270
278
|
|
|
271
|
-
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') :
|
|
279
|
+
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;
|
|
272
280
|
|
|
273
281
|
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
|
|
274
282
|
var componentInstance = instantiateReactComponent(nextElement);
|
|
@@ -311,7 +319,7 @@ var ReactMount = {
|
|
|
311
319
|
* @return {ReactComponent} Component instance rendered in `container`.
|
|
312
320
|
*/
|
|
313
321
|
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
|
314
|
-
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') :
|
|
322
|
+
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;
|
|
315
323
|
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
|
|
316
324
|
},
|
|
317
325
|
|
|
@@ -319,7 +327,7 @@ var ReactMount = {
|
|
|
319
327
|
ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');
|
|
320
328
|
!ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' :
|
|
321
329
|
// Check if it quacks like an element
|
|
322
|
-
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') :
|
|
330
|
+
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;
|
|
323
331
|
|
|
324
332
|
process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
|
|
325
333
|
|
|
@@ -401,7 +409,7 @@ var ReactMount = {
|
|
|
401
409
|
// render but we still don't expect to be in a render call here.)
|
|
402
410
|
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;
|
|
403
411
|
|
|
404
|
-
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') :
|
|
412
|
+
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;
|
|
405
413
|
|
|
406
414
|
var prevComponent = getTopLevelWrapperInContainer(container);
|
|
407
415
|
if (!prevComponent) {
|
|
@@ -424,7 +432,7 @@ var ReactMount = {
|
|
|
424
432
|
},
|
|
425
433
|
|
|
426
434
|
_mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) {
|
|
427
|
-
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') :
|
|
435
|
+
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;
|
|
428
436
|
|
|
429
437
|
if (shouldReuseMarkup) {
|
|
430
438
|
var rootElement = getReactRootElementInContainer(container);
|
|
@@ -461,7 +469,7 @@ var ReactMount = {
|
|
|
461
469
|
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
|
|
462
470
|
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
|
|
463
471
|
|
|
464
|
-
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using
|
|
472
|
+
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0;
|
|
465
473
|
|
|
466
474
|
if (process.env.NODE_ENV !== 'production') {
|
|
467
475
|
process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;
|
|
@@ -469,7 +477,7 @@ var ReactMount = {
|
|
|
469
477
|
}
|
|
470
478
|
}
|
|
471
479
|
|
|
472
|
-
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but
|
|
480
|
+
!(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0;
|
|
473
481
|
|
|
474
482
|
if (transaction.useCreateElement) {
|
|
475
483
|
while (container.lastChild) {
|
|
@@ -482,9 +490,9 @@ var ReactMount = {
|
|
|
482
490
|
}
|
|
483
491
|
|
|
484
492
|
if (process.env.NODE_ENV !== 'production') {
|
|
485
|
-
var
|
|
486
|
-
if (
|
|
487
|
-
ReactInstrumentation.debugTool.
|
|
493
|
+
var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
|
|
494
|
+
if (hostNode._debugID !== 0) {
|
|
495
|
+
ReactInstrumentation.debugTool.onHostOperation(hostNode._debugID, 'mount', markup.toString());
|
|
488
496
|
}
|
|
489
497
|
}
|
|
490
498
|
}
|
package/lib/ReactMultiChild.js
CHANGED
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
17
|
+
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
15
18
|
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
16
19
|
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
|
|
17
20
|
|
|
@@ -55,7 +58,7 @@ function makeMove(child, afterNode, toIndex) {
|
|
|
55
58
|
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
|
|
56
59
|
content: null,
|
|
57
60
|
fromIndex: child._mountIndex,
|
|
58
|
-
fromNode: ReactReconciler.
|
|
61
|
+
fromNode: ReactReconciler.getHostNode(child),
|
|
59
62
|
toIndex: toIndex,
|
|
60
63
|
afterNode: afterNode
|
|
61
64
|
};
|
|
@@ -136,10 +139,26 @@ function processQueue(inst, updateQueue) {
|
|
|
136
139
|
ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
|
|
137
140
|
}
|
|
138
141
|
|
|
142
|
+
var setParentForInstrumentation = emptyFunction;
|
|
139
143
|
var setChildrenForInstrumentation = emptyFunction;
|
|
140
144
|
if (process.env.NODE_ENV !== 'production') {
|
|
145
|
+
var getDebugID = function (inst) {
|
|
146
|
+
if (!inst._debugID) {
|
|
147
|
+
// Check for ART-like instances. TODO: This is silly/gross.
|
|
148
|
+
var internal;
|
|
149
|
+
if (internal = ReactInstanceMap.get(inst)) {
|
|
150
|
+
inst = internal;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return inst._debugID;
|
|
154
|
+
};
|
|
155
|
+
setParentForInstrumentation = function (child) {
|
|
156
|
+
if (child._debugID !== 0) {
|
|
157
|
+
ReactInstrumentation.debugTool.onSetParent(child._debugID, getDebugID(this));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
141
160
|
setChildrenForInstrumentation = function (children) {
|
|
142
|
-
ReactInstrumentation.debugTool.onSetChildren(this
|
|
161
|
+
ReactInstrumentation.debugTool.onSetChildren(getDebugID(this), children ? Object.keys(children).map(function (key) {
|
|
143
162
|
return children[key]._debugID;
|
|
144
163
|
}) : []);
|
|
145
164
|
};
|
|
@@ -167,7 +186,7 @@ var ReactMultiChild = {
|
|
|
167
186
|
if (this._currentElement) {
|
|
168
187
|
try {
|
|
169
188
|
ReactCurrentOwner.current = this._currentElement._owner;
|
|
170
|
-
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
|
189
|
+
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, this._debugID);
|
|
171
190
|
} finally {
|
|
172
191
|
ReactCurrentOwner.current = null;
|
|
173
192
|
}
|
|
@@ -182,7 +201,7 @@ var ReactMultiChild = {
|
|
|
182
201
|
if (this._currentElement) {
|
|
183
202
|
try {
|
|
184
203
|
ReactCurrentOwner.current = this._currentElement._owner;
|
|
185
|
-
nextChildren = flattenChildren(nextNestedChildrenElements);
|
|
204
|
+
nextChildren = flattenChildren(nextNestedChildrenElements, this._debugID);
|
|
186
205
|
} finally {
|
|
187
206
|
ReactCurrentOwner.current = null;
|
|
188
207
|
}
|
|
@@ -212,7 +231,10 @@ var ReactMultiChild = {
|
|
|
212
231
|
for (var name in children) {
|
|
213
232
|
if (children.hasOwnProperty(name)) {
|
|
214
233
|
var child = children[name];
|
|
215
|
-
|
|
234
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
235
|
+
setParentForInstrumentation.call(this, child);
|
|
236
|
+
}
|
|
237
|
+
var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context);
|
|
216
238
|
child._mountIndex = index++;
|
|
217
239
|
mountImages.push(mountImage);
|
|
218
240
|
}
|
|
@@ -237,7 +259,7 @@ var ReactMultiChild = {
|
|
|
237
259
|
ReactChildReconciler.unmountChildren(prevChildren, false);
|
|
238
260
|
for (var name in prevChildren) {
|
|
239
261
|
if (prevChildren.hasOwnProperty(name)) {
|
|
240
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') :
|
|
262
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
|
|
241
263
|
}
|
|
242
264
|
}
|
|
243
265
|
// Set new text content.
|
|
@@ -257,7 +279,7 @@ var ReactMultiChild = {
|
|
|
257
279
|
ReactChildReconciler.unmountChildren(prevChildren, false);
|
|
258
280
|
for (var name in prevChildren) {
|
|
259
281
|
if (prevChildren.hasOwnProperty(name)) {
|
|
260
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') :
|
|
282
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
|
|
261
283
|
}
|
|
262
284
|
}
|
|
263
285
|
var updates = [makeSetMarkup(nextMarkup)];
|
|
@@ -316,7 +338,7 @@ var ReactMultiChild = {
|
|
|
316
338
|
updates = enqueue(updates, this._mountChildAtIndex(nextChild, lastPlacedNode, nextIndex, transaction, context));
|
|
317
339
|
}
|
|
318
340
|
nextIndex++;
|
|
319
|
-
lastPlacedNode = ReactReconciler.
|
|
341
|
+
lastPlacedNode = ReactReconciler.getHostNode(nextChild);
|
|
320
342
|
}
|
|
321
343
|
// Remove children that are no longer present.
|
|
322
344
|
for (name in removedNodes) {
|
|
@@ -397,7 +419,7 @@ var ReactMultiChild = {
|
|
|
397
419
|
* @private
|
|
398
420
|
*/
|
|
399
421
|
_mountChildAtIndex: function (child, afterNode, index, transaction, context) {
|
|
400
|
-
var mountImage = ReactReconciler.mountComponent(child, transaction, this, this.
|
|
422
|
+
var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context);
|
|
401
423
|
child._mountIndex = index;
|
|
402
424
|
return this.createChild(child, afterNode, mountImage);
|
|
403
425
|
},
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
var ReactNativePropRegistry = require('./ReactNativePropRegistry');
|
|
15
15
|
|
|
16
|
-
var deepDiffer = require('deepDiffer');
|
|
17
|
-
var flattenStyle = require('flattenStyle');
|
|
16
|
+
var deepDiffer = require('react-native/lib/deepDiffer');
|
|
17
|
+
var flattenStyle = require('react-native/lib/flattenStyle');
|
|
18
18
|
|
|
19
19
|
var emptyObject = {};
|
|
20
20
|
|
|
@@ -282,6 +282,9 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
282
282
|
// default: fallthrough case when nested properties are defined
|
|
283
283
|
removedKeys = null;
|
|
284
284
|
removedKeyCount = 0;
|
|
285
|
+
// We think that attributeConfig is not CustomAttributeConfiguration at
|
|
286
|
+
// this point so we assume it must be AttributeConfiguration.
|
|
287
|
+
// $FlowFixMe
|
|
285
288
|
updatePayload = diffNestedProperty(updatePayload, prevProp, nextProp, attributeConfig);
|
|
286
289
|
if (removedKeyCount > 0 && updatePayload) {
|
|
287
290
|
restoreDeletedValuesInNestedArray(updatePayload, nextProp, attributeConfig);
|