import React, { Component } from 'react' import { View, Text } from 'react-native' import cycleDayModule from './get-cycle-day-number' import DayView from './day-view' import BleedingEditView from './bleeding' import TemperatureEditView from './temperature' import { formatDateForViewHeader } from './format' import styles from './styles' const getCycleDayNumber = cycleDayModule() export default class Day extends Component { constructor(props) { super(props) this.cycleDay = props.navigation.state.params.cycleDay this.cycleDayNumber = getCycleDayNumber(this.cycleDay.date) this.state = { visibleComponent: 'dayView', } this.bringIntoView = view => { this.setState({visibleComponent: view}) } } render() { return ( {formatDateForViewHeader(this.cycleDay.date)} { this.cycleDayNumber && Cycle day {this.cycleDayNumber} } { { dayView: , bleedingEditView: , temperatureEditView: }[this.state.visibleComponent] } ) } }