Added Header, Icon and MessageModal. Refactor screens into directories.
This commit is contained in:
62
mobile/src/Modal/MessageModal.js
Normal file
62
mobile/src/Modal/MessageModal.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import React, { Component } from 'react'
|
||||
import Modal from 'react-native-modal'
|
||||
import PropTypes from 'prop-types'
|
||||
import { View, Text, TouchableOpacity } from 'react-native'
|
||||
import { Icon } from '../ui'
|
||||
import autobind from 'autobind-decorator'
|
||||
|
||||
export class MessageModal extends Component {
|
||||
static propTypes = {
|
||||
open: PropTypes.bool,
|
||||
icon: PropTypes.string.isRequired,
|
||||
message: PropTypes.string.isRequired,
|
||||
detail: PropTypes.string,
|
||||
onDismiss: PropTypes.func
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleButtonPress() {
|
||||
const { onDismiss } = this.props
|
||||
|
||||
if (onDismiss) {
|
||||
onDismiss()
|
||||
}
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { open, icon, message, detail } = this.props
|
||||
|
||||
return (
|
||||
<Modal isVisible={open}>
|
||||
<View style={{ alignSelf: 'center', padding: 5, backgroundColor: '#FFFFFF', flexDirection: 'row' }}>
|
||||
<Icon name={icon} size={130} margin={3} />
|
||||
<View style={{ marginLeft: 20, marginRight: 20, flexGrow: 1, flexDirection: 'column' }}>
|
||||
<Text style={{ marginTop: 5, fontSize: 18, alignSelf: 'center' }}>{message}</Text>
|
||||
<Text style={{ marginTop: 20, alignSelf: 'center' }}>{detail}</Text>
|
||||
<TouchableOpacity onPress={this.handleButtonPress}
|
||||
style={{
|
||||
alignSelf: 'center',
|
||||
backgroundColor: 'blue',
|
||||
marginTop: 20,
|
||||
marginBottom: 10,
|
||||
justifyContent: 'center',
|
||||
paddingHorizontal: 10,
|
||||
height: 40,
|
||||
width: 100,
|
||||
backgroundColor: '#3BB0FD'
|
||||
}}>
|
||||
<Text style={{ alignSelf: 'center', color: 'black' }}>OK</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user