Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Close lightbox on web with escape key (#543)

* Close lightbox on web with escape key

* Lint

authored by

Ollie Hsieh and committed by
GitHub
996dba75 afd87a63

+15 -1
+15 -1
src/view/com/lightbox/Lightbox.web.tsx
··· 1 - import React from 'react' 1 + import React, {useCallback, useEffect} from 'react' 2 2 import { 3 3 Image, 4 4 TouchableOpacity, ··· 72 72 setIndex(index + 1) 73 73 } 74 74 } 75 + 76 + const onEscape = useCallback( 77 + (e: KeyboardEvent) => { 78 + if (e.key === 'Escape') { 79 + onClose() 80 + } 81 + }, 82 + [onClose], 83 + ) 84 + 85 + useEffect(() => { 86 + window.addEventListener('keydown', onEscape) 87 + return () => window.removeEventListener('keydown', onEscape) 88 + }, [onEscape]) 75 89 76 90 return ( 77 91 <View style={styles.mask}>