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
a7549814
Commit
a7549814
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Start replacing navigator
parent
51629f67
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
app.js
+31
-19
31 additions, 19 deletions
app.js
components/calendar.js
+4
-3
4 additions, 3 deletions
components/calendar.js
components/home.js
+0
-1
0 additions, 1 deletion
components/home.js
components/menu.js
+33
-0
33 additions, 0 deletions
components/menu.js
styles/index.js
+7
-0
7 additions, 0 deletions
styles/index.js
with
75 additions
and
23 deletions
app.js
+
31
−
19
View file @
a7549814
import
{
createStackNavigator
,
createBottomTabNavigator
}
from
'
react-navigation
'
import
React
,
{
Component
}
from
'
react
'
import
{
View
}
from
'
react-native
'
import
Header
from
'
./components/header
'
import
Menu
from
'
./components/menu
'
import
Home
from
'
./components/home
'
import
Calendar
from
'
./components/calendar
'
import
CycleDay
from
'
./components/cycle-day/cycle-day-overview
'
import
SymptomView
from
'
./components/cycle-day/symptoms
'
...
...
@@ -8,30 +10,40 @@ import Chart from './components/chart/chart'
import
Settings
from
'
./components/settings
'
import
Stats
from
'
./components/stats
'
import
styles
,
{
primaryColor
}
from
'
./styles
'
// this is until react native fixes this bugg, see
// https://github.com/facebook/react-native/issues/18868#issuecomment-382671739
import
{
YellowBox
}
from
'
react-native
'
YellowBox
.
ignoreWarnings
([
'
Warning: isMounted(...) is deprecated
'
])
const
CycleDayStack
=
createStackNavigator
({
CycleDay
,
SymptomView
},
{
headerMode
:
'
none
'
})
export
default
class
App
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
currentPage
:
'
Home
'
}
}
const
routes
=
{
Home
:
createStackNavigator
({
Home
,
CycleDayStack
},
{
headerMode
:
'
none
'
}),
Calendar
:
createStackNavigator
({
Calendar
,
CycleDayStack
},
{
headerMode
:
'
none
'
}),
Chart
:
createStackNavigator
({
Chart
,
CycleDay
},
{
headerMode
:
'
none
'
}),
Settings
:
{
screen
:
Settings
},
Stats
:
{
screen
:
Stats
}
}
navigate
(
pageName
)
{
this
.
setState
({
currentPage
:
pageName
})
}
const
config
=
{
labeled
:
true
,
shifting
:
false
,
tabBarOptions
:
{
style
:
{
backgroundColor
:
primaryColor
},
labelStyle
:
styles
.
menuLabel
render
()
{
return
(
<
View
>
<
Header
title
=
{
this
.
state
.
currentPage
}
/
>
<
CurrentPage
page
=
{
this
.
state
.
currentPage
}
/
>
<
Menu
navigate
=
{
this
.
navigate
.
bind
(
this
)}
/
>
<
/View
>
)
}
}
export
default
createBottomTabNavigator
(
routes
,
config
)
\ No newline at end of file
class
CurrentPage
extends
Component
{
render
()
{
console
.
log
(
'
urrentpage render
'
)
const
page
=
{
Home
,
Calendar
,
CycleDay
,
SymptomView
,
Chart
,
Settings
,
Stats
}[
this
.
props
.
page
]
return
React
.
createElement
(
page
)
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
components/calendar.js
+
4
−
3
View file @
a7549814
import
React
,
{
Component
}
from
'
react
'
import
{
View
}
from
'
react-native
'
import
{
CalendarList
}
from
'
react-native-calendars
'
import
Header
from
'
./header
'
import
*
as
styles
from
'
../styles
'
import
{
getOrCreateCycleDay
,
bleedingDaysSortedByDate
}
from
'
../db
'
...
...
@@ -11,9 +10,11 @@ export default class CalendarView extends Component {
this
.
state
=
{
bleedingDaysInCalFormat
:
toCalFormat
(
bleedingDaysSortedByDate
)
}
console
.
log
(
Object
.
keys
(
this
.
state
.
bleedingDaysInCalFormat
))
this
.
setStateWithCalFormattedDays
=
(
function
(
CalendarComponent
)
{
return
function
()
{
return
function
(
_
,
changes
)
{
if
(
Object
.
values
(
changes
).
every
(
x
=>
x
&&
!
x
.
length
))
return
CalendarComponent
.
setState
({
bleedingDaysInCalFormat
:
toCalFormat
(
bleedingDaysSortedByDate
)
})
...
...
@@ -34,9 +35,9 @@ export default class CalendarView extends Component {
}
render
()
{
console
.
log
(
'
cal render
'
)
return
(
<
View
>
<
Header
title
=
'
Calendar
'
/>
<
View
style
=
{
styles
.
container
}
>
<
CalendarList
onDayPress
=
{
this
.
passDateToDayView
.
bind
(
this
)}
...
...
This diff is collapsed.
Click to expand it.
components/home.js
+
0
−
1
View file @
a7549814
...
...
@@ -49,7 +49,6 @@ export default class Home extends Component {
render
()
{
return
(
<
ScrollView
>
<
Header
title
=
'
Home
'
/>
<
Text
style
=
{
styles
.
welcome
}
>
{
this
.
state
.
welcomeText
}
<
/Text
>
<
View
style
=
{
styles
.
homeButtons
}
>
<
View
style
=
{
styles
.
homeButton
}
>
...
...
This diff is collapsed.
Click to expand it.
components/menu.js
0 → 100644
+
33
−
0
View file @
a7549814
import
React
,
{
Component
}
from
'
react
'
import
{
View
,
Text
}
from
'
react-native
'
import
styles
,
{
iconStyles
}
from
'
../styles
'
import
Icon
from
'
react-native-vector-icons/MaterialCommunityIcons
'
export
default
class
Menu
extends
Component
{
render
()
{
return
(
this
.
props
.
symptomView
?
placeActionButtons
()
:
<
View
style
=
{
styles
.
menu
}
>
<
Text
style
=
{
styles
.
dateHeader
}
onPress
=
{()
=>
this
.
props
.
navigate
(
'
Calendar
'
)}
>
{
'
Calendar
'
}
<
/Text
>
<
Text
style
=
{
styles
.
dateHeader
}
onPress
=
{()
=>
this
.
props
.
navigate
(
'
Settings
'
)}
>
{
'
Settings
'
}
<
/Text
>
<
/View
>
)
}
}
function
placeActionButtons
()
{}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
styles/index.js
+
7
−
0
View file @
a7549814
...
...
@@ -82,6 +82,13 @@ export default StyleSheet.create({
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
},
menu
:
{
backgroundColor
:
primaryColor
,
paddingVertical
:
18
,
paddingHorizontal
:
15
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
},
headerCycleDay
:
{
flexDirection
:
'
row
'
,
justifyContent
:
'
space-between
'
...
...
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