Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import {StyleSheet} from 'react-native'
import {atoms as a, platform, useTheme, type ViewStyleProp} from '#/alf'import {Fill} from '#/components/Fill'import {IS_HIGH_DPI} from '#/env'
/** * Applies and thin border within a bounding box. Used to contrast media from * bg of the container. */export function MediaInsetBorder({ children, style, opaque,}: { children?: React.ReactNode /** * Used where this border needs to match adjacent borders, such as in * external link previews */ opaque?: boolean} & ViewStyleProp) { const t = useTheme() const isLight = t.name === 'light' return ( <Fill style={[ a.rounded_md, { borderWidth: platform({ native: StyleSheet.hairlineWidth, // while we generally use hairlineWidth (aka 1px), // we make an exception here for high DPI screens // as the 1px border is very noticeable -sfn web: IS_HIGH_DPI ? 0.5 : StyleSheet.hairlineWidth, }), }, opaque ? [t.atoms.border_contrast_low] : [ isLight ? t.atoms.border_contrast_low : t.atoms.border_contrast_high, {opacity: 0.6}, ], a.pointer_events_none, /* * On iOS, React Native only uses the system's border rendering when * the view clips its content. Otherwise it draws the border into an * image on the main thread, once per avatar or image, which is costly * while scrolling. This view rarely has content, so clipping is free. */ a.overflow_hidden, style, ]}> {children} </Fill> )}