File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
- import { ViewportSensor } from '../ViewportSensor' ;
3
2
import { ViewportScrollSensor } from '../ViewportScrollSensor' ;
4
3
5
4
const h = React . createElement ;
Original file line number Diff line number Diff line change @@ -55,9 +55,12 @@ export class ViewportObserverSensor extends Component<IViewportObserverSensorPro
55
55
const entry = entries [ 0 ] ;
56
56
const { intersectionRatio} = entry ;
57
57
const { threshold, onChange} = this . props ;
58
-
58
+ const noThresholdAndTinyBitIsVisible = ! ! ( ! threshold && intersectionRatio ) ;
59
+ const visibleMoreOrEqualToThreshold = threshold
60
+ ? intersectionRatio >= threshold
61
+ : intersectionRatio > threshold ;
59
62
const state = {
60
- visible : ! ! ( ( ! threshold && intersectionRatio ) || ( intersectionRatio >= threshold ) )
63
+ visible : noThresholdAndTinyBitIsVisible || visibleMoreOrEqualToThreshold ,
61
64
} ;
62
65
63
66
this . setState ( state ) ;
You can’t perform that action at this time.
0 commit comments