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
d794fa83
Commit
d794fa83
authored
Jan 15, 2021
by
norhalimah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backhandler fixed
parent
58a0fc00
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
6 deletions
+25
-6
App.js
App.js
+1
-1
home.js
screens/home.js
+4
-0
logbook.js
screens/logbook.js
+6
-0
quiz.js
screens/quiz.js
+6
-5
settings.js
screens/settings.js
+8
-0
No files found.
App.js
View file @
d794fa83
...
...
@@ -17,7 +17,7 @@ class App extends React.PureComponent {
componentDidMount
()
{
Orientation
.
lockToPortrait
();
}
componentDidUpdate
(){
componentDidUpdate
()
{
Orientation
.
lockToPortrait
();
}
...
...
screens/home.js
View file @
d794fa83
...
...
@@ -10,9 +10,11 @@ import {
StyleSheet
,
ScrollView
,
Image
,
BackHandler
,
}
from
'react-native'
;
import
{
Icon
}
from
'react-native-elements'
;
import
Orientation
from
'react-native-orientation'
;
const
exitApp
=
()
=>
BackHandler
.
exitApp
();
class
Home
extends
React
.
PureComponent
{
...
...
@@ -26,7 +28,9 @@ class Home extends React.PureComponent {
// Orientation.lockAsync(Orientation.OrientationLock.PORTRAIT_UP);
}
render
()
{
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
exitApp
);
return
(
<
View
style
=
{
styles
.
container
}
>
<
ImageBackground
...
...
screens/logbook.js
View file @
d794fa83
...
...
@@ -10,6 +10,7 @@ import {
StyleSheet
,
ScrollView
,
// Alert,
BackHandler
,
}
from
'react-native'
;
import
AsyncStorage
from
'@react-native-async-storage/async-storage'
;
import
Orientation
from
'react-native-orientation'
;
...
...
@@ -43,8 +44,13 @@ class LogBook extends React.PureComponent {
this
.
displayData
();
}
homeExit
=
async
()
=>
{
this
.
props
.
navigation
.
navigate
(
'1'
);
//Orientation.lockToPortrait();
};
render
()
{
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
homeExit
);
return
(
<
View
style
=
{
styles
.
container
}
>
<
ImageBackground
...
...
screens/quiz.js
View file @
d794fa83
...
...
@@ -599,9 +599,9 @@ class Quiz extends React.Component {
}
};
homeExit
=
()
=>
{
homeExit
=
async
()
=>
{
// this.props.navigation.navigate('1');
Alert
.
alert
(
'Hold on!'
,
'Are you sure you want to
stop
?'
,
[
Alert
.
alert
(
'Hold on!'
,
'Are you sure you want to
exit
?'
,
[
{
text
:
'Cancel'
,
onPress
:
()
=>
null
,
...
...
@@ -617,16 +617,16 @@ class Quiz extends React.Component {
Orientation
.
lockToPortrait
();
};
async
componentDidMount
()
{
componentDidMount
()
{
//this.removeArray();
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
homeExit
);
//
BackHandler.addEventListener('hardwareBackPress', this.homeExit);
Orientation
.
lockToLandscape
();
this
.
displayData
();
}
componentWillUnmount
()
{
this
.
removeArray
();
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
homeExit
);
//
BackHandler.addEventListener('hardwareBackPress', this.homeExit);
//clearInterval(this.interval);
// Orientation.lockToLandscape();
}
...
...
@@ -752,6 +752,7 @@ this.setState({records: []});
};
render
()
{
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
homeExit
);
const
{
selectedKeywordStyle
,
buttonStyle
,
...
...
screens/settings.js
View file @
d794fa83
...
...
@@ -12,6 +12,7 @@ import {
ScrollView
,
Dimensions
,
// TextInput,
BackHandler
,
}
from
'react-native'
;
import
Orientation
from
'react-native-orientation'
;
import
Notes
from
'./data'
;
...
...
@@ -172,7 +173,14 @@ export default class Settings extends React.Component {
}
}
homeExit
=
async
()
=>
{
this
.
props
.
navigation
.
navigate
(
'1'
);
//Orientation.lockToPortrait();
};
render
()
{
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
homeExit
);
return
(
<
View
style
=
{
styles
.
container
}
>
<
SafeAreaView
>
...
...
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