import React from 'react'; import { Animated, Dimensions, Image, PixelRatio, Pressable, StyleSheet, Text, View, } from 'react-native'; import type { GroupType } from '../../types'; import { CloseIcon } from '../../icons'; import StoryContext from '../../core/StoryContext'; import AnimatedIndicator from './AnimatedIndicator'; interface Props { group: GroupType; currentStory: number; onClose(): void; onNext(): void; } const StoryControls: React.FC = (props) => { const { group, currentStory, onClose, onNext } = props; const storyContext = React.useContext(StoryContext); const hide = { opacity: storyContext.foregroundWidget ? 0 : 1, }; return ( {group.title} {group.stories.map((_story, index) => ( {index === currentStory && ( )} ))} ); }; const size = (value: number) => Dimensions.get('window').width / (1080 / PixelRatio.get()) < 1 ? value * (1080 / Dimensions.get('window').width) : value; const styles = StyleSheet.create({ container: {}, closeBtn: { position: 'absolute', display: 'flex', alignItems: 'center', justifyContent: 'center', left: 1080 / PixelRatio.get() - size(40), top: size(18), height: size(32), width: size(32), }, group: { position: 'absolute', left: size(12), top: size(18), display: 'flex', flexDirection: 'row', alignItems: 'center', }, groupTitle: { color: '#fff', fontWeight: 'bold', fontSize: size(14), marginRight: size(8), textShadowColor: 'rgba(24, 24, 24, 0.46)', textShadowOffset: { width: 0, height: 0 }, textShadowRadius: size(10), }, groupImg: { width: size(32), height: size(32), borderRadius: size(50), marginRight: size(12), }, indicatorContainer: { position: 'absolute', display: 'flex', flexDirection: 'row', top: size(8), width: 1080 / PixelRatio.get() - size(24), marginLeft: size(12), marginRight: size(10), height: size(4), }, indicator: { position: 'relative', flex: 1, borderRadius: size(4), height: size(2), marginRight: size(2), }, }); export default StoryControls;