From 9c2509af3cbe62f58243b8747391190faedf4b94 Mon Sep 17 00:00:00 2001 From: tina Date: Fri, 21 Sep 2018 14:49:14 +0200 Subject: [PATCH 1/2] allows unselect in bleeding, mucus, cervix and desire --- components/cycle-day/symptoms/bleeding.js | 2 +- components/cycle-day/symptoms/cervix.js | 6 +++--- components/cycle-day/symptoms/desire.js | 2 +- components/cycle-day/symptoms/mucus.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/cycle-day/symptoms/bleeding.js b/components/cycle-day/symptoms/bleeding.js index 3c88ec5..c608aeb 100644 --- a/components/cycle-day/symptoms/bleeding.js +++ b/components/cycle-day/symptoms/bleeding.js @@ -39,7 +39,7 @@ export default class Bleeding extends Component { this.setState({ currentValue: val })} + onSelect={val => val === this.state.currentValue ? this.setState({ currentValue: null }) : this.setState({ currentValue: val })} /> this.setState({ opening: val })} + onSelect={val => val === this.state.opening ? this.setState({ opening: null }) : this.setState({ opening: val })} /> this.setState({ firmness: val })} + onSelect={val => val === this.state.firmness ? this.setState({ firmness: null }) : this.setState({ firmness: val })} /> this.setState({ position: val })} + onSelect={val => val === this.state.position ? this.setState({ position: null }) : this.setState({ position: val })} /> this.setState({ currentValue: val })} + onSelect={val => val === this.state.currentValue ? this.setState({ currentValue: null }) : this.setState({ currentValue: val })} /> diff --git a/components/cycle-day/symptoms/mucus.js b/components/cycle-day/symptoms/mucus.js index a517fcd..1e13777 100644 --- a/components/cycle-day/symptoms/mucus.js +++ b/components/cycle-day/symptoms/mucus.js @@ -46,7 +46,7 @@ export default class Mucus extends Component { > this.setState({ feeling: val })} + onSelect={val => val === this.state.feeling ? this.setState({ feeling: null }) : this.setState({ feeling: val })} active={this.state.feeling} /> @@ -56,7 +56,7 @@ export default class Mucus extends Component { > this.setState({ texture: val })} + onSelect={val => val === this.state.texture ? this.setState({ texture: null }) : this.setState({ texture: val })} active={this.state.texture} /> From 33efc654d78eb41cfdecb40b0956a4ce086e6c77 Mon Sep 17 00:00:00 2001 From: tina Date: Fri, 21 Sep 2018 15:23:13 +0200 Subject: [PATCH 2/2] enables un-select in the component itself --- components/cycle-day/select-tab-group.js | 2 +- components/cycle-day/symptoms/bleeding.js | 2 +- components/cycle-day/symptoms/cervix.js | 6 +++--- components/cycle-day/symptoms/desire.js | 2 +- components/cycle-day/symptoms/mucus.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/cycle-day/select-tab-group.js b/components/cycle-day/select-tab-group.js index a8673fd..b960d95 100644 --- a/components/cycle-day/select-tab-group.js +++ b/components/cycle-day/select-tab-group.js @@ -23,7 +23,7 @@ export default class SelectTabGroup extends Component { if (isActive) activeStyle = styles.selectTabActive return ( this.props.onSelect(value)} + onPress={() => isActive ? this.props.onSelect(null) : this.props.onSelect(value)} key={i} activeOpacity={1} > diff --git a/components/cycle-day/symptoms/bleeding.js b/components/cycle-day/symptoms/bleeding.js index c608aeb..3c88ec5 100644 --- a/components/cycle-day/symptoms/bleeding.js +++ b/components/cycle-day/symptoms/bleeding.js @@ -39,7 +39,7 @@ export default class Bleeding extends Component { val === this.state.currentValue ? this.setState({ currentValue: null }) : this.setState({ currentValue: val })} + onSelect={val => this.setState({ currentValue: val })} /> val === this.state.opening ? this.setState({ opening: null }) : this.setState({ opening: val })} + onSelect={val => this.setState({ opening: val })} /> val === this.state.firmness ? this.setState({ firmness: null }) : this.setState({ firmness: val })} + onSelect={val => this.setState({ firmness: val })} /> val === this.state.position ? this.setState({ position: null }) : this.setState({ position: val })} + onSelect={val => this.setState({ position: val })} /> val === this.state.currentValue ? this.setState({ currentValue: null }) : this.setState({ currentValue: val })} + onSelect={val => this.setState({ currentValue: val })} /> diff --git a/components/cycle-day/symptoms/mucus.js b/components/cycle-day/symptoms/mucus.js index 1e13777..a517fcd 100644 --- a/components/cycle-day/symptoms/mucus.js +++ b/components/cycle-day/symptoms/mucus.js @@ -46,7 +46,7 @@ export default class Mucus extends Component { > val === this.state.feeling ? this.setState({ feeling: null }) : this.setState({ feeling: val })} + onSelect={val => this.setState({ feeling: val })} active={this.state.feeling} /> @@ -56,7 +56,7 @@ export default class Mucus extends Component { > val === this.state.texture ? this.setState({ texture: null }) : this.setState({ texture: val })} + onSelect={val => this.setState({ texture: val })} active={this.state.texture} />