Skip to content

Commit

Permalink
Use the canonical nativeTag for Fabric's setNativeProps (#14900)
Browse files Browse the repository at this point in the history
* Use the canonical nativeTag for Fabric's setNativeProps

* Fix prettier
  • Loading branch information
elicwhite authored Feb 20, 2019
1 parent dab2fdb commit b96b61d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-native-renderer/src/ReactNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ export default function(
return;
}

const nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
const viewConfig: ReactNativeBaseComponentViewConfig<> =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;

Expand All @@ -163,7 +165,7 @@ export default function(
// view invalidation for certain components (eg RCTTextInput) on iOS.
if (updatePayload != null) {
UIManager.updateView(
maybeInstance._nativeTag,
nativeTag,
viewConfig.uiViewClassName,
updatePayload,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ describe('ReactFabric', () => {

viewRef.setNativeProps({foo: 'baz'});
expect(UIManager.updateView).toHaveBeenCalledTimes(1);
expect(UIManager.updateView).toHaveBeenCalledWith(
expect.any(Number),
'RCTView',
{foo: 'baz'},
);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ describe('ReactNative', () => {

viewRef.setNativeProps({foo: 'baz'});
expect(UIManager.updateView).toHaveBeenCalledTimes(1);
expect(UIManager.updateView).toHaveBeenCalledWith(
expect.any(Number),
'RCTView',
{foo: 'baz'},
);
});
});

Expand Down

0 comments on commit b96b61d

Please sign in to comment.