Skip to content

Commit

Permalink
chore: cancel measure on unmount #50
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaup committed Nov 10, 2024
1 parent 69a3108 commit e423b28
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/LazyChild/components/FullLazyChild.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback } from 'react';
import React, { useCallback, useEffect } from 'react';
import { Dimensions, type LayoutChangeEvent } from 'react-native';
import Animated, {
measure,
Expand Down Expand Up @@ -39,6 +39,16 @@ export function FullLazyChild({
horizontal,
} = useAnimatedContext();

const _isMounted = useSharedValue(false);

useEffect(() => {
_isMounted.value = true;

return () => {
_isMounted.value = false;
};
}, [_isMounted]);

/**
* If onLayout returns a height or width value greater than 0.
*/
Expand Down

0 comments on commit e423b28

Please sign in to comment.