Commit 08cb2c66 authored by norhalimah's avatar norhalimah

update

parent 9ab3892d
This diff is collapsed.
......@@ -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