示例#1
0
 unmountComponentFromNode: function(
   instance: ReactComponent,
   containerID: string
 ) {
   // Call back into native to remove all of the subviews from this container
   ReactReconciler.unmountComponent(instance);
   var containerTag =
     ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID);
   RCTUIManager.removeSubviewsFromContainerWithID(containerTag);
 },
示例#2
0
 function(mountImage, containerID) {
   // Since we now know that the `mountImage` has been mounted, we can
   // mark it as such.
   ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle(
     mountImage.rootNodeID,
     mountImage.tag
   );
   var addChildTags = [mountImage.tag];
   var addAtIndices = [0];
   RCTUIManager.manageChildren(
     ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID),
     null,         // moveFromIndices
     null,         // moveToIndices
     addChildTags,
     addAtIndices,
     null          // removeAtIndices
   );
 }
var dangerouslyProcessChildrenUpdates = function(childrenUpdates, markupList) {
  if (!childrenUpdates.length) {
    return;
  }
  var byContainerTag = {};
  // Group by parent ID - send them across the bridge in separate commands per
  // containerID.
  for (var i = 0; i < childrenUpdates.length; i++) {
    var update = childrenUpdates[i];
    var containerTag = ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(update.parentID);
    var updates = byContainerTag[containerTag] || (byContainerTag[containerTag] = {});
    if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING) {
      (updates.moveFromIndices || (updates.moveFromIndices = [])).push(update.fromIndex);
      (updates.moveToIndices || (updates.moveToIndices = [])).push(update.toIndex);
    } else if (update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
      (updates.removeAtIndices || (updates.removeAtIndices = [])).push(update.fromIndex);
    } else if (update.type === ReactMultiChildUpdateTypes.INSERT_MARKUP) {
      var mountImage = markupList[update.markupIndex];
      var tag = mountImage.tag;
      var rootNodeID = mountImage.rootNodeID;
      ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle(rootNodeID, tag);
      (updates.addAtIndices || (updates.addAtIndices = [])).push(update.toIndex);
      (updates.addChildTags || (updates.addChildTags = [])).push(tag);
    }
  }
  // Note this enumeration order will be different on V8!  Move `byContainerTag`
  // to a sparse array as soon as we confirm there are not horrible perf
  // penalties.
  for (var updateParentTagString in byContainerTag) {
    var updateParentTagNumber = +updateParentTagString;
    var childUpdatesToSend = byContainerTag[updateParentTagNumber];
    RKUIManager.manageChildren(
      updateParentTagNumber,
      childUpdatesToSend.moveFromIndices,
      childUpdatesToSend.moveToIndices,
      childUpdatesToSend.addChildTags,
      childUpdatesToSend.addAtIndices,
      childUpdatesToSend.removeAtIndices
    );
  }
};
 function(id, mountImage) {
   var oldTag = ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(id);
   RKUIManager.replaceExistingNonRootView(oldTag, mountImage.tag);
   ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle(id, mountImage.tag);
 }