Commit b736426d authored by norhalimah's avatar norhalimah

the latest

parent ff265d54
This diff is collapsed.
......@@ -16,7 +16,7 @@
</natures>
<filteredResources>
<filter>
<id>1606965780850</id>
<id>0</id>
<name></name>
<type>30</type>
<matcher>
......
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PianoApp-app</name>
<name>app</name>
<comment>Project PianoApp-app created by Buildship.</comment>
<projects>
</projects>
......@@ -22,7 +22,7 @@
</natures>
<filteredResources>
<filter>
<id>1606965780864</id>
<id>0</id>
<name></name>
<type>30</type>
<matcher>
......
......@@ -15,4 +15,12 @@ public class MainActivity extends ReactActivity {
return "PianoApp";
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Intent intent = new Intent("onConfigurationChanged");
intent.putExtra("newConfig", newConfig);
this.sendBroadcast(intent);
}
}
......@@ -5,6 +5,7 @@ import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.github.yamill.orientation.OrientationPackage;
import com.github.yamill.orientation.OrientationPackage;
import com.rnfs.RNFSPackage;
import com.rnfs.RNFSPackage;
import com.oblador.vectoricons.VectorIconsPackage;
......
......@@ -3,8 +3,6 @@ include ':react-native-orientation'
project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
......
......@@ -19,6 +19,7 @@
"moment": "^2.29.1",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-counters": "^1.2.0",
"react-native-elements": "^3.0.0-alpha.1",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.9.0",
......
......@@ -14,16 +14,15 @@ import {Icon} from 'react-native-elements';
import Orientation from 'react-native-orientation';
class Home extends React.PureComponent {
componentDidMount() {
// Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
// Orientation.addOrientationListener(this._onOrientationDidChange);
}
componentWillUnmount() {
Orientation.lockToPortrait();
//Orientation.removeOrientationListener(this._onOrientationDidChange);
}
render() {
return (
<View style={styles.container}>
......@@ -39,8 +38,7 @@ class Home extends React.PureComponent {
<TouchableOpacity
style={styles.menu}
onPress={() => {
this.props.navigation.navigate('q1');
//Orientation.lockToLandscape();
this.props.navigation.navigate('2',{c: 0, w: 0, t: 0, cc : 1});
}}>
<Icon raised name="trophy" type="font-awesome" />
<Text>Piano</Text>
......
......@@ -18,26 +18,37 @@ import Orientation from 'react-native-orientation';
//import AsyncStorage from '@react-native-async-storage/async-storage';
import * as RNFS from 'react-native-fs';
var path = RNFS.DocumentDirectoryPath + '/test.txt';
//var counter = 0;
var array = [];
class LogBook extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
logbook: [],
correct: [],
};
}
displayData = async () => {
RNFS.readFile(path, 'ascii')
.then((res) => {
this.setState({
logbook: res.split('\n'),
});
//var l = this.state.logbook.length;
console.log(res);
// console.log(this.state.logbook);
// console.log(l);
// var l = this.state.logbook.length;
//console.log(res);
// console.log(this.state.logbook);
let index = -1;
array = this.state.logbook;
// console.log(array);
if ((index = array.indexOf('')) !== -1) {
array.splice(index, 1);
this.setState({
logbook: array,
});
console.log(this.state.logbook);
}
// console.log(this.state.logbook.length);
})
.catch((err) => {
console.log(err.message, err.code);
......@@ -48,6 +59,7 @@ class LogBook extends React.PureComponent {
Orientation.lockToPortrait();
this.displayData();
}
render() {
return (
<View style={styles.container}>
......@@ -76,26 +88,9 @@ class LogBook extends React.PureComponent {
backgroundColor: 'white',
borderRadius: 10,
}}>
<Text
style={{
textAlign: 'justify',
marginRight: 10,
fontSize: 40,
}}>
{id + 1}
</Text>
<Text
style={{
marginRight: 5,
fontSize: 40,
borderWidth: 1,
borderColor: 'purple',
}}>
{}
</Text>
<Text>{item.split(',').join('\n')}</Text>
<Text style={{fontSize:15}}>{item.split(',').join('\n')}</Text>
</View>
))}
)).reverse()}
</ScrollView>
</SafeAreaView>
</ImageBackground>
......
This diff is collapsed.
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
StatusBar,
} from 'react-native';
import Orientation from 'react-native-orientation';
import styles from '../style/style';
import config from '../config';
//import ImmersiveMode from 'react-native-immersive-mode';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz1 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
Orientation.lockToLandscape();
};
onSubmit = () => {
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('C1') &&
fullnotes.includes('D1') &&
fullnotes.includes('E1') &&
fullnotes.includes('F1') &&
fullnotes.includes('G1') &&
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C2')
) {
//if (keywordsList.toString() === 'C1,D1,E1,F1,G1,A1,B1,C2')
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q2', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q2', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
Orientation.lockToLandscape();
// ImmersiveMode.setBarMode('Bottom');
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
// Orientation.lockToLandscape();
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<StatusBar hidden />
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image style={styles.logo} source={require('../img/Cmajor.png')} />
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz10 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('B1') &&
fullnotes.includes('C#2') &&
fullnotes.includes('D#2') &&
fullnotes.includes('E2') &&
fullnotes.includes('F#2') &&
fullnotes.includes('G#2') &&
fullnotes.includes('A#2') &&
fullnotes.includes('B2')
) {
// if (keywordsList.toString() === 'B1,C#2,D#2,E2,F#2,G#2,A#2,B2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q11', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q11', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image style={styles.logo} source={require('../img/Bmajor.png')} />
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'B#1',
'D1',
'E1',
'E#1',
'G1',
'A1',
'B1',
'B#2',
'D2',
'E2',
'E#2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz11 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('C#1') &&
fullnotes.includes('D#1') &&
fullnotes.includes('E#1') &&
fullnotes.includes('F#1') &&
fullnotes.includes('G#1') &&
fullnotes.includes('A#1') &&
fullnotes.includes('B#2') &&
fullnotes.includes('C#2')
) {
// if (keywordsList.toString() === 'C#1,D#1,E#1,F#1,G#1,A#1,B#2,C#2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q12', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q12', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image style={styles.logo} source={require('../img/Csmajor.png')} />
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['Db1'];
const NOTESDD = ['Eb1'];
const NOTESFF = ['Gb1'];
const NOTESGG = ['Ab1'];
const NOTESAA = ['Bb1'];
const NOTESCC1 = ['Db2'];
const NOTESDD1 = ['Eb2'];
const NOTESFF1 = ['Gb2'];
const NOTESGG1 = ['Ab2'];
const NOTESAA1 = ['Bb2'];
const keywordsList = [];
export default class Quiz12 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('Bb1') &&
fullnotes.includes('C2') &&
fullnotes.includes('D2') &&
fullnotes.includes('Eb2') &&
fullnotes.includes('F2') &&
fullnotes.includes('G2') &&
fullnotes.includes('A2') &&
fullnotes.includes('Bb2')
) {
//if (keywordsList.toString() === 'Bb1,C2,D2,Eb2,F2,G2,A2,Bb2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q13', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q13', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/Bflatmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['Db1'];
const NOTESDD = ['Eb1'];
const NOTESFF = ['Gb1'];
const NOTESGG = ['Ab1'];
const NOTESAA = ['Bb1'];
const NOTESCC1 = ['Db2'];
const NOTESDD1 = ['Eb2'];
const NOTESFF1 = ['Gb2'];
const NOTESGG1 = ['Ab2'];
const NOTESAA1 = ['Bb2'];
const keywordsList = [];
export default class Quiz13 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('Ab1') &&
fullnotes.includes('Bb1') &&
fullnotes.includes('C2') &&
fullnotes.includes('Db2') &&
fullnotes.includes('Eb2') &&
fullnotes.includes('F2') &&
fullnotes.includes('G2') &&
fullnotes.includes('Ab2')
) {
// if (keywordsList.toString() === 'Ab1,Bb1,C2,Db2,Eb2,F2,G2,Ab2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q14', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q14', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/Aflatmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
This diff is collapsed.
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
StatusBar,
} from 'react-native';
import Orientation from 'react-native-orientation';
import styles from '../style/style';
import config from '../config';
//import ImmersiveMode from 'react-native-immersive-mode';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz15 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
Orientation.lockToLandscape();
};
onSubmit = () => {
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('C1') &&
fullnotes.includes('D1') &&
fullnotes.includes('E1') &&
fullnotes.includes('F1') &&
fullnotes.includes('G1') &&
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C2')
) {
//if (keywordsList.toString() === 'C1,D1,E1,F1,G1,A1,B1,C2')
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q16', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q16', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
// Orientation.lockToLandscape();
// ImmersiveMode.setBarMode('Bottom');
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<StatusBar hidden />
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_cmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import Orientation from 'react-native-orientation';
import {useNavigation} from '@react-navigation/native';
import config from '../config';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz16 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('D1') &&
fullnotes.includes('E1') &&
fullnotes.includes('F#1') &&
fullnotes.includes('G1') &&
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C#2') &&
fullnotes.includes('D2')
) {
// if (keywordsList.toString() === 'D1,E1,F#1,G1,A1,B1,C#2,D2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q17', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q17', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
Orientation.lockToLandscape();
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_dmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import Orientation from 'react-native-orientation';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz17 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('E1') &&
fullnotes.includes('F#1') &&
fullnotes.includes('G#1') &&
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C#2') &&
fullnotes.includes('D#2') &&
fullnotes.includes('E2')
) {
//if (keywordsList.toString() === 'E1,F#1,G#1,A1,B1,C#2,D#2,E2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q18', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q18', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
Orientation.lockToLandscape();
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_emajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import Orientation from 'react-native-orientation';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'E#1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'E#2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz18 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('F#1') &&
fullnotes.includes('G#1') &&
fullnotes.includes('A#1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C#2') &&
fullnotes.includes('D#2') &&
fullnotes.includes('E#2') &&
fullnotes.includes('F#2')
) {
//if (keywordsList.toString() === 'F#1,G#1,A#1,B1,C#2,D#2,E#2,F#2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q19', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q19', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
Orientation.lockToLandscape();
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_fsmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['Db1'];
const NOTESDD = ['Eb1'];
const NOTESFF = ['Gb1'];
const NOTESGG = ['Ab1'];
const NOTESAA = ['Bb1'];
const NOTESCC1 = ['Db2'];
const NOTESDD1 = ['Eb2'];
const NOTESFF1 = ['Gb2'];
const NOTESGG1 = ['Ab2'];
const NOTESAA1 = ['Bb2'];
const keywordsList = [];
export default class Quiz19 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('F1') &&
fullnotes.includes('G1') &&
fullnotes.includes('A1') &&
fullnotes.includes('Bb1') &&
fullnotes.includes('C2') &&
fullnotes.includes('D2') &&
fullnotes.includes('E2') &&
fullnotes.includes('F2')
) {
//if (keywordsList.toString() === 'F1,G1,A1,Bb1,C2,D2,E2,F2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q20', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q20', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_fmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import Orientation from 'react-native-orientation';
import {useNavigation} from '@react-navigation/native';
import config from '../config';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz2 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('D1') &&
fullnotes.includes('E1') &&
fullnotes.includes('F#1') &&
fullnotes.includes('G1') &&
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C#2') &&
fullnotes.includes('D2')
) {
// if (keywordsList.toString() === 'D1,E1,F#1,G1,A1,B1,C#2,D2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q3', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q3', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
Orientation.lockToLandscape();
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image style={styles.logo} source={require('../img/Dmajor.png')} />
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['Db1'];
const NOTESDD = ['Eb1'];
const NOTESFF = ['Gb1'];
const NOTESGG = ['Ab1'];
const NOTESAA = ['Bb1'];
const NOTESCC1 = ['Db2'];
const NOTESDD1 = ['Eb2'];
const NOTESFF1 = ['Gb2'];
const NOTESGG1 = ['Ab2'];
const NOTESAA1 = ['Bb2'];
const keywordsList = [];
export default class Quiz20 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('Eb1') &&
fullnotes.includes('F1') &&
fullnotes.includes('G1') &&
fullnotes.includes('Ab1') &&
fullnotes.includes('Bb1') &&
fullnotes.includes('C2') &&
fullnotes.includes('D2') &&
fullnotes.includes('Eb2')
) {
// if (keywordsList.toString() === 'Eb1,F1,G1,Ab1,Bb1,C2,D2,Eb2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q21', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q21', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_eflat.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['Db1'];
const NOTESDD = ['Eb1'];
const NOTESFF = ['Gb1'];
const NOTESGG = ['Ab1'];
const NOTESAA = ['Bb1'];
const NOTESCC1 = ['Db2'];
const NOTESDD1 = ['Eb2'];
const NOTESFF1 = ['Gb2'];
const NOTESGG1 = ['Ab2'];
const NOTESAA1 = ['Bb2'];
const keywordsList = [];
export default class Quiz21 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('Db1') &&
fullnotes.includes('Eb1') &&
fullnotes.includes('F1') &&
fullnotes.includes('Gb1') &&
fullnotes.includes('Ab1') &&
fullnotes.includes('Bb1') &&
fullnotes.includes('C2') &&
fullnotes.includes('Db2')
) {
//if (keywordsList.toString() === 'Db1,Eb1,F1,Gb1,Ab1,Bb1,C2,Db2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q22', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q22', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_dflat.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz22 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('G1') &&
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C2') &&
fullnotes.includes('D2') &&
fullnotes.includes('E2') &&
fullnotes.includes('F#2') &&
fullnotes.includes('G2')
) {
//if (keywordsList.toString() === 'G1,A1,B1,C2,D2,E2,F#2,G2') {
this.setState({
timer: 0,
});
clearInterval(this._interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q23', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState({
timer: 0,
});
clearInterval(this._interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q23', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_gmajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
/* eslint-disable prettier/prettier */
/* eslint-disable react/no-did-mount-set-state */
/* eslint-disable prettier/prettier */
/* eslint-disable no-unused-vars */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable prettier/prettier */
import React, {Component} from 'react';
import {
Text,
View,
StyleSheet,
TouchableHighlight,
ImageBackground,
Image,
Button,
Alert,
} from 'react-native';
import styles from '../style/style';
import {useNavigation} from '@react-navigation/native';
const NOTESWHITE = [
'C1',
'D1',
'E1',
'F1',
'G1',
'A1',
'B1',
'C2',
'D2',
'E2',
'F2',
'G2',
'A2',
'B2',
];
const NOTESCC = ['C#1'];
const NOTESDD = ['D#1'];
const NOTESFF = ['F#1'];
const NOTESGG = ['G#1'];
const NOTESAA = ['A#1'];
const NOTESCC1 = ['C#2'];
const NOTESDD1 = ['D#2'];
const NOTESFF1 = ['F#2'];
const NOTESGG1 = ['G#2'];
const NOTESAA1 = ['A#2'];
const keywordsList = [];
export default class Quiz23 extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
keywordsList: '',
};
}
toggleKeyword = (keyword) => {
let list = keywordsList;
let index = -1;
if ((index = keywordsList.indexOf(keyword)) !== -1) {
list.splice(index, 1);
console.log(list);
} else {
list.push(keyword);
console.log(list);
}
this.setState({keywordsList: list});
};
//reset
removeArray = () => {
keywordsList.splice(0, keywordsList.length);
console.log(keywordsList);
this.setState({
timer: 0,
});
clearInterval(this._interval);
};
onSubmit = () => {
console.log(keywordsList.toString());
const fullnotes = keywordsList.toString();
if (
fullnotes.includes('A1') &&
fullnotes.includes('B1') &&
fullnotes.includes('C#2') &&
fullnotes.includes('D2') &&
fullnotes.includes('E2') &&
fullnotes.includes('F#2') &&
fullnotes.includes('G#2') &&
fullnotes.includes('A2')
) {
// if (keywordsList.toString() === 'A1,B1,C#2,D2,E2,F#2,G#2,A2') {
this.setState((prevState) => ({
timer: 0,
}));
clearInterval(this.interval);
Alert.alert('Correct!');
keywordsList.splice(0, keywordsList.length);
this.props.navigation.navigate('q24', {
c: this.state.correct + 2,
w: this.state.wrong,
});
} else {
console.log('wrong');
this.setState((prevState) => ({
timer: 0,
}));
clearInterval(this.interval);
keywordsList.splice(0, keywordsList.length);
Alert.alert('Wrong!');
this.props.navigation.navigate('q24', {
c: this.state.correct,
w: this.state.wrong + 1,
});
}
};
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
this.interval = setInterval(
() => this.setState((prevState) => ({timer: prevState.timer + 1})),
1500,
);
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
buttonB11,
buttonB21,
buttonB31,
buttonB41,
buttonB51,
SbuttonB11,
SbuttonB21,
SbuttonB31,
SbuttonB41,
SbuttonB51,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.cc1}>
<Text style={styles.correct}>Correct : {this.state.correct}</Text>
<Text style={styles.wrong}>
Wrong :{'\n'}
{this.state.wrong}
</Text>
<Text style={styles.timer}>
Timer :{'\n'}
{this.state.timer}
</Text>
</View>
<View style={styles.buttonView}>
<View style={styles.submit}>
<Button
title="RESET "
color="#E07EF9"
onPress={this.removeArray}
/>
</View>
<View style={styles.submit}>
<Button title="SUBMIT" color="#E07EF9" onPress={this.onSubmit} />
</View>
</View>
<Image
style={styles.logo}
source={require('../img/bass_amajor.png')}
/>
</View>
<View style={styles.c2}>
{NOTESWHITE.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? selectedKeywordStyle
: buttonStyle
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB1
: buttonB1
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB2
: buttonB2
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB3
: buttonB3
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB4
: buttonB4
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB5
: buttonB5
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESCC1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB11
: buttonB11
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESDD1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB21
: buttonB21
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESFF1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB31
: buttonB31
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESGG1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB41
: buttonB41
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
{NOTESAA1.map((item, id) => (
<TouchableHighlight
style={
keywordsList.find((element) => element === item)
? SbuttonB51
: buttonB51
}
onPress={() => this.toggleKeyword(item)}
key={id}>
<Text style={textStyle}> </Text>
</TouchableHighlight>
))}
</View>
</View>
);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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