|
| 1 | +import {Text, View} from 'react-native'; |
| 2 | +import React from 'react'; |
| 3 | +import {useHref} from 'expo-router'; |
| 4 | + |
| 5 | +const Player = () => { |
| 6 | + const {pathname, href} = useHref(); |
| 7 | + |
| 8 | + console.log('/home pathname', pathname, 'href', href); |
| 9 | + |
| 10 | + return ( |
| 11 | + <View> |
| 12 | + <Text>Player</Text> |
| 13 | + </View> |
| 14 | + ); |
| 15 | +}; |
| 16 | +export default Player; |
| 17 | + |
| 18 | +// import React, {FC, useEffect} from 'react'; |
| 19 | +// import {ActivityIndicator, Image, StyleSheet, Text, View} from 'react-native'; |
| 20 | +// import TrackPlayer from 'react-native-track-player'; |
| 21 | +// import {RootStackScreenProps, Routes} from '../routes.types'; |
| 22 | +// import {usePlayerControls} from '../player.utils'; |
| 23 | +// import {Controls} from '../components/Controls'; |
| 24 | +// |
| 25 | +// const Player: FC<RootStackScreenProps<Routes.PLAYER>> = ({ |
| 26 | +// route: { |
| 27 | +// params: {position = 0, index, queue}, |
| 28 | +// }, |
| 29 | +// }) => { |
| 30 | +// const {controls, currentTrack} = usePlayerControls(); |
| 31 | +// |
| 32 | +// useEffect(() => { |
| 33 | +// const handleQueue = async () => { |
| 34 | +// await TrackPlayer.add(queue); |
| 35 | +// if (index >= 0) { |
| 36 | +// await TrackPlayer.skip(index); |
| 37 | +// } |
| 38 | +// if (position && position > 0) { |
| 39 | +// await TrackPlayer.seekTo(position); |
| 40 | +// } |
| 41 | +// }; |
| 42 | +// |
| 43 | +// handleQueue(); |
| 44 | +// }, [index, queue, position]); |
| 45 | +// |
| 46 | +// if (!currentTrack) { |
| 47 | +// return <ActivityIndicator style={styles.centered_horizontal} />; |
| 48 | +// } |
| 49 | +// |
| 50 | +// return ( |
| 51 | +// <View style={styles.centered_horizontal}> |
| 52 | +// <Text> |
| 53 | +// {currentTrack.title} - {currentTrack.artist} |
| 54 | +// </Text> |
| 55 | +// {currentTrack.artwork && typeof currentTrack.artwork === 'string' && ( |
| 56 | +// <Image |
| 57 | +// resizeMode="cover" |
| 58 | +// style={styles.image_dimensions} |
| 59 | +// source={{uri: currentTrack.artwork}} |
| 60 | +// /> |
| 61 | +// )} |
| 62 | +// <Controls {...controls} /> |
| 63 | +// </View> |
| 64 | +// ); |
| 65 | +// }; |
| 66 | +// |
| 67 | +// const styles = StyleSheet.create({ |
| 68 | +// centered_horizontal: { |
| 69 | +// flex: 1, |
| 70 | +// alignItems: 'center', |
| 71 | +// justifyContent: 'center', |
| 72 | +// }, |
| 73 | +// image_dimensions: { |
| 74 | +// width: 400, |
| 75 | +// height: 500, |
| 76 | +// }, |
| 77 | +// }); |
| 78 | +// |
| 79 | +// export default Player; |
0 commit comments