Commit 30aa22bc authored by norhalimah's avatar norhalimah

updating ...

parent d9d76629
...@@ -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].name}); this.setState({showMusic: true});
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}>
......
...@@ -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';
......
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