Skip to content

Commit

Permalink
Updated ReactNativeFiber HostConfig methods to mirror PR facebook#8563
Browse files Browse the repository at this point in the history
Also removed the no-longer-necessary viewConfig from the NativeHostComponent. This config can be retrieved when necessary from commitUpdate() thanks to the newly-added type param
  • Loading branch information
Brian Vaughn committed Dec 14, 2016
1 parent 27a74ca commit abacd2f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/renderers/native/ReactNativeFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ const NativeRenderer = ReactFiberReconciler({

commitUpdate(
instance : Instance,
type : string,
oldProps : Props,
newProps : Props,
rootContainerInstance : Object,
internalInstanceHandle : Object
) : void {
precacheFiberNode(internalInstanceHandle, instance._nativeTag);
const viewConfig = ReactNativeViewConfigRegistry.get(type);

const viewConfig = (instance : any).viewConfig;
precacheFiberNode(internalInstanceHandle, instance._nativeTag);

const updatePayload = ReactNativeAttributePayload.diff(
oldProps,
Expand Down Expand Up @@ -157,7 +158,6 @@ const NativeRenderer = ReactFiberReconciler({
);

const component = new NativeHostComponent(tag);
component.viewConfig = viewConfig;

precacheFiberNode(internalInstanceHandle, tag);

Expand Down Expand Up @@ -185,6 +185,7 @@ const NativeRenderer = ReactFiberReconciler({

finalizeInitialChildren(
parentInstance : Instance,
type : string,
props : Props,
rootContainerInstance : Container,
) : void {
Expand Down Expand Up @@ -251,13 +252,17 @@ const NativeRenderer = ReactFiberReconciler({

prepareUpdate(
instance : Instance,
type : string,
oldProps : Props,
newProps : Props
) : boolean {
return true;
},

removeChild(parentInstance : Instance | Container, child : Instance | TextInstance) : void {
removeChild(
parentInstance : Instance | Container,
child : Instance | TextInstance
) : void {
recursivelyUncacheFiberNode(child);

if (typeof parentInstance === 'number') {
Expand All @@ -270,7 +275,7 @@ const NativeRenderer = ReactFiberReconciler({
[0], // removeAtIndices
);
} else {
const children = parentInstance._children
const children = parentInstance._children;
const index = children.indexOf(child);

children.splice(index, 1);
Expand Down

0 comments on commit abacd2f

Please sign in to comment.