Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
describe('ReactDOMIDOperations', function() {
var ReactDOMComponentTree = require('ReactDOMComponentTree');
var ReactDOMIDOperations = require('ReactDOMIDOperations');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');

it('should update innerHTML and preserve whitespace', function() {
var stubNode = document.createElement('div');
Expand All @@ -25,7 +24,7 @@ describe('ReactDOMIDOperations', function() {
ReactDOMIDOperations.dangerouslyProcessChildrenUpdates(
stubInstance,
[{
type: ReactMultiChildUpdateTypes.SET_MARKUP,
type: 'SET_MARKUP',
content: html,
fromIndex: null,
toIndex: null,
Expand Down
11 changes: 5 additions & 6 deletions src/renderers/dom/client/utils/DOMChildrenOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

var DOMLazyTree = require('DOMLazyTree');
var Danger = require('Danger');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
var ReactDOMComponentTree = require('ReactDOMComponentTree');
var ReactInstrumentation = require('ReactInstrumentation');

Expand Down Expand Up @@ -179,7 +178,7 @@ var DOMChildrenOperations = {
for (var k = 0; k < updates.length; k++) {
var update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
case 'INSERT_MARKUP':
insertLazyTreeChildAt(
parentNode,
update.content,
Expand All @@ -193,7 +192,7 @@ var DOMChildrenOperations = {
);
}
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
case 'MOVE_EXISTING':
moveChild(
parentNode,
update.fromNode,
Expand All @@ -207,7 +206,7 @@ var DOMChildrenOperations = {
);
}
break;
case ReactMultiChildUpdateTypes.SET_MARKUP:
case 'SET_MARKUP':
setInnerHTML(
parentNode,
update.content
Expand All @@ -220,7 +219,7 @@ var DOMChildrenOperations = {
);
}
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
case 'TEXT_CONTENT':
setTextContent(
parentNode,
update.content
Expand All @@ -233,7 +232,7 @@ var DOMChildrenOperations = {
);
}
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
case 'REMOVE_NODE':
removeChild(parentNode, update.fromNode);
if (__DEV__) {
ReactInstrumentation.debugTool.onHostOperation(
Expand Down
7 changes: 3 additions & 4 deletions src/renderers/native/ReactNativeDOMIDOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'use strict';

var ReactNativeComponentTree = require('ReactNativeComponentTree');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
var UIManager = require('UIManager');

/**
Expand Down Expand Up @@ -41,12 +40,12 @@ var dangerouslyProcessChildrenUpdates = function(inst, childrenUpdates) {

for (var i = 0; i < childrenUpdates.length; i++) {
var update = childrenUpdates[i];
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING) {
if (update.type === 'MOVE_EXISTING') {
(moveFromIndices || (moveFromIndices = [])).push(update.fromIndex);
(moveToIndices || (moveToIndices = [])).push(update.toIndex);
} else if (update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
} else if (update.type === 'REMOVE_NODE') {
(removeAtIndices || (removeAtIndices = [])).push(update.fromIndex);
} else if (update.type === ReactMultiChildUpdateTypes.INSERT_MARKUP) {
} else if (update.type === 'INSERT_MARKUP') {
var mountImage = update.content;
var tag = mountImage;
(addAtIndices || (addAtIndices = [])).push(update.toIndex);
Expand Down
11 changes: 5 additions & 6 deletions src/renderers/shared/stack/reconciler/ReactMultiChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
var ReactComponentEnvironment = require('ReactComponentEnvironment');
var ReactInstanceMap = require('ReactInstanceMap');
var ReactInstrumentation = require('ReactInstrumentation');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');

var ReactCurrentOwner = require('ReactCurrentOwner');
var ReactReconciler = require('ReactReconciler');
Expand All @@ -34,7 +33,7 @@ var invariant = require('invariant');
function makeInsertMarkup(markup, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
type: 'INSERT_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
Expand All @@ -53,7 +52,7 @@ function makeInsertMarkup(markup, afterNode, toIndex) {
function makeMove(child, afterNode, toIndex) {
// NOTE: Null values reduce hidden classes.
return {
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
type: 'MOVE_EXISTING',
content: null,
fromIndex: child._mountIndex,
fromNode: ReactReconciler.getHostNode(child),
Expand All @@ -71,7 +70,7 @@ function makeMove(child, afterNode, toIndex) {
function makeRemove(child, node) {
// NOTE: Null values reduce hidden classes.
return {
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
type: 'REMOVE_NODE',
content: null,
fromIndex: child._mountIndex,
fromNode: node,
Expand All @@ -89,7 +88,7 @@ function makeRemove(child, node) {
function makeSetMarkup(markup) {
// NOTE: Null values reduce hidden classes.
return {
type: ReactMultiChildUpdateTypes.SET_MARKUP,
type: 'SET_MARKUP',
content: markup,
fromIndex: null,
fromNode: null,
Expand All @@ -107,7 +106,7 @@ function makeSetMarkup(markup) {
function makeTextContent(textContent) {
// NOTE: Null values reduce hidden classes.
return {
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
type: 'TEXT_CONTENT',
content: textContent,
fromIndex: null,
fromNode: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,15 @@

'use strict';

var keyMirror = require('keyMirror');

/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
SET_MARKUP: null,
TEXT_CONTENT: null,
});

module.exports = ReactMultiChildUpdateTypes;
export type ReactMultiChildUpdateTypes =
'INSERT_MARKUP' |
'MOVE_EXISTING' |
'REMOVE_NODE' |
'SET_MARKUP' |
'TEXT_CONTENT';