Fix android crashes and add modal exit button

This commit is contained in:
Lei Nelissen
2022-06-09 23:37:07 +02:00
parent 01bd17e8cb
commit f39ab85624
6 changed files with 48 additions and 10 deletions

View File

@@ -0,0 +1,28 @@
import React, { useCallback } from 'react';
import { useNavigation } from '@react-navigation/native';
import XmarkIcon from 'assets/icons/xmark.svg';
import { TouchableOpacity } from 'react-native';
import styled from 'styled-components/native';
const Container = styled.View`
padding: 6px 12px;
`;
function BackButton() {
const navigation = useNavigation();
const handlePress = useCallback(() => {
console.log(navigation.canGoBack());
navigation.goBack();
}, [navigation]);
return (
<Container>
<TouchableOpacity onPress={handlePress}>
<XmarkIcon />
</TouchableOpacity>
</Container>
);
}
export default BackButton;

View File

@@ -6,10 +6,13 @@ import Queue from './components/Queue';
import ConnectionNotice from './components/ConnectionNotice';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import StreamStatus from './components/StreamStatus';
import { Platform } from 'react-native';
import BackButton from './components/Backbutton';
export default function Player() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
{Platform.OS === 'android' && (<BackButton />)}
<Queue header={(
<>
<NowPlaying />