Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
Changes for style-AddEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
tylermcginnis committed Aug 30, 2017
1 parent 4b145ff commit 31c3e56
Showing 1 changed file with 53 additions and 8 deletions.
61 changes: 53 additions & 8 deletions components/AddEntry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { View, TouchableOpacity, Text } from 'react-native'
import { View, TouchableOpacity, Text, StyleSheet, Platform } from 'react-native'
import {
getMetricMetaInfo,
timeToString,
Expand All @@ -13,16 +13,17 @@ import TextButton from './TextButton'
import { submitEntry, removeEntry } from '../utils/api'
import { connect } from 'react-redux'
import { addEntry } from '../actions'
import { purple, white } from '../utils/colors'

function SubmitBtn ({ onPress }) {
return (
<TouchableOpacity
style={Platform.OS === 'ios' ? styles.iosSubmitBtn : styles.AndroidSubmitBtn}
onPress={onPress}>
<Text>SUBMIT</Text>
<Text style={styles.submitBtnText}>SUBMIT</Text>
</TouchableOpacity>
)
}

class AddEntry extends Component {
state = {
run: 0,
Expand Down Expand Up @@ -90,28 +91,28 @@ class AddEntry extends Component {

if (this.props.alreadyLogged) {
return (
<View>
<View style={styles.center}>
<Ionicons
name={'ios-happy-outline'}
name={Platform.OS === 'ios' ? 'ios-happy-outline' : 'md-happy'}

This comment has been minimized.

Copy link
@elfiservice

elfiservice Nov 28, 2018

'ios-happy-outline' Did not work for me instead I found just 'ios-happy'

This comment has been minimized.

Copy link
@AlbertVilaCalvo

AlbertVilaCalvo Dec 3, 2018

same for me

This comment has been minimized.

Copy link
@tonkunz

tonkunz Mar 30, 2019

Same here

size={100}
/>
<Text>You already logged your information for today.</Text>
<TextButton onPress={this.reset}>
<TextButton style={{padding: 10}} onPress={this.reset}>
Reset
</TextButton>
</View>
)
}

return (
<View>
<View style={styles.container}>
<DateHeader date={(new Date()).toLocaleDateString()}/>
{Object.keys(metaInfo).map((key) => {
const { getIcon, type, ...rest } = metaInfo[key]
const value = this.state[key]

return (
<View key={key}>
<View key={key} style={styles.row}>
{getIcon()}
{type === 'slider'
? <UdaciSlider
Expand All @@ -134,6 +135,50 @@ class AddEntry extends Component {
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
backgroundColor: white
},
row: {
flexDirection: 'row',
flex: 1,
alignItems: 'center',
},
iosSubmitBtn: {
backgroundColor: purple,
padding: 10,
borderRadius: 7,
height: 45,
marginLeft: 40,
marginRight: 40,
},
AndroidSubmitBtn: {
backgroundColor: purple,
padding: 10,
paddingLeft: 30,
paddingRight: 30,
height: 45,
borderRadius: 2,
alignSelf: 'flex-end',
justifyContent: 'center',
alignItems: 'center',
},
submitBtnText: {
color: white,
fontSize: 22,
textAlign: 'center',
},
center: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginLeft: 30,
marginRight: 30,
},
})

function mapStateToProps (state) {
const key = timeToString()

Expand Down

0 comments on commit 31c3e56

Please sign in to comment.