Remove navigate from temperature component
This commit is contained in:
+6
-13
@@ -7,17 +7,13 @@ import {
|
|||||||
Switch
|
Switch
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
|
|
||||||
import styles from './styles'
|
|
||||||
import { saveTemperature, getPreviousTemperature } from './db'
|
import { saveTemperature, getPreviousTemperature } from './db'
|
||||||
import { formatDateForViewHeader } from './format'
|
|
||||||
import cycleDayModule from './get-cycle-day-number'
|
|
||||||
|
|
||||||
const getCycleDayNumber = cycleDayModule()
|
|
||||||
|
|
||||||
export default class Temp extends Component {
|
export default class Temp extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.cycleDay = props.navigation.state.params.cycleDay
|
this.cycleDay = props.cycleDay
|
||||||
|
this.bringIntoView = props.bringIntoView
|
||||||
let initialValue
|
let initialValue
|
||||||
|
|
||||||
if(this.cycleDay.temperature) {
|
if(this.cycleDay.temperature) {
|
||||||
@@ -34,12 +30,9 @@ export default class Temp extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const navigate = this.props.navigation.navigate
|
|
||||||
const cycleDay = this.cycleDay
|
const cycleDay = this.cycleDay
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View>
|
||||||
<Text style={styles.welcome}>{formatDateForViewHeader(cycleDay.date)}</Text>
|
|
||||||
<Text>Cycle day {getCycleDayNumber()}</Text>
|
|
||||||
<Text>Temperature</Text>
|
<Text>Temperature</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder="Enter temperature"
|
placeholder="Enter temperature"
|
||||||
@@ -58,14 +51,14 @@ export default class Temp extends Component {
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigate('dayView', { cycleDay })
|
this.bringIntoView('dayView')
|
||||||
}}
|
}}
|
||||||
title="Cancel">
|
title="Cancel">
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
saveTemperature(cycleDay)
|
saveTemperature(cycleDay)
|
||||||
navigate('dayView', { cycleDay })
|
this.bringIntoView('dayView')
|
||||||
}}
|
}}
|
||||||
title="Delete entry">
|
title="Delete entry">
|
||||||
</Button>
|
</Button>
|
||||||
@@ -75,7 +68,7 @@ export default class Temp extends Component {
|
|||||||
value: Number(this.state.currentValue),
|
value: Number(this.state.currentValue),
|
||||||
exclude: this.state.exclude
|
exclude: this.state.exclude
|
||||||
})
|
})
|
||||||
navigate('dayView', { cycleDay })
|
this.bringIntoView('dayView')
|
||||||
}}
|
}}
|
||||||
disabled={ this.state.currentValue === '' }
|
disabled={ this.state.currentValue === '' }
|
||||||
title="Save">
|
title="Save">
|
||||||
|
|||||||
Reference in New Issue
Block a user