1import React from 'react'; 2import {StyleSheet, Text} from 'react-native'; 3import rpx from '@/utils/rpx'; 4import timeformat from '@/utils/timeformat'; 5import {fontSizeConst} from '@/constants/uiConst'; 6import TrackPlayer from '@/core/trackPlayer'; 7 8export default function DraggingTime(props: {time: number}) { 9 const progress = TrackPlayer.useProgress(); 10 11 return ( 12 <Text style={style.draggingTimeText}> 13 {timeformat( 14 Math.max(Math.min(props.time, progress.duration ?? 0), 0), 15 )} 16 </Text> 17 ); 18} 19 20const style = StyleSheet.create({ 21 draggingTimeText: { 22 color: '#dddddd', 23 paddingHorizontal: rpx(8), 24 paddingVertical: rpx(6), 25 borderRadius: rpx(12), 26 backgroundColor: 'rgba(255,255,255,0.1)', 27 fontSize: fontSizeConst.description, 28 }, 29}); 30