Commit 08cb2c66 authored by norhalimah's avatar norhalimah

update

parent 9ab3892d
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
import React from 'react';
import {Button, View, Alert} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
......@@ -22,124 +22,16 @@ import Quiz12 from './quiz12';
import Quiz13 from './quiz13';
import Quiz14 from './quiz14';
function Screen1({navigation}) {
return (
<View style={styles.container}>
<Quiz1 />
</View>
);
}
function Screen2({navigation}) {
return (
<View style={styles.container}>
<Quiz2 />
</View>
);
}
function Screen3({navigation}) {
return (
<View style={styles.container}>
<Quiz3 />
</View>
);
}
function Screen4({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz4 />
</View>
);
}
function Screen5({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz5 />
</View>
);
}
function Screen6({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz6 />
</View>
);
}
function Screen7({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz7 />
</View>
);
}
function Screen8({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz8 />
</View>
);
}
function Screen9({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz9 />
</View>
);
}
function Screen10({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz10 />
</View>
);
}
function Screen11({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz11 />
</View>
);
}
function Screen12({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz12 />
</View>
);
}
function Screen13({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz13 />
</View>
);
}
function Screen14({navigation}) {
return (
<View style={{flex: 1}}>
<Quiz14 />
</View>
);
}
const Stack = createStackNavigator();
function MyStack() {
class App extends React.Component {
render() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="1"
component={Screen1}
component={Quiz1}
options={{
title: 'C Major ',
headerStyle: {
......@@ -150,7 +42,7 @@ function MyStack() {
/>
<Stack.Screen
name="2"
component={Screen2}
component={Quiz2}
options={{
title: 'D Major ',
headerStyle: {
......@@ -161,7 +53,7 @@ function MyStack() {
/>
<Stack.Screen
name="3"
component={Screen3}
component={Quiz3}
options={{
title: 'E Major ',
headerStyle: {
......@@ -172,7 +64,7 @@ function MyStack() {
/>
<Stack.Screen
name="4"
component={Screen4}
component={Quiz4}
options={{
title: 'F Sharp Major',
headerStyle: {
......@@ -183,7 +75,7 @@ function MyStack() {
/>
<Stack.Screen
name="5"
component={Screen5}
component={Quiz5}
options={{
title: 'F Major ',
headerStyle: {
......@@ -194,7 +86,7 @@ function MyStack() {
/>
<Stack.Screen
name="6"
component={Screen6}
component={Quiz6}
options={{
title: 'E Flat Major ',
headerStyle: {
......@@ -205,7 +97,7 @@ function MyStack() {
/>
<Stack.Screen
name="7"
component={Screen7}
component={Quiz7}
options={{
title: 'D Flat Major',
headerStyle: {
......@@ -216,7 +108,7 @@ function MyStack() {
/>
<Stack.Screen
name="8"
component={Screen8}
component={Quiz8}
options={{
title: 'G Major',
headerStyle: {
......@@ -227,7 +119,7 @@ function MyStack() {
/>
<Stack.Screen
name="9"
component={Screen9}
component={Quiz9}
options={{
title: 'A Major',
headerStyle: {
......@@ -238,7 +130,7 @@ function MyStack() {
/>
<Stack.Screen
name="10"
component={Screen10}
component={Quiz10}
options={{
title: 'B Major ',
headerStyle: {
......@@ -249,7 +141,7 @@ function MyStack() {
/>
<Stack.Screen
name="11"
component={Screen11}
component={Quiz11}
options={{
title: 'C Sharp Major ',
headerStyle: {
......@@ -260,7 +152,7 @@ function MyStack() {
/>
<Stack.Screen
name="12"
component={Screen12}
component={Quiz12}
options={{
title: 'B Flat Major ',
headerStyle: {
......@@ -271,7 +163,7 @@ function MyStack() {
/>
<Stack.Screen
name="13"
component={Screen13}
component={Quiz13}
options={{
title: 'A Flat Major ',
headerStyle: {
......@@ -282,7 +174,7 @@ function MyStack() {
/>
<Stack.Screen
name="14"
component={Screen14}
component={Quiz14}
options={{
title: 'G Flat Major ',
headerStyle: {
......@@ -292,13 +184,9 @@ function MyStack() {
}}
/>
</Stack.Navigator>
);
}
export default function App() {
return (
<NavigationContainer>
<MyStack />
</NavigationContainer>
);
}
}
export default App;
......@@ -23,24 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
[navigation.navigate('2')];
}}
/>
);
}
export default class Quiz1 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -63,21 +50,26 @@ export default class Quiz1 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'C,D,E,F,G,A,B') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('2');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('2');
}
};
......@@ -217,17 +209,15 @@ export default class Quiz1 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('11');
}}
/>
);
}
export default class Quiz10 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz10 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'B,C#,D#,E,F#,G#,A#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('11');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('11');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz10 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('12');
}}
/>
);
}
export default class Quiz11 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz11 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'C#,D#,E#,F#,G#,A#,B#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('12');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('12');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz11 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('13');
}}
/>
);
}
export default class Quiz12 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz12 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'Bb,C,D,Eb,F,G,A') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('13');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('13');
}
};
......@@ -221,17 +212,15 @@ export default class Quiz12 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('14');
}}
/>
);
}
export default class Quiz13 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz13 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'Ab,Bb,C,Db,Eb,F,G') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('14');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('14');
}
};
......@@ -221,17 +212,15 @@ export default class Quiz13 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="FINISH"
color="#E07EF9"
onPress={() => {
navigation.navigate('1');
}}
/>
);
}
export default class Quiz14 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz14 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'Gb,Ab,Bb,Cb,Db,F') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('1');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('1');
}
};
......@@ -222,17 +213,15 @@ export default class Quiz14 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('3');
}}
/>
);
}
export default class Quiz2 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz2 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'D,E,F#,G,A,B,C#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('3');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('3');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz2 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('4');
}}
/>
);
}
export default class Quiz3 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz3 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'E,F#,G#,A,B,C#,D#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('4');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('4');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz3 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('5');
}}
/>
);
}
export default class Quiz4 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz4 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'F#,G#,A#,B,C#,D#,E#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('5');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('5');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz4 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('6');
}}
/>
);
}
export default class Quiz5 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz5 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'F,G,A,Bb,C,D,E') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('6');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('6');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz5 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('7');
}}
/>
);
}
export default class Quiz6 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz6 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'Eb,F,G,Ab,Bb,C,D') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('7');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('7');
}
};
......@@ -221,17 +212,15 @@ export default class Quiz6 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('8');
}}
/>
);
}
export default class Quiz7 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz7 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'Db,Eb,F,Gb,Ab,Bb,C') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('8');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('8');
}
};
......@@ -221,17 +212,15 @@ export default class Quiz7 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('9');
}}
/>
);
}
export default class Quiz8 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz8 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'G,A,B,C,D,E,F#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('9');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('9');
}
};
......@@ -218,17 +209,15 @@ export default class Quiz8 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
......@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#'];
const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('10');
}}
/>
);
}
export default class Quiz9 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 1,
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
......@@ -64,21 +50,26 @@ export default class Quiz9 extends Component {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 1,
timer: 0,
});
};
onSubmit = () => {
console.log(keywordsList.toString());
if (keywordsList.toString() === 'A,B,C#,D,E,F#,G#') {
this.setState((prevState) => ({correct: prevState.correct + 1}));
this.setState((prevState) => ({
correct: prevState.correct + 1,
timer: 0,
}));
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('10');
} else {
console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2}));
this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!');
this.props.navigation.navigate('10');
}
};
......@@ -219,17 +210,15 @@ export default class Quiz9 extends Component {
</View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button
title="RESET"
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit} />
<View style={styles.submit}>
<NextButton />
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
</ImageBackground>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment