xref: /MusicFree/src/pages/musicDetail/components/content/lyric/draggingTime.tsx (revision 8d82ecd9ebd88f4516b7a450e82025018c9ae12d)
1*8d82ecd9S猫头猫import React from 'react';
2*8d82ecd9S猫头猫import {StyleSheet, Text} from 'react-native';
3*8d82ecd9S猫头猫import rpx from '@/utils/rpx';
4*8d82ecd9S猫头猫import timeformat from '@/utils/timeformat';
5*8d82ecd9S猫头猫import {fontSizeConst} from '@/constants/uiConst';
6*8d82ecd9S猫头猫import TrackPlayer from '@/core/trackPlayer';
7*8d82ecd9S猫头猫
8*8d82ecd9S猫头猫export default function DraggingTime(props: {time: number}) {
9*8d82ecd9S猫头猫    const progress = TrackPlayer.useProgress();
10*8d82ecd9S猫头猫
11*8d82ecd9S猫头猫    return (
12*8d82ecd9S猫头猫        <Text style={style.draggingTimeText}>
13*8d82ecd9S猫头猫            {timeformat(Math.min(props.time, progress.duration ?? 0))}
14*8d82ecd9S猫头猫        </Text>
15*8d82ecd9S猫头猫    );
16*8d82ecd9S猫头猫}
17*8d82ecd9S猫头猫
18*8d82ecd9S猫头猫const style = StyleSheet.create({
19*8d82ecd9S猫头猫    draggingTimeText: {
20*8d82ecd9S猫头猫        color: '#dddddd',
21*8d82ecd9S猫头猫        fontSize: fontSizeConst.description,
22*8d82ecd9S猫头猫        width: rpx(90),
23*8d82ecd9S猫头猫    },
24*8d82ecd9S猫头猫});
25