Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Video] Much simpler fix to fullscreen bug (#5251)

* much simpler fix

* allow old behaviour on firefox

* rm logs

authored by

Samuel Newman and committed by
GitHub
6bc5a05f db9cf92d

+7 -12
+7 -12
src/view/com/util/post-embeds/VideoEmbed.web.tsx
··· 4 4 import {msg} from '@lingui/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 7 + import {isFirefox} from '#/lib/browser' 7 8 import {clamp} from '#/lib/numbers' 8 9 import {useGate} from '#/lib/statsig/statsig' 9 10 import { ··· 23 24 const {active, setActive, sendPosition, currentActiveView} = 24 25 useActiveVideoWeb() 25 26 const [onScreen, setOnScreen] = useState(false) 27 + const [isFullscreen] = useFullscreen() 26 28 27 29 useEffect(() => { 28 30 if (!ref.current) return 31 + if (isFullscreen && !isFirefox) return 29 32 const observer = new IntersectionObserver( 30 33 entries => { 31 34 const entry = entries[0] ··· 39 42 ) 40 43 observer.observe(ref.current) 41 44 return () => observer.disconnect() 42 - }, [sendPosition]) 45 + }, [sendPosition, isFullscreen]) 43 46 44 47 const [key, setKey] = useState(0) 45 48 const renderError = useCallback( ··· 108 111 const ref = useRef<HTMLDivElement>(null) 109 112 const [nearScreen, setNearScreen] = useState(false) 110 113 const [isFullscreen] = useFullscreen() 111 - const [nearScreenOrFullscreen, setNearScreenOrFullscreen] = useState(false) 112 114 113 115 // Send position when scrolling. This is done with an IntersectionObserver 114 116 // observing a div of 100vh height 115 117 useEffect(() => { 116 118 if (!ref.current) return 119 + if (isFullscreen && !isFirefox) return 117 120 const observer = new IntersectionObserver( 118 121 entries => { 119 122 const entry = entries[0] ··· 127 130 ) 128 131 observer.observe(ref.current) 129 132 return () => observer.disconnect() 130 - }, [sendPosition]) 133 + }, [sendPosition, isFullscreen]) 131 134 132 135 // In case scrolling hasn't started yet, send up the position 133 136 useEffect(() => { ··· 138 141 } 139 142 }, [isAnyViewActive, sendPosition]) 140 143 141 - // disguesting effect - it should be `nearScreen` except when fullscreen 142 - // when it should be whatever it was before fullscreen changed 143 - useEffect(() => { 144 - if (!isFullscreen) { 145 - setNearScreenOrFullscreen(nearScreen) 146 - } 147 - }, [isFullscreen, nearScreen]) 148 - 149 144 return ( 150 145 <View style={[a.flex_1, a.flex_row]}> 151 - {nearScreenOrFullscreen && children} 146 + {nearScreen && children} 152 147 <div 153 148 ref={ref} 154 149 style={{