Skip to content

Commit 13bb87c

Browse files
committed
check if it is active
1 parent 7c4ddda commit 13bb87c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/VisibilitySensor.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const VisibilitySensor = forwardRef<VisibilitySensorRef, VisibilitySensorProps>(
114114
}, [disabled, startWatching, stopWatching]);
115115

116116
useEffect(() => {
117+
if (!active) return;
118+
117119
const window: ScaledSize = Dimensions.get('window');
118120
const isVisible: boolean =
119121
rectDimensions.rectTop + (threshold.top || 0) <= window.height && // Top edge is within the bottom of the window

0 commit comments

Comments
 (0)