Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
a67bfda4
Commit
a67bfda4
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Handle back button presses
parent
86f26e38
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app.js
+15
-1
15 additions, 1 deletion
app.js
components/calendar.js
+0
-2
0 additions, 2 deletions
components/calendar.js
components/cycle-day/symptoms/index.js
+15
-4
15 additions, 4 deletions
components/cycle-day/symptoms/index.js
with
30 additions
and
7 deletions
app.js
+
15
−
1
View file @
a67bfda4
import
React
,
{
Component
}
from
'
react
'
import
React
,
{
Component
}
from
'
react
'
import
{
View
}
from
'
react-native
'
import
{
View
,
BackHandler
}
from
'
react-native
'
import
Header
from
'
./components/header
'
import
Header
from
'
./components/header
'
import
Menu
from
'
./components/menu
'
import
Menu
from
'
./components/menu
'
import
Home
from
'
./components/home
'
import
Home
from
'
./components/home
'
...
@@ -21,6 +21,20 @@ export default class App extends Component {
...
@@ -21,6 +21,20 @@ export default class App extends Component {
this
.
state
=
{
this
.
state
=
{
currentPage
:
'
Home
'
currentPage
:
'
Home
'
}
}
const
handleBackButtonPress
=
function
()
{
if
(
this
.
state
.
currentPage
===
'
Home
'
)
return
false
// this is handled in the SymptomView
if
(
this
.
state
.
currentPage
===
'
SymptomView
'
)
return
true
this
.
navigate
(
'
Home
'
)
return
true
}.
bind
(
this
)
this
.
backHandler
=
BackHandler
.
addEventListener
(
'
hardwareBackPress
'
,
handleBackButtonPress
)
}
componentWillUnmount
()
{
this
.
backHandler
.
remove
()
}
}
navigate
(
pageName
,
props
)
{
navigate
(
pageName
,
props
)
{
...
...
This diff is collapsed.
Click to expand it.
components/calendar.js
+
0
−
2
View file @
a67bfda4
...
@@ -10,7 +10,6 @@ export default class CalendarView extends Component {
...
@@ -10,7 +10,6 @@ export default class CalendarView extends Component {
this
.
state
=
{
this
.
state
=
{
bleedingDaysInCalFormat
:
toCalFormat
(
bleedingDaysSortedByDate
)
bleedingDaysInCalFormat
:
toCalFormat
(
bleedingDaysSortedByDate
)
}
}
console
.
log
(
Object
.
keys
(
this
.
state
.
bleedingDaysInCalFormat
))
this
.
setStateWithCalFormattedDays
=
(
function
(
CalendarComponent
)
{
this
.
setStateWithCalFormattedDays
=
(
function
(
CalendarComponent
)
{
return
function
(
_
,
changes
)
{
return
function
(
_
,
changes
)
{
...
@@ -35,7 +34,6 @@ export default class CalendarView extends Component {
...
@@ -35,7 +34,6 @@ export default class CalendarView extends Component {
}
}
render
()
{
render
()
{
console
.
log
(
'
cal render
'
)
return
(
return
(
<
View
>
<
View
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
...
...
This diff is collapsed.
Click to expand it.
components/cycle-day/symptoms/index.js
+
15
−
4
View file @
a67bfda4
import
React
,
{
Component
}
from
'
react
'
import
React
,
{
Component
}
from
'
react
'
import
{
ScrollView
}
from
'
react-native
'
import
{
ScrollView
,
BackHandler
}
from
'
react-native
'
import
Header
from
'
../../header
'
import
Header
from
'
../../header
'
import
actionButtonModule
from
'
../action-buttons
'
import
actionButtonModule
from
'
../action-buttons
'
import
BleedingEditView
from
'
./bleeding
'
import
BleedingEditView
from
'
./bleeding
'
...
@@ -34,13 +34,24 @@ export default class SymptomView extends Component {
...
@@ -34,13 +34,24 @@ export default class SymptomView extends Component {
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
visibleComponent
:
props
.
navigation
.
state
.
params
.
symptom
,
visibleComponent
:
props
.
symptom
,
cycleDay
:
props
.
navigation
.
state
.
params
.
cycleDay
cycleDay
:
props
.
cycleDay
}
}
this
.
makeActionButtons
=
actionButtonModule
(()
=>
{
this
.
makeActionButtons
=
actionButtonModule
(()
=>
{
this
.
props
.
navigation
.
navigate
(
'
CycleDay
'
,
{
cycleDay
:
this
.
state
.
cycleDay
})
this
.
props
.
navigate
(
'
CycleDay
'
,
{
cycleDay
:
this
.
state
.
cycleDay
})
})
})
const
handleBackButtonPress
=
function
()
{
this
.
props
.
navigate
(
'
CycleDay
'
,
{
cycleDay
:
this
.
state
.
cycleDay
})
return
true
}.
bind
(
this
)
this
.
backHandler
=
BackHandler
.
addEventListener
(
'
hardwareBackPress
'
,
handleBackButtonPress
)
}
componentWillUnmount
()
{
this
.
backHandler
.
remove
()
}
}
render
()
{
render
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment