Use the canonical nativeTag for Fabric's setNativeProps (#14900)

* Use the canonical nativeTag for Fabric's setNativeProps

* Fix prettier
This commit is contained in:
Eli White
2019-02-20 11:09:31 -08:00
committed by GitHub
parent dab2fdbbbd
commit b96b61dc4d
3 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -153,6 +153,8 @@ export default function(
return;
}
const nativeTag =
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
const viewConfig: ReactNativeBaseComponentViewConfig<> =
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
@@ -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,
);
@@ -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'},
);
});
});
@@ -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'},
);
});
});