@@ -234,25 +234,6 @@ export function isChildPublicInstance(
234234 childInstance : FabricPublicInstance | PaperPublicInstance ,
235235) : boolean {
236236 if ( __DEV__ ) {
237- // Paper
238- if (
239- parentInstance instanceof ReactNativeFiberHostComponent ||
240- childInstance instanceof ReactNativeFiberHostComponent
241- ) {
242- if (
243- parentInstance instanceof ReactNativeFiberHostComponent &&
244- childInstance instanceof ReactNativeFiberHostComponent
245- ) {
246- return doesFiberContain (
247- parentInstance . _internalFiberInstanceHandleDEV ,
248- childInstance . _internalFiberInstanceHandleDEV ,
249- ) ;
250- }
251-
252- // Means that one instance is from Fabric and other is from Paper.
253- return false ;
254- }
255-
256237 const parentInternalInstanceHandle =
257238 // $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric.
258239 getInternalInstanceHandleFromPublicInstance ( parentInstance ) ;
@@ -271,6 +252,24 @@ export function isChildPublicInstance(
271252 ) ;
272253 }
273254
255+ // Paper
256+ if (
257+ // $FlowExpectedError[incompatible-type]
258+ // $FlowExpectedError[prop-missing] Don't check via `instanceof ReactNativeFiberHostComponent`, so it won't be leaked to Fabric.
259+ parentInstance . _internalFiberInstanceHandleDEV &&
260+ // $FlowExpectedError[incompatible-type]
261+ // $FlowExpectedError[prop-missing] Don't check via `instanceof ReactNativeFiberHostComponent`, so it won't be leaked to Fabric.
262+ childInstance . _internalFiberInstanceHandleDEV
263+ ) {
264+ return doesFiberContain (
265+ // $FlowExpectedError[incompatible-call]
266+ parentInstance . _internalFiberInstanceHandleDEV ,
267+ // $FlowExpectedError[incompatible-call]
268+ childInstance . _internalFiberInstanceHandleDEV ,
269+ ) ;
270+ }
271+
272+ // Means that one instance is from Fabric and other is from Paper.
274273 return false ;
275274 } else {
276275 throw new Error ( 'isChildPublicInstance() is not available in production.' ) ;
0 commit comments