aretherecookies-mobile/js/modals/PlaceModal.js
2017-05-27 11:26:50 -05:00

45 lines
885 B
JavaScript

// @flow
import React, { Component } from 'react';
import { View } from 'react-native';
import Modal, { TextInputHeader } from '../components/Modal';
import { type Place } from '../records/PlaceRecord';
class PlaceModal extends Component {
static displayName = 'PlaceModal';
props: {
isVisible: boolean,
onClose: () => void,
onUpdate: (place: Place) => void,
};
state: {
place: Place,
};
state = {
place: null,
};
save = () => {
this.props.onUpdate(this.state.place);
this.props.onClose();
};
setText = (place: Place) => {
this.setState({ place });
};
render() {
const { isVisible, onClose } = this.props;
return (
<Modal isVisible={isVisible}>
<View style={{ alignItems: 'stretch' }}>
<TextInputHeader value={this.state.text} onChange={this.setText} onClose={onClose} />
</View>
</Modal>
);
}
}
export default PlaceModal;