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
|
@@ -19,9 +19,9 @@ var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
|
19
19
|
var ReactNativeEventEmitter = require('./ReactNativeEventEmitter');
|
|
20
20
|
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
21
21
|
var ReactMultiChild = require('./ReactMultiChild');
|
|
22
|
-
var UIManager = require('UIManager');
|
|
22
|
+
var UIManager = require('react-native/lib/UIManager');
|
|
23
23
|
|
|
24
|
-
var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev');
|
|
24
|
+
var deepFreezeAndThrowOnMutationInDev = require('react-native/lib/deepFreezeAndThrowOnMutationInDev');
|
|
25
25
|
|
|
26
26
|
var registrationNames = ReactNativeEventEmitter.registrationNames;
|
|
27
27
|
var putListener = ReactNativeEventEmitter.putListener;
|
|
@@ -150,7 +150,7 @@ ReactNativeBaseComponent.Mixin = {
|
|
|
150
150
|
*
|
|
151
151
|
* @return {null} Null.
|
|
152
152
|
*/
|
|
153
|
-
|
|
153
|
+
getHostNode: function () {
|
|
154
154
|
return this._rootNodeID;
|
|
155
155
|
},
|
|
156
156
|
|
|
@@ -159,12 +159,12 @@ ReactNativeBaseComponent.Mixin = {
|
|
|
159
159
|
* @param {Transaction} transaction For creating/updating.
|
|
160
160
|
* @return {string} Unique iOS view tag.
|
|
161
161
|
*/
|
|
162
|
-
mountComponent: function (transaction,
|
|
162
|
+
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
|
|
163
163
|
var tag = ReactNativeTagHandles.allocateTag();
|
|
164
164
|
|
|
165
165
|
this._rootNodeID = tag;
|
|
166
|
-
this.
|
|
167
|
-
this.
|
|
166
|
+
this._hostParent = hostParent;
|
|
167
|
+
this._hostContainerInfo = hostContainerInfo;
|
|
168
168
|
|
|
169
169
|
if (process.env.NODE_ENV !== 'production') {
|
|
170
170
|
for (var key in this.viewConfig.validAttributes) {
|
|
@@ -176,7 +176,7 @@ ReactNativeBaseComponent.Mixin = {
|
|
|
176
176
|
|
|
177
177
|
var updatePayload = ReactNativeAttributePayload.create(this._currentElement.props, this.viewConfig.validAttributes);
|
|
178
178
|
|
|
179
|
-
var nativeTopRootTag =
|
|
179
|
+
var nativeTopRootTag = hostContainerInfo._tag;
|
|
180
180
|
UIManager.createView(tag, this.viewConfig.uiViewClassName, nativeTopRootTag, updatePayload);
|
|
181
181
|
|
|
182
182
|
ReactNativeComponentTree.precacheNode(this, tag);
|
|
@@ -17,7 +17,7 @@ var _extends = _assign || function (target) { for (var i = 1; i < arguments.leng
|
|
|
17
17
|
|
|
18
18
|
var EventPropagators = require('./EventPropagators');
|
|
19
19
|
var SyntheticEvent = require('./SyntheticEvent');
|
|
20
|
-
var UIManager = require('UIManager');
|
|
20
|
+
var UIManager = require('react-native/lib/UIManager');
|
|
21
21
|
|
|
22
22
|
var warning = require('fbjs/lib/warning');
|
|
23
23
|
|
|
@@ -11,18 +11,20 @@
|
|
|
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 instanceCache = {};
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
|
-
* Drill down (through composites and empty components) until we get a
|
|
20
|
-
*
|
|
21
|
+
* Drill down (through composites and empty components) until we get a host or
|
|
22
|
+
* host text component.
|
|
21
23
|
*
|
|
22
24
|
* This is pretty polymorphic but unavoidable with the current structure we have
|
|
23
25
|
* for `_renderedChildren`.
|
|
24
26
|
*/
|
|
25
|
-
function
|
|
27
|
+
function getRenderedHostOrTextFromComponent(component) {
|
|
26
28
|
var rendered;
|
|
27
29
|
while (rendered = component._renderedComponent) {
|
|
28
30
|
component = rendered;
|
|
@@ -31,11 +33,11 @@ function getRenderedNativeOrTextFromComponent(component) {
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
* Populate `
|
|
36
|
+
* Populate `_hostNode` on the rendered host/text component with the given
|
|
35
37
|
* DOM node. The passed `inst` can be a composite.
|
|
36
38
|
*/
|
|
37
39
|
function precacheNode(inst, tag) {
|
|
38
|
-
var nativeInst =
|
|
40
|
+
var nativeInst = getRenderedHostOrTextFromComponent(inst);
|
|
39
41
|
instanceCache[tag] = nativeInst;
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -51,7 +53,7 @@ function getInstanceFromTag(tag) {
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
function getTagFromInstance(inst) {
|
|
54
|
-
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'All native instances should have a tag.') :
|
|
56
|
+
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'All native instances should have a tag.') : _prodInvariant('17') : void 0;
|
|
55
57
|
return inst._rootNodeID;
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactNativeDOMIDOperations
|
|
10
|
-
*
|
|
11
10
|
*/
|
|
12
11
|
'use strict';
|
|
13
12
|
|
|
14
13
|
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
15
14
|
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
|
|
16
|
-
var UIManager = require('UIManager');
|
|
15
|
+
var UIManager = require('react-native/lib/UIManager');
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Updates a component's children by processing a series of updates.
|
|
@@ -18,17 +18,19 @@
|
|
|
18
18
|
* TODO: require this in packager, not in React #10932517
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
require('
|
|
21
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
22
|
+
|
|
23
|
+
require('react-native/lib/InitializeJavaScriptAppEngine');
|
|
22
24
|
|
|
23
25
|
var EventPluginHub = require('./EventPluginHub');
|
|
24
26
|
var EventPluginUtils = require('./EventPluginUtils');
|
|
25
|
-
var RCTEventEmitter = require('RCTEventEmitter');
|
|
27
|
+
var RCTEventEmitter = require('react-native/lib/RCTEventEmitter');
|
|
26
28
|
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
27
29
|
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
28
30
|
var ReactElement = require('./ReactElement');
|
|
29
31
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
30
32
|
var ReactNativeBridgeEventPlugin = require('./ReactNativeBridgeEventPlugin');
|
|
31
|
-
var
|
|
33
|
+
var ReactHostComponent = require('./ReactHostComponent');
|
|
32
34
|
var ReactNativeComponentEnvironment = require('./ReactNativeComponentEnvironment');
|
|
33
35
|
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
34
36
|
var ReactNativeEventEmitter = require('./ReactNativeEventEmitter');
|
|
@@ -74,7 +76,7 @@ function inject() {
|
|
|
74
76
|
|
|
75
77
|
var EmptyComponent = function (instantiate) {
|
|
76
78
|
// Can't import View at the top because it depends on React to make its composite
|
|
77
|
-
var View = require('View');
|
|
79
|
+
var View = require('react-native/lib/View');
|
|
78
80
|
return new ReactSimpleEmptyComponent(ReactElement.createElement(View, {
|
|
79
81
|
collapsable: true,
|
|
80
82
|
style: { position: 'absolute' }
|
|
@@ -83,14 +85,14 @@ function inject() {
|
|
|
83
85
|
|
|
84
86
|
ReactEmptyComponent.injection.injectEmptyComponentFactory(EmptyComponent);
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
ReactHostComponent.injection.injectTextComponentClass(ReactNativeTextComponent);
|
|
89
|
+
ReactHostComponent.injection.injectGenericComponentClass(function (tag) {
|
|
88
90
|
// Show a nicer error message for non-function tags
|
|
89
91
|
var info = '';
|
|
90
92
|
if (typeof tag === 'string' && /^[a-z]/.test(tag)) {
|
|
91
93
|
info += ' Each component name should start with an uppercase letter.';
|
|
92
94
|
}
|
|
93
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected a component class, got %s.%s', tag, info) :
|
|
95
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected a component class, got %s.%s', tag, info) : _prodInvariant('18', tag, info) : void 0;
|
|
94
96
|
});
|
|
95
97
|
}
|
|
96
98
|
|
package/lib/ReactNativeMount.js
CHANGED
|
@@ -18,7 +18,7 @@ var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
|
18
18
|
var ReactReconciler = require('./ReactReconciler');
|
|
19
19
|
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
20
20
|
var ReactUpdates = require('./ReactUpdates');
|
|
21
|
-
var UIManager = require('UIManager');
|
|
21
|
+
var UIManager = require('react-native/lib/UIManager');
|
|
22
22
|
|
|
23
23
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
24
24
|
var instantiateReactComponent = require('./instantiateReactComponent');
|
|
@@ -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
|
/**
|
|
@@ -42,7 +44,7 @@ var ReactNativeTagHandles = {
|
|
|
42
44
|
},
|
|
43
45
|
|
|
44
46
|
assertRootTag: function (tag) {
|
|
45
|
-
!this.reactTagIsNativeTopRootID(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expect a native root tag, instead got %s', tag) :
|
|
47
|
+
!this.reactTagIsNativeTopRootID(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expect a native root tag, instead got %s', tag) : _prodInvariant('19', tag) : void 0;
|
|
46
48
|
},
|
|
47
49
|
|
|
48
50
|
reactTagIsNativeTopRootID: function (reactTag) {
|
|
@@ -11,12 +11,13 @@
|
|
|
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 ReactInstrumentation = require('./ReactInstrumentation');
|
|
17
18
|
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
18
19
|
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
19
|
-
var UIManager = require('UIManager');
|
|
20
|
+
var UIManager = require('react-native/lib/UIManager');
|
|
20
21
|
|
|
21
22
|
var invariant = require('fbjs/lib/invariant');
|
|
22
23
|
|
|
@@ -24,23 +25,23 @@ var ReactNativeTextComponent = function (text) {
|
|
|
24
25
|
// This is really a ReactText (ReactNode), not a ReactElement
|
|
25
26
|
this._currentElement = text;
|
|
26
27
|
this._stringText = '' + text;
|
|
27
|
-
this.
|
|
28
|
+
this._hostParent = null;
|
|
28
29
|
this._rootNodeID = null;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
_assign(ReactNativeTextComponent.prototype, {
|
|
32
33
|
|
|
33
|
-
mountComponent: function (transaction,
|
|
34
|
+
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
|
|
34
35
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
36
|
ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
// TODO:
|
|
39
|
-
!context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) :
|
|
40
|
-
this.
|
|
39
|
+
// TODO: hostParent should have this context already. Stop abusing context.
|
|
40
|
+
!context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) : _prodInvariant('20', this._stringText) : void 0;
|
|
41
|
+
this._hostParent = hostParent;
|
|
41
42
|
var tag = ReactNativeTagHandles.allocateTag();
|
|
42
43
|
this._rootNodeID = tag;
|
|
43
|
-
var nativeTopRootTag =
|
|
44
|
+
var nativeTopRootTag = hostContainerInfo._tag;
|
|
44
45
|
UIManager.createView(tag, 'RCTRawText', nativeTopRootTag, { text: this._stringText });
|
|
45
46
|
|
|
46
47
|
ReactNativeComponentTree.precacheNode(this, tag);
|
|
@@ -48,7 +49,7 @@ _assign(ReactNativeTextComponent.prototype, {
|
|
|
48
49
|
return tag;
|
|
49
50
|
},
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
getHostNode: function () {
|
|
52
53
|
return this._rootNodeID;
|
|
53
54
|
},
|
|
54
55
|
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
|
|
21
21
|
function getLowestCommonAncestor(instA, instB) {
|
|
22
22
|
var depthA = 0;
|
|
23
|
-
for (var tempA = instA; tempA; tempA = tempA.
|
|
23
|
+
for (var tempA = instA; tempA; tempA = tempA._hostParent) {
|
|
24
24
|
depthA++;
|
|
25
25
|
}
|
|
26
26
|
var depthB = 0;
|
|
27
|
-
for (var tempB = instB; tempB; tempB = tempB.
|
|
27
|
+
for (var tempB = instB; tempB; tempB = tempB._hostParent) {
|
|
28
28
|
depthB++;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// If A is deeper, crawl up.
|
|
32
32
|
while (depthA - depthB > 0) {
|
|
33
|
-
instA = instA.
|
|
33
|
+
instA = instA._hostParent;
|
|
34
34
|
depthA--;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// If B is deeper, crawl up.
|
|
38
38
|
while (depthB - depthA > 0) {
|
|
39
|
-
instB = instB.
|
|
39
|
+
instB = instB._hostParent;
|
|
40
40
|
depthB--;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -46,8 +46,8 @@ function getLowestCommonAncestor(instA, instB) {
|
|
|
46
46
|
if (instA === instB) {
|
|
47
47
|
return instA;
|
|
48
48
|
}
|
|
49
|
-
instA = instA.
|
|
50
|
-
instB = instB.
|
|
49
|
+
instA = instA._hostParent;
|
|
50
|
+
instB = instB._hostParent;
|
|
51
51
|
}
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
@@ -60,7 +60,7 @@ function isAncestor(instA, instB) {
|
|
|
60
60
|
if (instB === instA) {
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
|
-
instB = instB.
|
|
63
|
+
instB = instB._hostParent;
|
|
64
64
|
}
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
@@ -69,7 +69,7 @@ function isAncestor(instA, instB) {
|
|
|
69
69
|
* Return the parent instance of the passed-in instance.
|
|
70
70
|
*/
|
|
71
71
|
function getParentInstance(inst) {
|
|
72
|
-
return inst.
|
|
72
|
+
return inst._hostParent;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -79,7 +79,7 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
79
79
|
var path = [];
|
|
80
80
|
while (inst) {
|
|
81
81
|
path.push(inst);
|
|
82
|
-
inst = inst.
|
|
82
|
+
inst = inst._hostParent;
|
|
83
83
|
}
|
|
84
84
|
var i;
|
|
85
85
|
for (i = path.length; i-- > 0;) {
|
|
@@ -102,12 +102,12 @@ function traverseEnterLeave(from, to, fn, argFrom, argTo) {
|
|
|
102
102
|
var pathFrom = [];
|
|
103
103
|
while (from && from !== common) {
|
|
104
104
|
pathFrom.push(from);
|
|
105
|
-
from = from.
|
|
105
|
+
from = from._hostParent;
|
|
106
106
|
}
|
|
107
107
|
var pathTo = [];
|
|
108
108
|
while (to && to !== common) {
|
|
109
109
|
pathTo.push(to);
|
|
110
|
-
to = to.
|
|
110
|
+
to = to._hostParent;
|
|
111
111
|
}
|
|
112
112
|
var i;
|
|
113
113
|
for (i = 0; i < pathFrom.length; i++) {
|
package/lib/ReactNodeTypes.js
CHANGED
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactElement = require('./ReactElement');
|
|
15
17
|
|
|
16
18
|
var invariant = require('fbjs/lib/invariant');
|
|
17
19
|
|
|
18
20
|
var ReactNodeTypes = {
|
|
19
|
-
|
|
21
|
+
HOST: 0,
|
|
20
22
|
COMPOSITE: 1,
|
|
21
23
|
EMPTY: 2,
|
|
22
24
|
|
|
@@ -27,10 +29,10 @@ var ReactNodeTypes = {
|
|
|
27
29
|
if (typeof node.type === 'function') {
|
|
28
30
|
return ReactNodeTypes.COMPOSITE;
|
|
29
31
|
} else {
|
|
30
|
-
return ReactNodeTypes.
|
|
32
|
+
return ReactNodeTypes.HOST;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) :
|
|
35
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
|
package/lib/ReactNoop.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactNoop
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This is a renderer of React that doesn't have a render target output.
|
|
15
|
+
* It is useful to demonstrate the internals of the reconciler in isolation
|
|
16
|
+
* and for testing semantics of reconciliation separate from the host
|
|
17
|
+
* environment.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
var ReactFiberReconciler = require('./ReactFiberReconciler');
|
|
23
|
+
|
|
24
|
+
var scheduledHighPriCallback = null;
|
|
25
|
+
var scheduledLowPriCallback = null;
|
|
26
|
+
|
|
27
|
+
var NoopRenderer = ReactFiberReconciler({
|
|
28
|
+
createHostInstance: function () {},
|
|
29
|
+
scheduleHighPriCallback: function (callback) {
|
|
30
|
+
scheduledHighPriCallback = callback;
|
|
31
|
+
},
|
|
32
|
+
scheduleLowPriCallback: function (callback) {
|
|
33
|
+
scheduledLowPriCallback = callback;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var ReactNoop = {
|
|
38
|
+
render: function (element) {
|
|
39
|
+
|
|
40
|
+
NoopRenderer.mountNewRoot(element);
|
|
41
|
+
},
|
|
42
|
+
flushHighPri: function () {
|
|
43
|
+
var cb = scheduledHighPriCallback;
|
|
44
|
+
if (cb === null) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
scheduledHighPriCallback = null;
|
|
48
|
+
cb();
|
|
49
|
+
},
|
|
50
|
+
flushLowPri: function () {
|
|
51
|
+
var timeout = arguments.length <= 0 || arguments[0] === undefined ? Infinity : arguments[0];
|
|
52
|
+
|
|
53
|
+
var cb = scheduledLowPriCallback;
|
|
54
|
+
if (cb === null) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
scheduledLowPriCallback = null;
|
|
58
|
+
var timeRemaining = timeout;
|
|
59
|
+
cb({
|
|
60
|
+
timeRemaining: function () {
|
|
61
|
+
// Simulate a fix amount of time progressing between each call.
|
|
62
|
+
timeRemaining -= 5;
|
|
63
|
+
if (timeRemaining < 0) {
|
|
64
|
+
timeRemaining = 0;
|
|
65
|
+
}
|
|
66
|
+
return timeRemaining;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
flush: function () {
|
|
71
|
+
ReactNoop.flushHighPri();
|
|
72
|
+
ReactNoop.flushLowPri();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
module.exports = ReactNoop;
|