Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b96b61d

Browse files
authored
Use the canonical nativeTag for Fabric's setNativeProps (facebook#14900)
* Use the canonical nativeTag for Fabric's setNativeProps * Fix prettier
1 parent dab2fdb commit b96b61d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/react-native-renderer/src/ReactNativeComponent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ export default function(
153153
return;
154154
}
155155

156+
const nativeTag =
157+
maybeInstance._nativeTag || maybeInstance.canonical._nativeTag;
156158
const viewConfig: ReactNativeBaseComponentViewConfig<> =
157159
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
158160

@@ -163,7 +165,7 @@ export default function(
163165
// view invalidation for certain components (eg RCTTextInput) on iOS.
164166
if (updatePayload != null) {
165167
UIManager.updateView(
166-
maybeInstance._nativeTag,
168+
nativeTag,
167169
viewConfig.uiViewClassName,
168170
updatePayload,
169171
);

packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ describe('ReactFabric', () => {
189189

190190
viewRef.setNativeProps({foo: 'baz'});
191191
expect(UIManager.updateView).toHaveBeenCalledTimes(1);
192+
expect(UIManager.updateView).toHaveBeenCalledWith(
193+
expect.any(Number),
194+
'RCTView',
195+
{foo: 'baz'},
196+
);
192197
});
193198
});
194199

packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ describe('ReactNative', () => {
120120

121121
viewRef.setNativeProps({foo: 'baz'});
122122
expect(UIManager.updateView).toHaveBeenCalledTimes(1);
123+
expect(UIManager.updateView).toHaveBeenCalledWith(
124+
expect.any(Number),
125+
'RCTView',
126+
{foo: 'baz'},
127+
);
123128
});
124129
});
125130

0 commit comments

Comments
 (0)