Skip to content

Commit 41bdb14

Browse files
committed
Make getPublicInstance type safe
1 parent 2b89f90 commit 41bdb14

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/renderers/shared/fiber/ReactFiberCommitWork.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,14 @@ module.exports = function<T, P, I, TI, PI, C, CX>(
463463
}
464464
const ref = finishedWork.ref;
465465
if (ref) {
466-
const instance = getPublicInstance(finishedWork.stateNode);
467-
ref(instance);
466+
const instance = finishedWork.stateNode;
467+
switch (finishedWork.tag) {
468+
case HostComponent:
469+
ref(getPublicInstance(instance));
470+
break;
471+
default:
472+
ref(instance);
473+
}
468474
}
469475
}
470476

0 commit comments

Comments
 (0)