Skip to content

Commit

Permalink
Add missing null-check to findHostInstanceFastPath (#6884)
Browse files Browse the repository at this point in the history
## Summary

This PR adds a missing null check for certain components that do not
contain the `_componentRef` field. This can happen for example when you
uses `useAnimatedRef` with FlashList.

## Test plan

Use FlashList as a animated component
  • Loading branch information
piaskowyk authored Jan 10, 2025
1 parent 3667594 commit 6c55c86
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ type HostInstancePaper = {

export type HostInstance = HostInstanceFabric & HostInstancePaper;

function findHostInstanceFastPath(maybeNativeRef: HostInstance) {
function findHostInstanceFastPath(maybeNativeRef: HostInstance | undefined) {
if (!maybeNativeRef) {
return undefined;
}
if (
maybeNativeRef.__internalInstanceHandle &&
maybeNativeRef.__nativeTag &&
Expand Down

0 comments on commit 6c55c86

Please sign in to comment.