Rename showView callback
This commit is contained in:
+4
-4
@@ -14,7 +14,7 @@ export default class Bleeding extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.cycleDay = props.cycleDay
|
||||
this.bringIntoView = props.bringIntoView
|
||||
this.showView = props.bringIntoView
|
||||
let bleedingValue = this.cycleDay.bleeding && this.cycleDay.bleeding.value
|
||||
if (! (typeof bleedingValue === 'number') ){
|
||||
bleedingValue = -1
|
||||
@@ -51,13 +51,13 @@ export default class Bleeding extends Component {
|
||||
}}
|
||||
value={this.state.exclude} />
|
||||
<Button
|
||||
onPress={() => this.bringIntoView('dayView')}
|
||||
onPress={() => this.showView('dayView')}
|
||||
title="Cancel">
|
||||
</Button>
|
||||
<Button
|
||||
onPress={() => {
|
||||
saveBleeding(this.cycleDay)
|
||||
this.bringIntoView('dayView')
|
||||
this.showView('dayView')
|
||||
}}
|
||||
title="Delete entry">
|
||||
</Button>
|
||||
@@ -67,7 +67,7 @@ export default class Bleeding extends Component {
|
||||
value: this.state.currentValue,
|
||||
exclude: this.state.exclude
|
||||
})
|
||||
this.bringIntoView('dayView')
|
||||
this.showView('dayView')
|
||||
}}
|
||||
disabled={ this.state.currentValue === -1 }
|
||||
title="Save">
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class DayView extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.cycleDay = props.cycleDay
|
||||
this.bringIntoView = props.bringIntoView
|
||||
this.showView = props.bringIntoView
|
||||
bleedingDaysSortedByDate.addListener(setStateWithCurrentCycleDayNumber.bind(this))
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ export default class DayView extends Component {
|
||||
<Text style={styles.welcome}>{bleedingLabel}</Text>
|
||||
<Text style={styles.welcome}>{temperatureLabel}</Text>
|
||||
<Button
|
||||
onPress={() => this.bringIntoView('bleedingEditView')}
|
||||
onPress={() => this.showView('bleedingEditView')}
|
||||
title="Edit bleeding">
|
||||
</Button>
|
||||
<Button
|
||||
onPress={() => this.bringIntoView('temperatureEditView')}
|
||||
onPress={() => this.showView('temperatureEditView')}
|
||||
title="Edit temperature">
|
||||
</Button>
|
||||
</View >
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ export default class Day extends Component {
|
||||
visibleComponent: 'dayView',
|
||||
}
|
||||
|
||||
this.bringIntoView = view => {
|
||||
this.showView = view => {
|
||||
this.setState({visibleComponent: view})
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,9 @@ export default class Day extends Component {
|
||||
<Text style={styles.welcome}>{formatDateForViewHeader(this.cycleDay.date)}</Text>
|
||||
{ this.cycleDayNumber && <Text>Cycle day {this.cycleDayNumber}</Text> }
|
||||
{
|
||||
{ dayView: <DayView cycleDay={this.cycleDay} bringIntoView={this.bringIntoView} />,
|
||||
bleedingEditView: <BleedingEditView cycleDay={this.cycleDay} bringIntoView={this.bringIntoView}/>,
|
||||
temperatureEditView: <TemperatureEditView cycleDay={this.cycleDay} bringIntoView={this.bringIntoView}/>
|
||||
{ dayView: <DayView cycleDay={this.cycleDay} bringIntoView={this.showView} />,
|
||||
bleedingEditView: <BleedingEditView cycleDay={this.cycleDay} bringIntoView={this.showView}/>,
|
||||
temperatureEditView: <TemperatureEditView cycleDay={this.cycleDay} bringIntoView={this.showView}/>
|
||||
}[this.state.visibleComponent]
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ export default class Temp extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.cycleDay = props.cycleDay
|
||||
this.bringIntoView = props.bringIntoView
|
||||
this.showView = props.bringIntoView
|
||||
let initialValue
|
||||
|
||||
if(this.cycleDay.temperature) {
|
||||
@@ -51,14 +51,14 @@ export default class Temp extends Component {
|
||||
/>
|
||||
<Button
|
||||
onPress={() => {
|
||||
this.bringIntoView('dayView')
|
||||
this.showView('dayView')
|
||||
}}
|
||||
title="Cancel">
|
||||
</Button>
|
||||
<Button
|
||||
onPress={() => {
|
||||
saveTemperature(cycleDay)
|
||||
this.bringIntoView('dayView')
|
||||
this.showView('dayView')
|
||||
}}
|
||||
title="Delete entry">
|
||||
</Button>
|
||||
@@ -68,7 +68,7 @@ export default class Temp extends Component {
|
||||
value: Number(this.state.currentValue),
|
||||
exclude: this.state.exclude
|
||||
})
|
||||
this.bringIntoView('dayView')
|
||||
this.showView('dayView')
|
||||
}}
|
||||
disabled={ this.state.currentValue === '' }
|
||||
title="Save">
|
||||
|
||||
Reference in New Issue
Block a user