diff --git a/src/features/lightbox/chrome/Footer.tsx b/src/features/lightbox/chrome/Footer.tsx new file mode 100644 index 0000000000..63fbada3a3 --- /dev/null +++ b/src/features/lightbox/chrome/Footer.tsx @@ -0,0 +1,94 @@ +import {useRef} from 'react' +import { + LayoutAnimation, + Pressable, + ScrollView, + StyleSheet, + View, +} from 'react-native' +import {useSafeAreaInsets} from 'react-native-safe-area-context' +import {msg} from '@lingui/core/macro' +import {useLingui} from '@lingui/react' + +import {atoms as a} from '#/alf' +import {Text} from '#/components/Typography' +import {PagerDots} from './PagerDots' + +type Props = { + altText: string | undefined + isAltExpanded: boolean + onToggleAltExpanded: () => void + imageCount: number + activeIndex: number +} + +export function Footer({ + altText, + isAltExpanded, + onToggleAltExpanded, + imageCount, + activeIndex, +}: Props) { + const {_} = useLingui() + const insets = useSafeAreaInsets() + const isMomentumScrolling = useRef(false) + + return ( + + {altText ? ( + + { + isMomentumScrolling.current = true + }} + onMomentumScrollEnd={() => { + isMomentumScrolling.current = false + }} + contentContainerStyle={[a.px_md, a.py_sm]}> + { + if (isMomentumScrolling.current) return + LayoutAnimation.configureNext({ + duration: 450, + update: {type: 'spring', springDamping: 1}, + }) + onToggleAltExpanded() + }}> + + {altText} + + + + + ) : null} + + + ) +} + +const styles = StyleSheet.create({ + root: { + position: 'absolute', + bottom: 0, + left: 0, + right: 0, + }, + altWrap: { + backgroundColor: 'rgba(0, 0, 0, 0.45)', + borderRadius: 12, + overflow: 'hidden', + }, + altText: { + color: '#fff', + }, +})