import React from 'react'; import { StyleSheet, View, type ViewProps } from 'react-native'; import { DurationBadge as DefaultDurationBadge, type DurationBadgeProps, } from './DurationBadge'; import { LiveIndicator as DefaultLiveIndicator, type LiveIndicatorProps, } from './LiveIndicator'; import { FollowerCount as DefaultFollowerCount, type FollowerCountProps, } from './FollowerCount'; import { useTheme } from '../../../contexts'; import { Z_INDEX } from '../../../constants'; /** * Props for the ViewerLivestreamTopView component. */ export type ViewerLivestreamTopViewProps = { /** * Component to customize the Duration badge component on the viewer's live stream's top view. */ DurationBadge?: React.ComponentType | null; /** * Component to customize the Live indicator on the viewer's live stream's top view. */ LiveIndicator?: React.ComponentType | null; /** * Component to customize the Follower count indicator on the viewer's live stream's top view. */ FollowerCount?: React.ComponentType | null; onLayout?: ViewProps['onLayout']; }; /** * The ViewerLivestreamTopView component displays the top view component of the viewer's live stream. */ export const ViewerLivestreamTopView = ({ DurationBadge = DefaultDurationBadge, LiveIndicator = DefaultLiveIndicator, FollowerCount = DefaultFollowerCount, onLayout, }: ViewerLivestreamTopViewProps) => { const { theme: { colors, viewerLivestreamTopView }, } = useTheme(); return ( {LiveIndicator && } {FollowerCount && } {DurationBadge && } ); }; const styles = StyleSheet.create({ container: { position: 'absolute', top: 0, flexDirection: 'row', alignItems: 'center', paddingVertical: 16, paddingHorizontal: 8, borderBottomEndRadius: 8, borderBottomStartRadius: 8, zIndex: Z_INDEX.IN_FRONT, }, liveInfo: { flexDirection: 'row', }, leftElement: { flex: 1, alignItems: 'flex-start', }, centerElement: { flex: 1, alignItems: 'center', flexGrow: 3, }, rightElement: { flex: 1, alignItems: 'flex-end', }, });