From ac0690ec9f1591eb48d8324286a025cc70768bb4 Mon Sep 17 00:00:00 2001 From: emelko Date: Wed, 22 May 2019 17:27:31 +0200 Subject: [PATCH 1/5] Set show more on homescreen to default and get rid of more/less switch --- components/home.js | 61 ++++++++++------------------------------------ i18n/en/labels.js | 2 -- styles/index.js | 8 ------ 3 files changed, 13 insertions(+), 58 deletions(-) diff --git a/components/home.js b/components/home.js index 5e64814..2a234f6 100644 --- a/components/home.js +++ b/components/home.js @@ -1,42 +1,22 @@ import { ChronoUnit, LocalDate } from 'js-joda' import React, { Component } from 'react' -import { Dimensions, ScrollView, TouchableHighlight, View } from 'react-native' -import Icon from 'react-native-vector-icons/Entypo' +import { ScrollView, View } from 'react-native' import DripHomeIcon from '../assets/drip-home-icons' import { getCycleDay } from '../db' import { bleedingPrediction as predictLabels, - home as labels, - shared, + home as labels } from '../i18n/en/labels' import links from '../i18n/en/links' import cycleModule from '../lib/cycle' import { getFertilityStatusForDay } from '../lib/sympto-adapter' import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles' + import AppText from './app-text' import Button from './button' import { formatDateForShortText } from './helpers/format-date' -const ShowMoreToggler = ({ isShowingMore, onToggle }) => { - const {height, width} = Dimensions.get('window') - const leftPosition = isShowingMore ? 10 : width - 40 - const style = isShowingMore ? styles.showLess : styles.showMore - const topPosition = height / 2 - styles.header.height - 30 - - return ( - - - {isShowingMore ? shared.less : shared.more} - - - - ) -} - const IconText = ({ children, wrapperStyles }) => { return ( @@ -75,7 +55,6 @@ export default class Home extends Component { const fertilityStatus = getFertilityStatusForDay(this.todayDateString) this.state = { - isShowingMore: false, cycleDayNumber: this.getCycleDayNumber(this.todayDateString), predictionText: determinePredictionText(prediction), bleedingPredictionRange: getBleedingPredictionRange(prediction), @@ -91,12 +70,8 @@ export default class Home extends Component { }) } - toggleShowingMore = () => { - this.setState({ isShowingMore: !this.state.isShowingMore }) - } - render() { - const { isShowingMore, cycleDayNumber, phase, status } = this.state + const { cycleDayNumber, phase, status } = this.state const { navigate } = this.props const cycleDayMoreText = cycleDayNumber ? labels.cycleDayKnown(cycleDayNumber) : @@ -121,9 +96,7 @@ export default class Home extends Component { {cycleDayNumber || labels.unknown} - { isShowingMore && - {cycleDayMoreText} - } + {cycleDayMoreText} - { isShowingMore && - - {this.state.predictionText} - - } + + {this.state.predictionText} + {`${labels.phase(phase)} (${status})`} } - { isShowingMore && - - - { `${statusText} ${links.wiki.url}.` } - - - } + + + { `${statusText} ${links.wiki.url}.` } + + - ) } diff --git a/i18n/en/labels.js b/i18n/en/labels.js index ddae047..df5d2ce 100644 --- a/i18n/en/labels.js +++ b/i18n/en/labels.js @@ -15,8 +15,6 @@ export const shared = { date: 'Date', cycleDayWithLinebreak: 'Cycle\nday', loading: 'Loading ...', - more: 'more', - less: 'less', enter: 'Enter' } diff --git a/styles/index.js b/styles/index.js index 2b5d0f0..9928ef8 100644 --- a/styles/index.js +++ b/styles/index.js @@ -157,14 +157,6 @@ export default StyleSheet.create({ iconText: { fontSize: 25 }, - showMore: { - transform: [{rotate: '90deg'}], - position: 'absolute', - }, - showLess: { - transform: [{rotate: '270deg'}], - position: 'absolute' - }, cycleDayNumber: { fontSize: 15, color: fontOnPrimaryColor, From 668acb4afe0660054edd9389745d20e804700f35 Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Wed, 22 May 2019 16:26:39 +0200 Subject: [PATCH 2/5] simple way to rearrange home screen --- components/home.js | 20 ++++++++++++-------- styles/index.js | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/components/home.js b/components/home.js index 2a234f6..28cbd11 100644 --- a/components/home.js +++ b/components/home.js @@ -12,7 +12,6 @@ import links from '../i18n/en/links' import cycleModule from '../lib/cycle' import { getFertilityStatusForDay } from '../lib/sympto-adapter' import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles' - import AppText from './app-text' import Button from './button' import { formatDateForShortText } from './helpers/format-date' @@ -33,13 +32,18 @@ const HomeElement = ({ children, onPress, buttonColor, buttonLabel }) => { onPress={ onPress } style={ styles.homeIconElement } > - { children } - + {children[0]} + {children[1]} + + + {children[2]} + + ) } diff --git a/styles/index.js b/styles/index.js index 9928ef8..edb0da4 100644 --- a/styles/index.js +++ b/styles/index.js @@ -122,7 +122,8 @@ export default StyleSheet.create({ }, homeIconElement: { alignItems: 'center', - marginTop: 15 + marginTop: 15, + flexDirection: 'row' }, homeIconTextWrapper: { alignItems: 'center', From 418b9c0f5d88265260c16200efacc7abc45c8512 Mon Sep 17 00:00:00 2001 From: emelko Date: Thu, 23 May 2019 17:09:44 +0200 Subject: [PATCH 3/5] Styling for homescreen elements to breathe --- components/home.js | 22 ++++++++++++---------- styles/index.js | 31 +++++++++++-------------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/components/home.js b/components/home.js index 28cbd11..10b45c6 100644 --- a/components/home.js +++ b/components/home.js @@ -30,12 +30,12 @@ const HomeElement = ({ children, onPress, buttonColor, buttonLabel }) => { return ( {children[0]} {children[1]} - + {children[2]}