import React from 'react'; import axios from 'axios'; import { View, Keyboard, } from 'react-native'; import { RkText, RkTextInput, RkStyleSheet, RkAvoidKeyboard, } from 'react-native-ui-kitten'; import { GradientButton } from '../../components/'; import { PasswordTextInput } from '../../components/passwordTextInput'; import { scale } from '../../utils/scale'; import NavigationType from '../../config/navigation/propTypes'; export class AddToCardForm extends React.Component { static propTypes = { navigation: NavigationType.isRequired, }; static navigationOptions = { title: 'Add Card'.toUpperCase(), }; state = { name: '', email: '', problem: '', }; onAddButtonPressed = () => { axios.post('http://192.168.1.43:8000/api/articles/', { title: this.state.problem.split(' ').slice(0, 5), text: this.state.problem, }) this.props.navigation.goBack(); }; render = () => ( true} onResponderRelease={() => Keyboard.dismiss()}> Your name this.setState({ name })} value={this.state.name} /> Your e-mail this.setState({ email })} value={this.state.email} /> Describe eco-problem this.setState({ problem })} value={this.state.problem} /> ); } const styles = RkStyleSheet.create(theme => ({ screen: { padding: 15, flex: 1, backgroundColor: theme.colors.screen.base, }, content: { marginTop: 10, }, formContent: { justifyContent: 'space-between', flexDirection: 'column', flex: 1, }, textRow: { marginLeft: 20, }, expireDateBlock: { justifyContent: 'space-between', flexDirection: 'row', }, expireDateInput: { flex: 0.48, marginVertical: 10, }, expireDateInnerInput: { textAlign: 'center', }, expireDateDelimiter: { flex: 0.04, }, balloon: { maxWidth: scale(250), padding: 15, borderRadius: 100, borderWidth: 0.5, borderColor: theme.colors.border.solid, }, }));