Skip to content
Snippets Groups Projects
Commit 5a57b2bb authored by Julia Friesel's avatar Julia Friesel
Browse files

Merge branch 'add-cancel-button' into 'master'

Add cancel button to ConfirmWithPassword component

Closes #274

See merge request bloodyhealth/drip!148
parents 5c925ea7 714d9fd6
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,6 @@ export default class ConfirmWithPassword extends Component {
}
render() {
const { password } = this.state
const labels = settings.passwordSettings
......@@ -75,12 +74,27 @@ export default class ConfirmWithPassword extends Component {
value={password}
onChangeText={this.handlePasswordInput}
/>
<SettingsButton
onPress={this.initPasswordCheck}
disabled={!password}
>
{shared.confirmToProceed}
</SettingsButton>
<View style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between'
}}>
<SettingsButton
onPress={this.props.onCancel}
secondary
>
{shared.cancel}
</SettingsButton>
<SettingsButton
onPress={this.initPasswordCheck}
disabled={!password}
style={{
flex: 1,
}}
>
{shared.confirmToProceed}
</SettingsButton>
</View>
</View>
)
......
......@@ -5,16 +5,22 @@ import { TouchableOpacity } from 'react-native'
import AppText from '../../app-text'
import styles from '../../../styles'
const SettingsButton = ({ children, ...props }) => {
const SettingsButton = ({ children, style, secondary, ...props }) => {
return (
<TouchableOpacity
style={[
styles.settingsButton,
props.disabled ? styles.settingsButtonDisabled : null
secondary ? null : styles.settingsButtonAccent,
props.disabled ? styles.settingsButtonDisabled : null,
style
]}
{ ...props }
>
<AppText style={styles.settingsButtonText}>
<AppText style={
secondary ?
styles.settingsButtonSecondaryText :
styles.settingsButtonText
}>
{children}
</AppText>
</TouchableOpacity>
......
......@@ -280,10 +280,12 @@ export default StyleSheet.create({
fontWeight: 'bold'
},
settingsButton: {
backgroundColor: secondaryColor,
padding: 10,
alignItems: 'center',
margin: 10,
margin: 10
},
settingsButtonAccent: {
backgroundColor: secondaryColor
},
settingsButtonDisabled: {
backgroundColor: colorInActive
......@@ -291,6 +293,10 @@ export default StyleSheet.create({
settingsButtonText: {
color: fontOnPrimaryColor
},
settingsButtonSecondaryText: {
color: secondaryColor
},
statsRow: {
flexDirection: 'row',
width: '100%'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment