2020-06-16 17:51:51 +02:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import TrackPlayer from 'react-native-track-player';
|
|
|
|
|
import { NavigationContainer } from '@react-navigation/native';
|
|
|
|
|
import Routes from '../screens';
|
|
|
|
|
|
|
|
|
|
interface State {
|
|
|
|
|
isReady: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default class App extends Component<State> {
|
|
|
|
|
state = {
|
|
|
|
|
isReady: false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
async componentDidMount() {
|
|
|
|
|
await TrackPlayer.setupPlayer();
|
2020-06-16 21:41:02 +02:00
|
|
|
await TrackPlayer.updateOptions({
|
|
|
|
|
capabilities: [
|
|
|
|
|
TrackPlayer.CAPABILITY_PLAY,
|
|
|
|
|
TrackPlayer.CAPABILITY_PAUSE,
|
|
|
|
|
TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
|
|
|
|
|
TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
|
|
|
|
|
TrackPlayer.CAPABILITY_STOP,
|
|
|
|
|
]
|
|
|
|
|
});
|
2020-06-16 17:51:51 +02:00
|
|
|
this.setState({ isReady: true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { isReady } = this.state;
|
|
|
|
|
|
|
|
|
|
if (!isReady) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<NavigationContainer>
|
|
|
|
|
<Routes />
|
|
|
|
|
</NavigationContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|