Fix isIntersecting in Chrome (#3525)
This commit is contained in:
		
							parent
							
								
									e7479e996a
								
							
						
					
					
						commit
						294bc9a78d
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -88,9 +88,11 @@ class Status extends ImmutablePureComponent {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  handleIntersection = (entry) => {
 | 
			
		||||
    // Edge 15 doesn't support isIntersecting, but we can infer it from intersectionRatio
 | 
			
		||||
    // Edge 15 doesn't support isIntersecting, but we can infer it
 | 
			
		||||
    // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12156111/
 | 
			
		||||
    const isIntersecting = entry.intersectionRatio > 0;
 | 
			
		||||
    // https://github.com/WICG/IntersectionObserver/issues/211
 | 
			
		||||
    const isIntersecting = (typeof entry.isIntersecting === 'boolean') ?
 | 
			
		||||
      entry.isIntersecting : entry.intersectionRect.height > 0;
 | 
			
		||||
    this.setState((prevState) => {
 | 
			
		||||
      if (prevState.isIntersecting && !isIntersecting) {
 | 
			
		||||
        scheduleIdleTask(this.hideIfNotIntersecting);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue