mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 09:44:55 -06:00
45 lines
885 B
JavaScript
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;
|