Commit 194a1e62 authored by norhalimah's avatar norhalimah

backhandler fixed

parent d794fa83
img/background.jpg

6.75 KB | W: | H:

img/background.jpg

35.6 KB | W: | H:

img/background.jpg
img/background.jpg
img/background.jpg
img/background.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -20,17 +20,18 @@ class Home extends React.PureComponent {
async componentDidMount() {
Orientation.lockToPortrait();
BackHandler.addEventListener('hardwareBackPress', exitApp);
// Orientation.lockAsync(Orientation.OrientationLock.PORTRAIT_UP);
}
componentWillUnmount() {
Orientation.lockToPortrait();
BackHandler.removeEventListener('hardwareBackPress', exitApp);
// Orientation.lockAsync(Orientation.OrientationLock.PORTRAIT_UP);
}
render() {
BackHandler.addEventListener('hardwareBackPress', exitApp);
return (
<View style={styles.container}>
<ImageBackground
......@@ -41,7 +42,7 @@ class Home extends React.PureComponent {
}}>
<SafeAreaView>
<ScrollView>
<View style={{marginTop: '5%', marginBottom: '5%'}}>
<View style={{marginTop: '15%', marginBottom: '5%'}}>
<TouchableOpacity
style={styles.menu}
onPress={() => {
......@@ -87,8 +88,8 @@ const styles = StyleSheet.create({
marginLeft: '3%',
marginRight: '3%',
borderRadius: 10,
borderWidth: 2,
borderColor: 'white',
borderWidth: 5,
borderColor: 'black',
backgroundColor: 'white',
},
});
......@@ -41,16 +41,17 @@ class LogBook extends React.PureComponent {
componentDidMount() {
Orientation.lockToPortrait();
BackHandler.addEventListener('hardwareBackPress', this.homeExit);
this.displayData();
}
homeExit = async () => {
this.props.navigation.navigate('1');
BackHandler.removeEventListener('hardwareBackPress', this.homeExit);
//Orientation.lockToPortrait();
};
render() {
BackHandler.addEventListener('hardwareBackPress', this.homeExit);
return (
<View style={styles.container}>
<ImageBackground
......@@ -69,25 +70,28 @@ class LogBook extends React.PureComponent {
key ={id}
style={{
flexDirection: 'row',
padding: 10,
paddingLeft: 15,
paddingRight: 15,
paddingBottom:10,
paddingTop:5,
backgroundColor: 'white',
borderBottomWidth:1,
}}>
<View style={{alignItems: 'center'}}>
<View style={{marginRight:10, marginBottom:10}}>
<Text style={{color:'black', fontSize: 40}}>{(item.date !== undefined) ? item.date.split(' ')[0].trim() : ''}</Text>
<Text style={{color:'black', fontSize: 15, marginLeft:11}}>{(item.date !== undefined) ? item.date.split(' ')[1].trim() : ''}</Text>
<View style={{alignItems: 'center',marginRight:5}}>
<View>
<Text style={{color:'black', fontSize: 40,textAlign: 'center'}}>{(item.date !== undefined) ? item.date.split(' ')[0].trim() : ''}</Text>
<Text style={{color:'black', fontSize: 15, textAlign: 'center'}}>{(item.date !== undefined) ? item.date.split(' ')[1].trim() : ''}</Text>
</View>
<View style={{marginRight:5}}>
<Text style={{color:'black', fontSize: 15}}>{item.day}</Text>
<View>
<Text style={{color:'black', fontSize: 15, textAlign: 'center'}}>{item.day}</Text>
</View>
</View>
<View style={{borderWidth:1, borderColor : 'blue'}}/>
<View style={{flexDirection: 'column',marginLeft:5,marginTop:5}}>
<Text style={{color:'green', fontSize: 15}}>Correct : {item.correct}</Text>
<Text style={{color:'red', fontSize: 15}}>Wrong : {item.wrong}</Text>
<Text style={{color:'black', fontSize: 15}}>Timer : {item.timer}</Text>
<Text style={{color:'black', fontSize: 15}}>Time : {item.time}</Text>
<View style={{borderWidth:1, borderColor : 'gray'}}/>
<View style={{flexDirection: 'column',marginLeft:5,marginTop:10}}>
<Text style={{color:'green', fontSize: 15}}>Correct:{item.correct}</Text>
<Text style={{color:'red', fontSize: 15}}>Wrong: {item.wrong}</Text>
<Text style={{color:'black', fontSize: 15}}>Timer: {item.timer}</Text>
<Text style={{color:'black', fontSize: 15}}>Time: {item.time}</Text>
</View>
</View>
)).reverse()}
......@@ -105,6 +109,7 @@ const styles = StyleSheet.create({
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#9001f5',
},
menu: {
marginTop: '3%',
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
import React from 'react';
import {
SafeAreaView,
//ImageBackground,
ImageBackground,
Text,
View,
TouchableOpacity,
......@@ -148,10 +148,17 @@ export default class Settings extends React.Component {
});
};
componentWillUnmount() {
Orientation.lockToPortrait();
BackHandler.removeEventListener('hardwareBackPress', this.homeExit);
// Orientation.lockAsync(Orientation.OrientationLock.PORTRAIT_UP);
}
componentDidMount() {
// notes.splice(0, notes.length);
// console.log(notes);
Orientation.lockToPortrait();
BackHandler.addEventListener('hardwareBackPress', this.homeExit);
// console.log(notes.length);
counter = 0;
RNFS.unlink(path1).then(res => {
......@@ -180,14 +187,19 @@ export default class Settings extends React.Component {
};
render() {
BackHandler.addEventListener('hardwareBackPress', this.homeExit);
return (
<View style={styles.container}>
<ImageBackground
source={require('../img/background.jpg')}
style={{
width: '100%',
height: '100%',
}}>
<SafeAreaView>
<View style={{alignItems:'center',marginTop: '15%', marginLeft: config.deviceWidth * 0.08,
marginRight: config.deviceWidth * 0.1, flexDirection: 'row',
flexWrap: 'wrap'}}>
<Text style={{fontSize: 15,marginRight:5}}>No. of Questions : </Text>
<Text style={{fontSize: 16,marginRight:9}}>No. of Questions : </Text>
<NumericInput
value={this.state.value}
minValue={0}
......@@ -213,6 +225,7 @@ export default class Settings extends React.Component {
width: config.deviceWidth,
marginLeft: config.deviceWidth * 0.08,
marginRight: config.deviceWidth * 0.1,
marginBottom: config.deviceHeight * 0.12,
}}>
{Notes.map((item, id) => (
<View key={id}>
......@@ -240,6 +253,7 @@ export default class Settings extends React.Component {
</View>
</ScrollView>
</SafeAreaView>
</ImageBackground>
</View>
);
}
......@@ -256,8 +270,8 @@ const styles = StyleSheet.create({
flex: 1,
width: config.deviceWidth * 0.4,
alignItems: 'center',
borderWidth: 1,
borderColor: 'black',
borderWidth: 3,
borderColor: 'white',
borderRadius: 10,
backgroundColor: 'rgba(52, 52, 52, 0.0)',
//opacity: 0.5,
......@@ -269,7 +283,7 @@ const styles = StyleSheet.create({
flex: 1,
width: config.deviceWidth * 0.4,
alignItems: 'center',
borderWidth: 1,
borderWidth: 3,
borderColor: 'black',
backgroundColor: 'white',
// backgroundColor: 'rgba(0,0,0,0)',
......
/* 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.js';
import {useNavigation} from '@react-navigation/native';
export default class TotalScore extends Component {
constructor(props: Object) {
super(props);
this.state = {
timer: 0,
correct: 0,
wrong: 0,
};
}
componentDidMount() {
this.setState({
correct: this.props.route.params.c,
wrong: this.props.route.params.w,
});
}
componentWillUnmount() {
clearInterval(this.interval);
}
';';
render() {
const {
container,
selectedKeywordStyle,
buttonStyle,
textStyle,
buttonB1,
buttonB2,
buttonB3,
buttonB4,
buttonB5,
SbuttonB1,
SbuttonB2,
SbuttonB3,
SbuttonB4,
SbuttonB5,
} = styles;
return (
<View style={styles.container}>
<View style={styles.c1}>
<View style={styles.boxScore}>
<Text style={{fontSize: 20}}>Total Score </Text>
<Text>Correct :{this.state.correct}</Text>
<Text>Wrong :{this.state.wrong}</Text>
</View>
<Button
title="START AGAIN"
color="#E07EF9"
onPress={() => this.props.navigation.navigate('1')}
/>
</View>
</View>
);
}
}
......@@ -53,46 +53,56 @@ export default StyleSheet.create({
borderWidth: 3,
borderRadius: 10,
position: 'absolute',
marginTop: config.deviceWidth * 0.1,
marginTop: config.deviceWidth * 0.11,
backgroundColor:'white',
},
correct: {
width: 100,
textAlign: 'center',
paddingTop: 15,
color: 'black',
color: 'white',
height: 60,
borderRadius: 10,
alignItems: 'center',
fontSize: 25,
marginRight: 10,
backgroundColor:'green',
borderColor:'white',
borderWidth: 2,
},
wrong: {
width: 100,
height: 60,
borderRadius: 10,
borderColor:'white',
alignItems: 'center',
textAlign: 'center',
paddingTop: 15,
color: 'black',
color: 'white',
fontSize: 25,
marginRight: 10,
backgroundColor:'red',
borderWidth: 2,
},
timer: {
width: 65,
height: 60,
borderRadius: 10,
borderColor:'white',
alignItems: 'center',
textAlign: 'center',
paddingTop: 16,
color: 'white',
fontSize: 25,
backgroundColor:'black',
borderWidth: 2,
},
submit: {
width: '40%',
marginTop: config.deviceWidth * 0.055,
borderColor:'white',
borderWidth: 2,
borderRadius: 5,
},
viewMain: {
width: '20%',
......@@ -115,7 +125,7 @@ export default StyleSheet.create({
marginLeft: config.deviceHeight * 1.0,
},
buttonStyle: {
width: config.deviceWidth * 0.072,
width: config.deviceWidth * 0.075,
alignItems: 'center',
backgroundColor: 'white',
borderRightWidth: 1,
......@@ -123,7 +133,7 @@ export default StyleSheet.create({
borderBottomWidth: 1,
},
selectedKeywordStyle: {
width: config.deviceWidth * 0.072,
width: config.deviceWidth * 0.075,
alignItems: 'center',
backgroundColor: '#EEA1E1',
borderRightWidth: 1,
......@@ -133,25 +143,25 @@ export default StyleSheet.create({
buttonB1: {
alignItems: 'center',
backgroundColor: 'black',
height: '65%',
marginLeft: config.deviceWidth * 0.047,
height: '55%',
marginLeft: config.deviceWidth * 0.048,
width: '5%',
position: 'absolute',
},
buttonB2: {
alignItems: 'center',
backgroundColor: 'black',
height: '65%',
height: '55%',
width: '5%',
marginLeft: config.deviceWidth * 0.119,
marginLeft: config.deviceWidth * 0.123,
position: 'absolute',
},
buttonB3: {
alignItems: 'center',
backgroundColor: 'black',
height: '65%',
height: '55%',
width: '5%',
marginLeft: config.deviceWidth * 0.26,
marginLeft: config.deviceWidth * 0.275,
position: 'absolute',
},
......@@ -159,81 +169,81 @@ export default StyleSheet.create({
alignItems: 'center',
backgroundColor: 'black',
width: '5%',
height: '65%',
marginLeft: config.deviceWidth * 0.335,
height: '55%',
marginLeft: config.deviceWidth * 0.348,
position: 'absolute',
},
buttonB5: {
alignItems: 'center',
backgroundColor: 'black',
width: '5%',
height: '65%',
height: '55%',
marginBottom: 10,
marginLeft: config.deviceWidth * 0.406,
marginLeft: config.deviceWidth * 0.423,
position: 'absolute',
},
SbuttonB1: {
alignItems: 'center',
backgroundColor: 'blue',
height: '65%',
marginLeft: config.deviceWidth * 0.047,
backgroundColor: '#92ddea',
height: '55%',
marginLeft: config.deviceWidth * 0.048,
width: '5%',
position: 'absolute',
},
SbuttonB2: {
alignItems: 'center',
backgroundColor: 'blue',
height: '65%',
backgroundColor: '#92ddea',
height: '55%',
width: '5%',
marginLeft: config.deviceWidth * 0.119,
marginLeft: config.deviceWidth * 0.123,
position: 'absolute',
},
SbuttonB3: {
alignItems: 'center',
backgroundColor: 'blue',
height: '65%',
backgroundColor: '#92ddea',
height: '55%',
width: '5%',
marginLeft: config.deviceWidth * 0.26,
marginLeft: config.deviceWidth * 0.275,
position: 'absolute',
},
SbuttonB4: {
alignItems: 'center',
backgroundColor: 'blue',
backgroundColor: '#92ddea',
width: '5%',
height: '65%',
marginLeft: config.deviceWidth * 0.335,
height: '55%',
marginLeft: config.deviceWidth * 0.348,
position: 'absolute',
},
SbuttonB5: {
alignItems: 'center',
backgroundColor: 'blue',
backgroundColor: '#92ddea',
width: '5%',
height: '65%',
marginLeft: config.deviceWidth * 0.406,
height: '55%',
marginLeft: config.deviceWidth * 0.423,
position: 'absolute',
},
buttonB11: {
alignItems: 'center',
backgroundColor: 'black',
height: '65%',
marginLeft: config.deviceWidth * 0.55,
height: '55%',
marginLeft: config.deviceWidth * 0.575,
width: '5%',
position: 'absolute',
},
buttonB21: {
alignItems: 'center',
backgroundColor: 'black',
height: '65%',
marginLeft: config.deviceWidth * 0.623,
height: '55%',
marginLeft: config.deviceWidth * 0.65,
width: '5%',
position: 'absolute',
},
buttonB31: {
alignItems: 'center',
backgroundColor: 'black',
height: '65%',
marginLeft: config.deviceWidth * 0.767,
height: '55%',
marginLeft: config.deviceWidth * 0.798,
width: '5%',
position: 'absolute',
},
......@@ -242,57 +252,57 @@ export default StyleSheet.create({
alignItems: 'center',
backgroundColor: 'black',
width: '5%',
height: '65%',
marginLeft: config.deviceWidth * 0.839,
height: '55%',
marginLeft: config.deviceWidth * 0.872,
position: 'absolute',
},
buttonB51: {
alignItems: 'center',
backgroundColor: 'black',
width: '5%',
height: '65%',
height: '55%',
marginBottom: 10,
marginLeft: config.deviceWidth * 0.91,
marginLeft: config.deviceWidth * 0.95,
position: 'absolute',
},
SbuttonB11: {
alignItems: 'center',
backgroundColor: 'blue',
height: '65%',
marginLeft: config.deviceWidth * 0.55,
backgroundColor: '#92ddea',
height: '55%',
marginLeft: config.deviceWidth * 0.575,
width: '5%',
position: 'absolute',
},
SbuttonB21: {
alignItems: 'center',
backgroundColor: 'blue',
height: '65%',
marginLeft: config.deviceWidth * 0.623,
backgroundColor: '#92ddea',
height: '55%',
marginLeft: config.deviceWidth * 0.65,
width: '5%',
position: 'absolute',
},
SbuttonB31: {
alignItems: 'center',
backgroundColor: 'blue',
height: '65%',
marginLeft: config.deviceWidth * 0.767,
backgroundColor: '#92ddea',
height: '55%',
marginLeft: config.deviceWidth * 0.798,
width: '5%',
position: 'absolute',
},
SbuttonB41: {
alignItems: 'center',
backgroundColor: 'blue',
backgroundColor: '#92ddea',
width: '5%',
height: '65%',
marginLeft: config.deviceWidth * 0.839,
height: '55%',
marginLeft: config.deviceWidth * 0.872,
position: 'absolute',
},
SbuttonB51: {
alignItems: 'center',
backgroundColor: 'blue',
backgroundColor: '#92ddea',
width: '5%',
height: '65%',
marginLeft: config.deviceWidth * 0.91,
height: '55%',
marginLeft: config.deviceWidth * 0.95,
position: 'absolute',
},
boxScore: {
......
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