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
30aa22bc
Commit
30aa22bc
authored
Jan 27, 2021
by
norhalimah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating ...
parent
d9d76629
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
listening.js
screens/listening.js
+18
-3
settingListen.js
screens/settingListen.js
+1
-4
No files found.
screens/listening.js
View file @
30aa22bc
...
@@ -15,6 +15,7 @@ import {
...
@@ -15,6 +15,7 @@ import {
Dimensions
,
Dimensions
,
BackHandler
,
BackHandler
,
ScrollView
,
ScrollView
,
Image
,
}
from
'react-native'
;
}
from
'react-native'
;
import
styles
from
'../style/styleListen'
;
import
styles
from
'../style/styleListen'
;
import
{
Stopwatch
}
from
'react-native-stopwatch-timer'
;
import
{
Stopwatch
}
from
'react-native-stopwatch-timer'
;
...
@@ -62,7 +63,7 @@ const wroSound = require('../media/sound/wrong.mp3');
...
@@ -62,7 +63,7 @@ const wroSound = require('../media/sound/wrong.mp3');
const
keySound
=
Listennotes
;
const
keySound
=
Listennotes
;
var
soundN
=
''
;
var
soundN
=
''
;
var
indexS
=
0
;
//
var indexS = 0;
var
stime
=
0
;
var
stime
=
0
;
//var records = [];
//var records = [];
...
@@ -84,6 +85,7 @@ class Listen extends React.Component {
...
@@ -84,6 +85,7 @@ class Listen extends React.Component {
showW
:
false
,
showW
:
false
,
showDone
:
false
,
showDone
:
false
,
showQuit
:
false
,
showQuit
:
false
,
showMusic
:
false
,
maxCount
:
5
,
maxCount
:
5
,
records
:
[],
records
:
[],
};
};
...
@@ -177,7 +179,7 @@ class Listen extends React.Component {
...
@@ -177,7 +179,7 @@ class Listen extends React.Component {
console
.
log
(
'play'
);
console
.
log
(
'play'
);
console
.
log
(
soundN
);
console
.
log
(
soundN
);
console
.
log
(
Listennotes
[
soundN
]);
console
.
log
(
Listennotes
[
soundN
]);
//this.setState({name : Listennotes[soundN].nam
e});
this
.
setState
({
showMusic
:
tru
e
});
var
playSound
=
new
Sound
(
keySound
[
soundN
].
url
,
(
error
)
=>
{
var
playSound
=
new
Sound
(
keySound
[
soundN
].
url
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
'failed to load the sound'
,
error
);
console
.
log
(
'failed to load the sound'
,
error
);
...
@@ -187,6 +189,7 @@ class Listen extends React.Component {
...
@@ -187,6 +189,7 @@ class Listen extends React.Component {
playSound
.
play
((
success
)
=>
{
playSound
.
play
((
success
)
=>
{
if
(
success
)
{
if
(
success
)
{
// console.log('successfully finished playing');
// console.log('successfully finished playing');
this
.
setState
({
showMusic
:
false
});
}
else
{
}
else
{
// console.log('playback failed due to audio decoding errors');
// console.log('playback failed due to audio decoding errors');
playSound
.
release
();
playSound
.
release
();
...
@@ -279,7 +282,7 @@ class Listen extends React.Component {
...
@@ -279,7 +282,7 @@ class Listen extends React.Component {
this
.
setState
({
this
.
setState
({
maxCount
:
ccc
,
maxCount
:
ccc
,
});
});
indexS
=
Listennotes
.
findIndex
(
item
=>
item
.
name
===
this
.
state
.
name
);
//
indexS = Listennotes.findIndex(item=> item.name === this.state.name);
// console.log(this.state.name);
// console.log(this.state.name);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
...
@@ -325,6 +328,18 @@ class Listen extends React.Component {
...
@@ -325,6 +328,18 @@ class Listen extends React.Component {
source
=
{
require
(
'../media/img/background.jpg'
)}
source
=
{
require
(
'../media/img/background.jpg'
)}
style
=
{
styles
.
imagebackground
}
>
style
=
{
styles
.
imagebackground
}
>
{
/* Play Sound */
}
<
Modal
transparent
=
{
true
}
visible
=
{
this
.
state
.
showMusic
}
animationType
=
"slide"
>
<
View
style
=
{
styles
.
modalbackground
}
>
<
View
style
=
{{
alignItems
:
'center'
,
alignContent
:
'center'
,
marginTop
:
Dimensions
.
get
(
'window'
).
width
*
0.15
}}
>
<
Image
style
=
{{
height
:
100
,
width
:
100
,
backgroundColor
:
'white'
,
borderRadius
:
10
,
borderColor
:
'black'
,
borderWidth
:
5
}}
source
=
{
require
(
'../media/img/hear.gif'
)}
/
>
<
/View
>
<
/View
>
<
/Modal
>
{
/* Modal Quit the Scale*/
}
{
/* Modal Quit the Scale*/
}
<
Modal
transparent
=
{
true
}
visible
=
{
this
.
state
.
showQuit
}
animationType
=
"slide"
>
<
Modal
transparent
=
{
true
}
visible
=
{
this
.
state
.
showQuit
}
animationType
=
"slide"
>
<
View
style
=
{
styles
.
modalbackground
}
>
<
View
style
=
{
styles
.
modalbackground
}
>
...
...
screens/settingListen.js
View file @
30aa22bc
...
@@ -7,14 +7,11 @@ import {
...
@@ -7,14 +7,11 @@ import {
ImageBackground
,
ImageBackground
,
Text
,
Text
,
View
,
View
,
Image
,
ScrollView
,
BackHandler
,
BackHandler
,
Pressable
,
}
from
'react-native'
;
}
from
'react-native'
;
import
styles
from
'../style/styleSettings'
;
import
styles
from
'../style/styleSettings'
;
import
Orientation
from
'react-native-orientation'
;
import
Orientation
from
'react-native-orientation'
;
import
Notes
from
'./data'
;
//
import Notes from './data';
import
*
as
RNFS
from
'react-native-fs'
;
import
*
as
RNFS
from
'react-native-fs'
;
import
NumericInput
from
'react-native-numeric-input'
;
import
NumericInput
from
'react-native-numeric-input'
;
import
AsyncStorage
from
'@react-native-async-storage/async-storage'
;
import
AsyncStorage
from
'@react-native-async-storage/async-storage'
;
...
...
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