Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
pill_minder
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
Phuengton Chummuel
pill_minder
Commits
3f2f06d2
Commit
3f2f06d2
authored
Mar 22, 2018
by
Phuengton Chummuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change ui in component
parent
c7d2068c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
51 deletions
+140
-51
AppointmentList.js
src/components/AppointmentList.js
+2
-2
AppointmentListItem.js
src/components/AppointmentListItem.js
+3
-3
ReminderBoxList.js
src/components/ReminderBoxList.js
+50
-0
ReminderList.js
src/components/ReminderList.js
+51
-46
ReminderListItem.js
src/components/ReminderListItem.js
+34
-0
No files found.
src/components/AppointmentList.js
View file @
3f2f06d2
...
@@ -3,7 +3,7 @@ import { ListView } from 'react-native';
...
@@ -3,7 +3,7 @@ import { ListView } from 'react-native';
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
View
}
from
'native-base'
;
import
{
View
}
from
'native-base'
;
import
{
appointmentFetch
,
appointmentDelete
}
from
'./../actions'
import
{
appointmentFetch
,
appointmentDelete
}
from
'./../actions'
import
ListItem
from
'./../components/
ListItem'
import
AppointmentListItem
from
'./../components/Appointment
ListItem'
import
realm
from
'./../Database'
import
realm
from
'./../Database'
...
@@ -31,7 +31,7 @@ class AppointmentList extends Component {
...
@@ -31,7 +31,7 @@ class AppointmentList extends Component {
renderRow
({
id
,
doctorName
,
date
,
time
,
place
})
{
renderRow
({
id
,
doctorName
,
date
,
time
,
place
})
{
let
appointment
=
{
id
,
doctorName
,
date
:
date
.
toString
(),
time
,
place
}
let
appointment
=
{
id
,
doctorName
,
date
:
date
.
toString
(),
time
,
place
}
return
<
ListItem
data
=
{
appointment
}
/
>
return
<
Appointment
ListItem
data
=
{
appointment
}
/
>
}
}
render
()
{
render
()
{
...
...
src/components/ListItem.js
→
src/components/
Appointment
ListItem.js
View file @
3f2f06d2
...
@@ -5,7 +5,7 @@ import { appointmentDelete } from './../actions'
...
@@ -5,7 +5,7 @@ import { appointmentDelete } from './../actions'
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
class
ListItem
extends
Component
{
class
Appointment
ListItem
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
...
@@ -29,4 +29,4 @@ class ListItem extends Component {
...
@@ -29,4 +29,4 @@ class ListItem extends Component {
}
}
}
}
export
default
connect
(
null
,
{
appointmentDelete
})(
ListItem
);
export
default
connect
(
null
,
{
appointmentDelete
})(
AppointmentListItem
);
\ No newline at end of file
\ No newline at end of file
src/components/ReminderBoxList.js
0 → 100644
View file @
3f2f06d2
import
React
from
'react'
;
import
{
ToastAndroid
}
from
'react-native'
;
import
{
View
,
Text
,
List
,
ListItem
,
}
from
'native-base'
;
class
ReminderBoxList
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
}
render
()
{
const
{
containerStyle
}
=
styles
return
(
<
View
>
<
Text
>
{
this
.
props
.
periodText
}
<
/Text
>
<
View
style
=
{
containerStyle
}
>
<
List
dataArray
=
{
this
.
props
.
items
}
renderRow
=
{(
item
)
=>
<
ListItem
>
<
Text
>
{
item
.
medName
}
<
/Text
>
<
/ListItem
>
}
>
<
/List
>
<
/View
>
<
/View
>
)
}
}
const
styles
=
{
containerStyle
:
{
flex
:
1
,
height
:
200
,
backgroundColor
:
'white'
,
borderWidth
:
5
,
borderRadius
:
2
,
borderColor
:
'#1686C4'
,
borderBottomWidth
:
0
,
elevation
:
1
,
}
}
export
default
ReminderBoxList
;
\ No newline at end of file
src/components/ReminderList.js
View file @
3f2f06d2
import
React
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
{
ToastAndroid
}
from
'react-native'
;
import
{
ListView
}
from
'react-native'
;
import
{
import
{
connect
}
from
'react-redux'
;
View
,
import
{
View
}
from
'native-base'
;
Text
,
import
{
reminderFetch
,
reminderDelete
}
from
'./../actions'
;
List
,
import
ReminderListItem
from
'./../components/ReminderListItem'
;
ListItem
,
import
realm
from
'./../Database'
;
}
from
'native-base'
;
class
ReminderList
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
}
render
()
{
const
{
containerStyle
}
=
styles
return
(
<
View
>
<
Text
>
{
this
.
props
.
periodText
}
<
/Text
>
<
View
style
=
{
containerStyle
}
>
<
List
dataArray
=
{
this
.
props
.
items
}
renderRow
=
{(
item
)
=>
<
ListItem
>
<
Text
>
{
item
.
medName
}
<
/Text
>
<
/ListItem
>
}
>
<
/List
>
<
/View
>
<
/View
>
)
}
}
class
ReminderList
extends
Component
{
componentWillMount
()
{
this
.
props
.
reminderFetch
()
this
.
createDataSource
(
this
.
props
)
}
componentWillReceiveProps
(
nextProps
)
{
// nextProps are the next set of props that this component
// will be rendered with
// this.props is still the old set of props
this
.
createDataSource
(
nextProps
);
}
createDataSource
({
reminders
})
{
const
ds
=
new
ListView
.
DataSource
({
rowHasChanged
:
(
r1
,
r2
)
=>
r1
!==
r2
});
this
.
dataSource
=
ds
.
cloneWithRows
(
reminders
.
reminders
);
}
renderRow
({
id
,
medName
,
reminderTime
,
meal
,
period
,
dose
})
{
let
reminder
=
{
id
,
medName
,
reminderTime
:
reminderTime
.
toString
(),
meal
,
period
,
dose
}
return
<
ReminderListItem
data
=
{
reminder
}
/
>
}
render
()
{
return
(
<
View
>
<
ListView
enableEmptySections
dataSource
=
{
this
.
dataSource
}
renderRow
=
{
this
.
renderRow
}
/
>
<
/View
>
)
}
const
styles
=
{
containerStyle
:
{
flex
:
1
,
height
:
200
,
backgroundColor
:
'white'
,
borderWidth
:
5
,
borderRadius
:
2
,
borderColor
:
'#1686C4'
,
borderBottomWidth
:
0
,
elevation
:
1
,
}
}
}
export
default
ReminderList
const
mapStateToProps
=
state
=>
{
\ No newline at end of file
return
{
reminders
:
state
.
reminders
}
};
export
default
connect
(
mapStateToProps
,
{
reminderFetch
,
reminderDelete
})(
ReminderList
);
\ No newline at end of file
src/components/ReminderListItem.js
0 → 100644
View file @
3f2f06d2
import
React
,
{
Component
}
from
'react'
;
import
{
TouchableOpacity
}
from
'react-native'
;
import
{
View
,
Text
}
from
'native-base'
;
import
{
reminderDelete
}
from
'./../actions'
import
{
connect
}
from
'react-redux'
;
import
moment
from
'moment'
;
class
ReminderListItem
extends
Component
{
constructor
(
props
)
{
super
(
props
)
}
deleteAppointment
(
id
)
{
this
.
props
.
reminderDelete
(
id
)
}
render
()
{
return
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
deleteAppointment
(
this
.
props
.
data
.
id
)}
>
<
View
>
<
Text
>
{
this
.
props
.
data
.
medName
}
<
/Text
>
<
Text
>
{
this
.
props
.
data
.
reminderTime
}
<
/Text
>
<
Text
>
{
this
.
props
.
data
.
meal
}
<
/Text
>
<
Text
>
{
this
.
props
.
data
.
period
}
<
/Text
>
<
Text
>
{
this
.
props
.
data
.
dose
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
)
}
}
export
default
connect
(
null
,
{
reminderDelete
})(
ReminderListItem
);
\ No newline at end of file
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