Fix de arthur
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
/* eslint-disable no-mixed-spaces-and-tabs */
|
/* eslint-disable no-mixed-spaces-and-tabs */
|
||||||
|
import { StackActions } from '@react-navigation/native';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { SafeAreaView, Platform, Animated } from 'react-native';
|
import { SafeAreaView, Platform, Animated } from 'react-native';
|
||||||
import * as ScreenOrientation from 'expo-screen-orientation';
|
import * as ScreenOrientation from 'expo-screen-orientation';
|
||||||
@@ -117,7 +118,7 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
stopwatch.stop();
|
stopwatch.stop();
|
||||||
if (webSocket.current?.readyState != WebSocket.OPEN) {
|
if (webSocket.current?.readyState != WebSocket.OPEN) {
|
||||||
console.warn('onEnd: Websocket not open');
|
console.warn('onEnd: Websocket not open');
|
||||||
navigation.navigate('Home');
|
navigation.dispatch(StackActions.replace('Home'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
webSocket.current?.send(
|
webSocket.current?.send(
|
||||||
@@ -164,7 +165,10 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
if (data.type == 'end') {
|
if (data.type == 'end') {
|
||||||
endMsgReceived = true;
|
endMsgReceived = true;
|
||||||
webSocket.current?.close();
|
webSocket.current?.close();
|
||||||
navigation.navigate('Score', { songId: song.data!.id, ...data });
|
console.log('End message received stack action');
|
||||||
|
navigation.dispatch(
|
||||||
|
StackActions.replace('Score', { songId: song.data!.id, ...data })
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const points = data.info.score;
|
const points = data.info.score;
|
||||||
@@ -238,7 +242,7 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ScreenOrientation.unlockAsync().catch(() => {});
|
ScreenOrientation.unlockAsync().catch(() => {});
|
||||||
onEnd();
|
stopwatch.stop();
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user