Merge branch 'date-picker-page' into 'master'
Date picker page See merge request bloodyhealth/drip!2
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"plugins": [
|
||||
"react"
|
||||
@@ -45,6 +46,7 @@
|
||||
],
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
"no-trailing-spaces": "error"
|
||||
"no-trailing-spaces": "error",
|
||||
"react/prop-types": ["error", {"ignore": ["navigation"]}]
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
import styles from './styles'
|
||||
import { createStackNavigator } from 'react-navigation'
|
||||
import temperatureList from './List'
|
||||
import datepicker from './datepicker'
|
||||
|
||||
class home extends Component {
|
||||
constructor(props) {
|
||||
@@ -23,7 +24,7 @@ class home extends Component {
|
||||
title="Edit symptoms for today">
|
||||
</Button>
|
||||
<Button
|
||||
onPress={() => {}}
|
||||
onPress={() => navigate('datepicker')}
|
||||
title="Go to calendar">
|
||||
</Button>
|
||||
</View>
|
||||
@@ -33,5 +34,6 @@ class home extends Component {
|
||||
|
||||
export default createStackNavigator({
|
||||
home: { screen: home },
|
||||
temperatureList: { screen: temperatureList }
|
||||
temperatureList: { screen: temperatureList },
|
||||
datepicker: { screen: datepicker }
|
||||
})
|
||||
@@ -0,0 +1,35 @@
|
||||
import React, { Component } from 'react'
|
||||
import {
|
||||
View, Button, DatePickerAndroid
|
||||
} from 'react-native'
|
||||
import moment from 'moment'
|
||||
import * as styles from './styles'
|
||||
|
||||
export default class datePickView extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
async pickDate() {
|
||||
const result = await DatePickerAndroid.open({
|
||||
date: new Date()
|
||||
})
|
||||
if (result.action !== DatePickerAndroid.dismissedAction) {
|
||||
const navigate = this.props.navigation.navigate
|
||||
// continue here and actually make that view
|
||||
navigate(
|
||||
'dayView',
|
||||
{ date: moment(new Date(result.year, result.month, result.day)) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button onPress={ this.pickDate.bind(this) } title="pick a date" />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+10
@@ -4878,6 +4878,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.22.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.22.1.tgz",
|
||||
"integrity": "sha512-shJkRTSebXvsVqk56I+lkb2latjBs8I+pc2TzWc545y2iFnSjm7Wg0QMh+ZWcdSLQyGEau5jI8ocnmkyTgr9YQ=="
|
||||
},
|
||||
"morgan": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.0.tgz",
|
||||
@@ -5656,6 +5661,11 @@
|
||||
"yargs": "^9.0.0"
|
||||
}
|
||||
},
|
||||
"react-native-datepicker-dialog": {
|
||||
"version": "0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/react-native-datepicker-dialog/-/react-native-datepicker-dialog-0.0.9.tgz",
|
||||
"integrity": "sha1-bh+JCptAk3zqngx2L9VCr7n8Pzc="
|
||||
},
|
||||
"react-native-dismiss-keyboard": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-dismiss-keyboard/-/react-native-dismiss-keyboard-1.0.0.tgz",
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"lint": "eslint app test"
|
||||
},
|
||||
"dependencies": {
|
||||
"moment": "^2.22.1",
|
||||
"react": "16.3.1",
|
||||
"react-native": "0.55.4",
|
||||
"react-native-local-mongodb": "^2.1.0",
|
||||
|
||||
Reference in New Issue
Block a user