diff --git a/package-lock.json b/package-lock.json index 1fa047132afbd03c21c6db817cfcd93f67234e50..96416024a3d1a6a3356928ccc517b5f35a69d5ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,11 +29,9 @@ "react-i18next": "^15.1.1", "react-native": "0.76.3", "react-native-dropdown-select-list": "^2.0.5", - "react-native-fs": "^2.20.0", "react-native-progress": "^5.0.1", "react-native-safe-area-context": "^4.12.0", "react-native-screens": "~4.1.0", - "react-native-sound": "^0.11.2", "react-native-sse": "^1.2.1", "react-native-vector-icons": "^10.2.0", "react-query": "^3.39.3", @@ -4665,11 +4663,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, - "node_modules/base-64": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", - "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" - }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -9765,25 +9758,6 @@ "integrity": "sha512-TepbcagQVUMB6nLuIlVU2ghRpQHAECOeZWe8K04ymW6NqbKbxuczZSDFfdCiABiiQ2dFD+8Dz65y4K7/uUEqGg==", "license": "MIT" }, - "node_modules/react-native-fs": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.20.0.tgz", - "integrity": "sha512-VkTBzs7fIDUiy/XajOSNk0XazFE9l+QlMAce7lGuebZcag5CnjszB+u4BdqzwaQOdcYb5wsJIsqq4kxInIRpJQ==", - "license": "MIT", - "dependencies": { - "base-64": "^0.1.0", - "utf8": "^3.0.0" - }, - "peerDependencies": { - "react-native": "*", - "react-native-windows": "*" - }, - "peerDependenciesMeta": { - "react-native-windows": { - "optional": true - } - } - }, "node_modules/react-native-progress": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/react-native-progress/-/react-native-progress-5.0.1.tgz", @@ -9820,15 +9794,6 @@ "react-native": "*" } }, - "node_modules/react-native-sound": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/react-native-sound/-/react-native-sound-0.11.2.tgz", - "integrity": "sha512-LmGc8lgOK3qecYMVQpyHvww/C+wgT6sWeMpVbOe4NCRGC2yKd4fo4U0KBUo9PO7AqKESO3I/2GZg1/C0+bwiiA==", - "license": "MIT", - "peerDependencies": { - "react-native": ">=0.8.0" - } - }, "node_modules/react-native-sse": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/react-native-sse/-/react-native-sse-1.2.1.tgz", @@ -11616,12 +11581,6 @@ "react": ">=16.8" } }, - "node_modules/utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==", - "license": "MIT" - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/routes/TabNavigation.tsx b/routes/TabNavigation.tsx index bc58c3e2f9538893ea40e2bf156b87ddf1545d1f..0afeb4dc1f8cd31d9befcd76e55734ef95311ba8 100644 --- a/routes/TabNavigation.tsx +++ b/routes/TabNavigation.tsx @@ -52,10 +52,10 @@ export default function TabNavigator() { name="Community" component={Community} /> - {/* <Tab.Screen + <Tab.Screen name="Multiplayer" component={Multiplayer} - /> */} + /> <Tab.Screen name="Profil" component={Profil} diff --git a/screens/Multiplayer/Lobby/PlayingQuizMultiMode/PlayingQuizMultiModeBody.tsx b/screens/Multiplayer/Lobby/PlayingQuizMultiMode/PlayingQuizMultiModeBody.tsx index a2709da4b89abde26ddf87417d32915c2b40ba9b..3526c0225fe3281ff9dd385ae2970a1e5280049a 100644 --- a/screens/Multiplayer/Lobby/PlayingQuizMultiMode/PlayingQuizMultiModeBody.tsx +++ b/screens/Multiplayer/Lobby/PlayingQuizMultiMode/PlayingQuizMultiModeBody.tsx @@ -6,13 +6,9 @@ import {useQuizService} from "../../../../services/QuizService"; import {Answer} from "../../../../models/Answer"; import HttpError from "../../../../services/HttpError"; import AnswerButton from "../../../../components/buttons/AnswerButton"; -import {ActivityIndicator, View, Text, StyleSheet} from "react-native"; +import {ActivityIndicator, View, Text, StyleSheet, ScrollView} from "react-native"; import BlueButton from "../../../../components/buttons/BlueButton"; import {ButtonsStyles} from "../../../../styles/ButtonsStyles"; -import {QuestionResponse} from "../../../../models/Response/QuestionResponse"; -import {RunInformations} from "../../../../models/RunInformations"; -import {Socket} from "socket.io-client"; -import {AnswerWsResponse} from "../../../../models/Response/AnswerWsResponse"; import EventSource from "react-native-sse"; import {CustomEventType} from "../../../../models/CustomEventType"; import {AnswerSSEResponse} from "../../../../models/Response/AnswerSSEResponse"; @@ -78,10 +74,7 @@ const getStyleOfAnswerButton = (answerId: number, selectedAnswerIndex: number | export default function PlayingQuizMultiModeBody({runId, actualQuestion, fetchActualQuestion, roomId, es,isHost, setScore, quizState,setQuizState, navigation }: Props) { const [selectedAnswerId, setSelectedAnswerId] = useState<number | null>(null); const [correctAnswerId, setCorrectAnswerId] = useState<number | null>(null); - const [isLastQuestion, setIsLastQuestion] = useState(false); - const [quizInformations, setQuizInformations] = useState<QuizInformations>(); - const [runInformations, setRunInformations] = useState<RunInformations>(); - const {getRunsInfo, getQuizInformations} = useQuizService(); + const [forceEnd, setForceEnd] = useState(false); const {revealAnswer, answerQuestion, nextQuestion, getScore} = useMultiService(); const getCorrectAnswer = (answers: Answer[]): Answer => { const correctAnswer = answers.find((answer) => answer.isCorrect); @@ -114,6 +107,7 @@ export default function PlayingQuizMultiModeBody({runId, actualQuestion, fetchAc if(selectedAnswerId === null || actualQuestion === undefined) return; setQuizState(QuizState.LOADING); + setForceEnd(!forceEnd); await answerQuestion(actualQuestion.id, selectedAnswerId); if(isHost) @@ -130,6 +124,7 @@ export default function PlayingQuizMultiModeBody({runId, actualQuestion, fetchAc }; const onContinue = () => { + setForceEnd(!forceEnd); if(isHost) { nextQuestion(); @@ -150,6 +145,10 @@ export default function PlayingQuizMultiModeBody({runId, actualQuestion, fetchAc <View style={styles.buttonContainer}> {actualQuestion ? ( <> + <ScrollView + style={styles.buttonListContainer} + contentContainerStyle={styles.buttonListContentContainer} + > {actualQuestion.answers.map((answer, index) => ( <AnswerButton key={index} @@ -157,11 +156,13 @@ export default function PlayingQuizMultiModeBody({runId, actualQuestion, fetchAc handleButtonPressed={() => onAnsweredButtonClicked(answer.id)} buttonStyle={getStyleOfAnswerButton(answer.id, selectedAnswerId, correctAnswerId, quizState)} buttonText={getStyleOfAnswerButtonText(answer.id, selectedAnswerId, correctAnswerId, quizState)} + forceEnd={forceEnd} /> ))} <View style={styles.playButtonContainer}> - <BlueButton onPress={() => quizState === QuizState.ANSWERING ? onValidation() : onContinue()} text={quizState === QuizState.ANSWERING ? "CONFIRM" : "CONTINUE"} buttonStyle={{borderRadius: 50}} isDisabled={false}/> + <BlueButton onPress={() => quizState === QuizState.ANSWERING ? onValidation() : onContinue()} text={quizState === QuizState.ANSWERING ? "CONFIRM" : "CONTINUE"} buttonStyle={{borderRadius: 50}} isDisabled={quizState !== QuizState.ANSWERING && !isHost}/> </View> + </ScrollView> </> ) : ( <View style={styles.loadingContainer}> @@ -242,5 +243,14 @@ const styles = StyleSheet.create({ shadowRadius: 3.5, elevation: 5, }, + buttonListContainer: { + maxHeight: '80%', + width: '100%', + }, + buttonListContentContainer: { + display: 'flex', + justifyContent: 'flex-start', + alignItems: 'center' + } });