Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pianoApp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
norhalimah
pianoApp
Commits
12a0c461
Commit
12a0c461
authored
Jan 15, 2021
by
norhalimah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backhandler
parent
b295c1d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
63 deletions
+58
-63
home.js
screens/home.js
+3
-1
quiz.js
screens/quiz.js
+55
-62
No files found.
screens/home.js
View file @
12a0c461
...
@@ -18,10 +18,12 @@ class Home extends React.PureComponent {
...
@@ -18,10 +18,12 @@ class Home extends React.PureComponent {
async
componentDidMount
()
{
async
componentDidMount
()
{
Orientation
.
lockToPortrait
();
Orientation
.
lockToPortrait
();
// Orientation.lockAsync(Orientation.OrientationLock.PORTRAIT_UP);
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
Orientation
.
lockToPortrait
();
Orientation
.
lockToPortrait
();
// Orientation.lockAsync(Orientation.OrientationLock.PORTRAIT_UP);
}
}
render
()
{
render
()
{
...
...
screens/quiz.js
View file @
12a0c461
...
@@ -11,10 +11,11 @@ import {
...
@@ -11,10 +11,11 @@ import {
TouchableHighlight
,
TouchableHighlight
,
Button
,
Button
,
Image
,
Image
,
///
Alert,
Alert
,
Modal
,
Modal
,
TouchableOpacity
,
TouchableOpacity
,
Dimensions
,
Dimensions
,
BackHandler
,
}
from
'react-native'
;
}
from
'react-native'
;
import
{
Stopwatch
}
from
'react-native-stopwatch-timer'
;
import
{
Stopwatch
}
from
'react-native-stopwatch-timer'
;
import
Orientation
from
'react-native-orientation'
;
import
Orientation
from
'react-native-orientation'
;
...
@@ -171,8 +172,7 @@ class Quiz extends React.Component {
...
@@ -171,8 +172,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -185,8 +185,7 @@ class Quiz extends React.Component {
...
@@ -185,8 +185,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -204,8 +203,7 @@ class Quiz extends React.Component {
...
@@ -204,8 +203,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -218,8 +216,7 @@ class Quiz extends React.Component {
...
@@ -218,8 +216,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -237,8 +234,7 @@ class Quiz extends React.Component {
...
@@ -237,8 +234,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -251,8 +247,7 @@ class Quiz extends React.Component {
...
@@ -251,8 +247,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -270,8 +265,7 @@ class Quiz extends React.Component {
...
@@ -270,8 +265,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -284,8 +278,7 @@ class Quiz extends React.Component {
...
@@ -284,8 +278,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -298,13 +291,12 @@ class Quiz extends React.Component {
...
@@ -298,13 +291,12 @@ class Quiz extends React.Component {
ansFMajor
=
()
=>
{
ansFMajor
=
()
=>
{
if
(
keywordsList
.
toString
()
===
'F1,G1,A1,A#1,C2,D2,E2,F2'
)
{
if
(
keywordsList
.
toString
()
===
'F1,G1,A1,A#1,C2,D2,E2,F2'
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -317,8 +309,7 @@ class Quiz extends React.Component {
...
@@ -317,8 +309,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -330,14 +321,13 @@ class Quiz extends React.Component {
...
@@ -330,14 +321,13 @@ class Quiz extends React.Component {
};
};
ansEbMajor
=
()
=>
{
ansEbMajor
=
()
=>
{
if
(
keywordsList
.
toString
()
===
'D#1,F1,G1,G#1,A#1,C2,D2,D#2'
)
{
if
(
keywordsList
.
toString
()
===
'D#1,F1,G1,G#1,A#1,C2,D2,D#2'
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -350,8 +340,7 @@ class Quiz extends React.Component {
...
@@ -350,8 +340,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -369,8 +358,7 @@ class Quiz extends React.Component {
...
@@ -369,8 +358,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -383,8 +371,7 @@ class Quiz extends React.Component {
...
@@ -383,8 +371,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -402,8 +389,7 @@ class Quiz extends React.Component {
...
@@ -402,8 +389,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -416,8 +402,7 @@ class Quiz extends React.Component {
...
@@ -416,8 +402,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -429,14 +414,13 @@ class Quiz extends React.Component {
...
@@ -429,14 +414,13 @@ class Quiz extends React.Component {
};
};
ansAMajor
=
()
=>
{
ansAMajor
=
()
=>
{
if
(
keywordsList
.
toString
()
===
'A1,B1,C#2,D2,E2,F#2,G#2,A2'
)
{
if
(
keywordsList
.
toString
()
===
'A1,B1,C#2,D2,E2,F#2,G#2,A2'
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -449,8 +433,7 @@ class Quiz extends React.Component {
...
@@ -449,8 +433,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -462,14 +445,13 @@ class Quiz extends React.Component {
...
@@ -462,14 +445,13 @@ class Quiz extends React.Component {
};
};
ansBMajor
=
()
=>
{
ansBMajor
=
()
=>
{
if
(
keywordsList
.
toString
()
===
'B1,C#2,D#2,E2,F#2,G#2,A#2,B2'
)
{
if
(
keywordsList
.
toString
()
===
'B1,C#2,D#2,E2,F#2,G#2,A#2,B2'
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -482,8 +464,7 @@ class Quiz extends React.Component {
...
@@ -482,8 +464,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -501,8 +482,7 @@ class Quiz extends React.Component {
...
@@ -501,8 +482,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -515,8 +495,7 @@ class Quiz extends React.Component {
...
@@ -515,8 +495,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -534,8 +513,7 @@ class Quiz extends React.Component {
...
@@ -534,8 +513,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -548,8 +526,7 @@ class Quiz extends React.Component {
...
@@ -548,8 +526,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -561,14 +538,13 @@ class Quiz extends React.Component {
...
@@ -561,14 +538,13 @@ class Quiz extends React.Component {
};
};
ansAbMajor
=
()
=>
{
ansAbMajor
=
()
=>
{
if
(
keywordsList
.
toString
()
===
'G#1,A#1,C2,C#2,D#2,F2,G2,G#2'
)
{
if
(
keywordsList
.
toString
()
===
'G#1,A#1,C2,C#2,D#2,F2,G2,G#2'
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
if
(
(
this
.
state
.
count
+
1
)
>
this
.
state
.
maxCount
)
{
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
correct
:
this
.
state
.
correct
+
1
});
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -581,8 +557,7 @@ class Quiz extends React.Component {
...
@@ -581,8 +557,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -600,8 +575,7 @@ class Quiz extends React.Component {
...
@@ -600,8 +575,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
this
.
handlerArgCall
((
this
.
state
.
correct
+
1
),
this
.
state
.
wrong
,
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
keywordsList
.
splice
(
0
,
keywordsList
.
length
);
...
@@ -614,8 +588,7 @@ class Quiz extends React.Component {
...
@@ -614,8 +588,7 @@ class Quiz extends React.Component {
this
.
setState
({
showDone
:
true
});
this
.
setState
({
showDone
:
true
});
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
this
.
handlerArgCall
(
this
.
state
.
correct
,
(
this
.
state
.
wrong
+
1
),
stime
);
console
.
log
(
'finish'
);
console
.
log
(
'finish'
);
this
.
props
.
navigation
.
navigate
(
'1'
);
this
.
backAction
();
Orientation
.
lockToPortrait
();
}
}
else
{
else
{
this
.
setState
({
showW
:
true
});
this
.
setState
({
showW
:
true
});
...
@@ -626,14 +599,34 @@ class Quiz extends React.Component {
...
@@ -626,14 +599,34 @@ class Quiz extends React.Component {
}
}
};
};
homeExit
=
()
=>
{
// this.props.navigation.navigate('1');
Alert
.
alert
(
'Hold on!'
,
'Are you sure you want to stop?'
,
[
{
text
:
'Cancel'
,
onPress
:
()
=>
null
,
style
:
'cancel'
,
},
{
text
:
'YES'
,
onPress
:
()
=>
[
this
.
props
.
navigation
.
navigate
(
'1'
),
Orientation
.
lockToPortrait
()]},
]);
return
true
;
};
backAction
=
()
=>
{
this
.
props
.
navigation
.
navigate
(
'1'
);
Orientation
.
lockToPortrait
();
};
async
componentDidMount
()
{
async
componentDidMount
()
{
//this.removeArray();
//this.removeArray();
//BackHandler.addEventListener('hardwareBackPress', this.homeExit);
Orientation
.
lockToLandscape
();
Orientation
.
lockToLandscape
();
this
.
displayData
();
this
.
displayData
();
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
this
.
removeArray
();
this
.
removeArray
();
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
homeExit
);
//clearInterval(this.interval);
//clearInterval(this.interval);
// Orientation.lockToLandscape();
// Orientation.lockToLandscape();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment