Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import {forwardRef, memo, useContext} from 'react'import {StyleSheet, View, type ViewProps} from 'react-native'import Animated from 'react-native-reanimated'
import {useIsWithinSplitView} from '#/screens/Messages/components/splitView/context'import {useBreakpoints, useTheme} from '#/alf'import {shouldCenterNativeTabletContent} from '#/alf/breakpoints.shared'import {useDialogContext} from '#/components/Dialog/context'import {CENTER_COLUMN_WIDTH} from '#/components/Layout/const'import {ScrollbarOffsetContext} from '#/components/Layout/context'
const CENTERED_VIEW_OFFSET_CONTEXT = {isWithinOffsetView: true}
// If you explode these into functions, don't forget to forwardRef!
/** * Avoid using `FlatList_INTERNAL` and use `List` where possible. * The types are a bit wrong on `FlatList_INTERNAL` */export const FlatList_INTERNAL = memo(Animated.FlatList)export type FlatList_INTERNAL = React.ComponentRef<typeof Animated.FlatList>
/** * @deprecated use `Layout` components */export const ScrollView = Animated.ScrollViewexport type ScrollView = React.ComponentRef<typeof Animated.ScrollView>
/** * @deprecated use `Layout` components */export const CenteredView = forwardRef< React.ComponentRef<typeof View>, React.PropsWithChildren< ViewProps & {sideBorders?: boolean; topBorder?: boolean} >>(function CenteredView(props, ref) { const {style, sideBorders, topBorder, ...rest} = props const t = useTheme() const {gtMobile} = useBreakpoints() const {isWithinDialog} = useDialogContext() const {isWithinSplitView} = useIsWithinSplitView() const {isWithinOffsetView} = useContext(ScrollbarOffsetContext) const centerOnTablet = shouldCenterNativeTabletContent({ gtMobile, isWithinDialog, isWithinSplitView, isWithinOffsetView, }) return ( <ScrollbarOffsetContext.Provider value={CENTERED_VIEW_OFFSET_CONTEXT}> <View ref={ref} style={[ style, centerOnTablet && { width: '100%', maxWidth: CENTER_COLUMN_WIDTH, alignSelf: 'center', }, centerOnTablet && sideBorders && [ { borderLeftWidth: StyleSheet.hairlineWidth, borderRightWidth: StyleSheet.hairlineWidth, }, t.atoms.border_contrast_low, ], centerOnTablet && topBorder && [ {borderTopWidth: StyleSheet.hairlineWidth}, t.atoms.border_contrast_low, ], ]} {...rest} /> </ScrollbarOffsetContext.Provider> )})