Bluesky app fork with some witchin' additions 馃挮
at post-text-option 49 lines 944 B view raw
1import {View} from 'react-native' 2 3import {isTouchDevice} from '#/lib/browser' 4import {isNative, isWeb} from '#/platform/detection' 5import {atoms as a, useTheme, type ViewStyleProp} from '#/alf' 6 7export function SubtleHover({ 8 style, 9 hover, 10 web = true, 11 native = false, 12}: ViewStyleProp & {hover: boolean; web?: boolean; native?: boolean}) { 13 const t = useTheme() 14 15 let opacity: number 16 switch (t.name) { 17 case 'dark': 18 opacity = 0.4 19 break 20 case 'dim': 21 opacity = 0.45 22 break 23 case 'light': 24 opacity = 0.5 25 break 26 } 27 28 const el = ( 29 <View 30 style={[ 31 a.absolute, 32 a.inset_0, 33 a.pointer_events_none, 34 a.transition_opacity, 35 t.atoms.bg_contrast_50, 36 style, 37 {opacity: hover ? opacity : 0}, 38 ]} 39 /> 40 ) 41 42 if (isWeb && web) { 43 return isTouchDevice ? null : el 44 } else if (isNative && native) { 45 return el 46 } 47 48 return null 49}