Commit 08cb2c66 authored by norhalimah's avatar norhalimah

update

parent 9ab3892d
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
import React from 'react'; import React from 'react';
import {Button, View, Alert} from 'react-native'; import {Button, View, Alert} from 'react-native';
import {NavigationContainer} from '@react-navigation/native'; import {NavigationContainer} from '@react-navigation/native';
...@@ -22,283 +22,171 @@ import Quiz12 from './quiz12'; ...@@ -22,283 +22,171 @@ import Quiz12 from './quiz12';
import Quiz13 from './quiz13'; import Quiz13 from './quiz13';
import Quiz14 from './quiz14'; 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(); const Stack = createStackNavigator();
function MyStack() { class App extends React.Component {
return ( render() {
<Stack.Navigator> return (
<Stack.Screen <NavigationContainer>
name="1" <Stack.Navigator>
component={Screen1} <Stack.Screen
options={{ name="1"
title: 'C Major ', component={Quiz1}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'C Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="2" />
component={Screen2} <Stack.Screen
options={{ name="2"
title: 'D Major ', component={Quiz2}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'D Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="3" />
component={Screen3} <Stack.Screen
options={{ name="3"
title: 'E Major ', component={Quiz3}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'E Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="4" />
component={Screen4} <Stack.Screen
options={{ name="4"
title: 'F Sharp Major', component={Quiz4}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'F Sharp Major',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="5" />
component={Screen5} <Stack.Screen
options={{ name="5"
title: 'F Major ', component={Quiz5}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'F Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="6" />
component={Screen6} <Stack.Screen
options={{ name="6"
title: 'E Flat Major ', component={Quiz6}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'E Flat Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="7" />
component={Screen7} <Stack.Screen
options={{ name="7"
title: 'D Flat Major', component={Quiz7}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'D Flat Major',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="8" />
component={Screen8} <Stack.Screen
options={{ name="8"
title: 'G Major', component={Quiz8}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'G Major',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="9" />
component={Screen9} <Stack.Screen
options={{ name="9"
title: 'A Major', component={Quiz9}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'A Major',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="10" />
component={Screen10} <Stack.Screen
options={{ name="10"
title: 'B Major ', component={Quiz10}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'B Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="11" />
component={Screen11} <Stack.Screen
options={{ name="11"
title: 'C Sharp Major ', component={Quiz11}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'C Sharp Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="12" />
component={Screen12} <Stack.Screen
options={{ name="12"
title: 'B Flat Major ', component={Quiz12}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'B Flat Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="13" />
component={Screen13} <Stack.Screen
options={{ name="13"
title: 'A Flat Major ', component={Quiz13}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'A Flat Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
<Stack.Screen }}
name="14" />
component={Screen14} <Stack.Screen
options={{ name="14"
title: 'G Flat Major ', component={Quiz14}
headerStyle: { options={{
backgroundColor: '#E07EF9', title: 'G Flat Major ',
}, headerStyle: {
headerTintColor: '#fff', backgroundColor: '#E07EF9',
}} },
/> headerTintColor: '#fff',
</Stack.Navigator> }}
); />
} </Stack.Navigator>
</NavigationContainer>
export default function App() { );
return ( }
<NavigationContainer> }
<MyStack />
</NavigationContainer> export default App;
);
}
...@@ -23,24 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,24 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
[navigation.navigate('2')];
}}
/>
);
}
export default class Quiz1 extends Component { export default class Quiz1 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -63,21 +50,26 @@ export default class Quiz1 extends Component { ...@@ -63,21 +50,26 @@ export default class Quiz1 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'C,D,E,F,G,A,B') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('2');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('2');
} }
}; };
...@@ -217,17 +209,15 @@ export default class Quiz1 extends Component { ...@@ -217,17 +209,15 @@ export default class Quiz1 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('11');
}}
/>
);
}
export default class Quiz10 extends Component { export default class Quiz10 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz10 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz10 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'B,C#,D#,E,F#,G#,A#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('11');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('11');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz10 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz10 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('12');
}}
/>
);
}
export default class Quiz11 extends Component { export default class Quiz11 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz11 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz11 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'C#,D#,E#,F#,G#,A#,B#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('12');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('12');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz11 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz11 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb']; const NOTESAA = ['Bb'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('13');
}}
/>
);
}
export default class Quiz12 extends Component { export default class Quiz12 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz12 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz12 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'Bb,C,D,Eb,F,G,A') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('13');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('13');
} }
}; };
...@@ -221,17 +212,15 @@ export default class Quiz12 extends Component { ...@@ -221,17 +212,15 @@ export default class Quiz12 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb']; const NOTESAA = ['Bb'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('14');
}}
/>
);
}
export default class Quiz13 extends Component { export default class Quiz13 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz13 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz13 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'Ab,Bb,C,Db,Eb,F,G') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('14');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('14');
} }
}; };
...@@ -221,17 +212,15 @@ export default class Quiz13 extends Component { ...@@ -221,17 +212,15 @@ export default class Quiz13 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb']; const NOTESAA = ['Bb'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="FINISH"
color="#E07EF9"
onPress={() => {
navigation.navigate('1');
}}
/>
);
}
export default class Quiz14 extends Component { export default class Quiz14 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz14 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz14 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'Gb,Ab,Bb,Cb,Db,F') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('1');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('1');
} }
}; };
...@@ -222,17 +213,15 @@ export default class Quiz14 extends Component { ...@@ -222,17 +213,15 @@ export default class Quiz14 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('3');
}}
/>
);
}
export default class Quiz2 extends Component { export default class Quiz2 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz2 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz2 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'D,E,F#,G,A,B,C#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('3');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('3');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz2 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz2 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('4');
}}
/>
);
}
export default class Quiz3 extends Component { export default class Quiz3 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz3 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz3 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'E,F#,G#,A,B,C#,D#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('4');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('4');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz3 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz3 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('5');
}}
/>
);
}
export default class Quiz4 extends Component { export default class Quiz4 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz4 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz4 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'F#,G#,A#,B,C#,D#,E#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('5');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('5');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz4 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz4 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb']; const NOTESAA = ['Bb'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('6');
}}
/>
);
}
export default class Quiz5 extends Component { export default class Quiz5 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz5 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz5 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'F,G,A,Bb,C,D,E') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('6');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('6');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz5 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz5 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb']; const NOTESAA = ['Bb'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('7');
}}
/>
);
}
export default class Quiz6 extends Component { export default class Quiz6 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz6 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz6 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'Eb,F,G,Ab,Bb,C,D') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('7');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('7');
} }
}; };
...@@ -221,17 +212,15 @@ export default class Quiz6 extends Component { ...@@ -221,17 +212,15 @@ export default class Quiz6 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['Ab'];
const NOTESAA = ['Bb']; const NOTESAA = ['Bb'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('8');
}}
/>
);
}
export default class Quiz7 extends Component { export default class Quiz7 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz7 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz7 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'Db,Eb,F,Gb,Ab,Bb,C') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('8');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('8');
} }
}; };
...@@ -221,17 +212,15 @@ export default class Quiz7 extends Component { ...@@ -221,17 +212,15 @@ export default class Quiz7 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('9');
}}
/>
);
}
export default class Quiz8 extends Component { export default class Quiz8 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz8 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz8 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'G,A,B,C,D,E,F#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('9');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('9');
} }
}; };
...@@ -218,17 +209,15 @@ export default class Quiz8 extends Component { ...@@ -218,17 +209,15 @@ export default class Quiz8 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </ImageBackground>
......
...@@ -23,25 +23,11 @@ const NOTESGG = ['G#']; ...@@ -23,25 +23,11 @@ const NOTESGG = ['G#'];
const NOTESAA = ['A#']; const NOTESAA = ['A#'];
const keywordsList = []; const keywordsList = [];
function NextButton() {
const navigation = useNavigation();
return (
<Button
title="NEXT"
color="#E07EF9"
onPress={() => {
navigation.navigate('10');
}}
/>
);
}
export default class Quiz9 extends Component { export default class Quiz9 extends Component {
constructor(props: Object) { constructor(props: Object) {
super(props); super(props);
this.state = { this.state = {
timer: 1, timer: 0,
correct: 0, correct: 0,
wrong: 0, wrong: 0,
keywordsList: '', keywordsList: '',
...@@ -64,21 +50,26 @@ export default class Quiz9 extends Component { ...@@ -64,21 +50,26 @@ export default class Quiz9 extends Component {
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
console.log(keywordsList); console.log(keywordsList);
this.setState({ this.setState({
timer: 1, timer: 0,
}); });
}; };
onSubmit = () => { onSubmit = () => {
console.log(keywordsList.toString()); console.log(keywordsList.toString());
if (keywordsList.toString() === 'A,B,C#,D,E,F#,G#') { 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!'); Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('10');
} else { } else {
console.log('wrong'); console.log('wrong');
this.setState((prevState) => ({wrong: prevState.wrong + 2})); this.setState((prevState) => ({wrong: prevState.wrong + 2, timer: 0}));
keywordsList.splice(0, keywordsList.length); keywordsList.splice(0, keywordsList.length);
Alert.alert('Try Again!'); Alert.alert('Try Again!');
this.props.navigation.navigate('10');
} }
}; };
...@@ -219,17 +210,15 @@ export default class Quiz9 extends Component { ...@@ -219,17 +210,15 @@ export default class Quiz9 extends Component {
</View> </View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={styles.submit}> <View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
<View style={styles.submit}>
<Button <Button
title="RESET" title="RESET"
color="#E07EF9" color="#E07EF9"
onPress={this.removeArray} onPress={this.removeArray}
/> />
</View> </View>
<View style={styles.submit} />
<View style={styles.submit}> <View style={styles.submit}>
<NextButton /> <Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View> </View>
</View> </View>
</ImageBackground> </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