content: import React from 'react'
  import { StyleSheet, View, Text, Button } from 'react-native'
  
  import Header from '../components/header'
  import Input from '../components/input'
  
  export default class Login extends React.Component {
    constructor(props) {
      super(props)
      this.state = {
        username: '',
        password: ''
      }
    }
  
    submit = () => {
      this.props.API.post('auth', {...this.state}).then((response) => {
        this.props.onLogin(response.data)
      }).catch((error) => {
        console.error(error.message)
      })
    }
  
    render() {
      return (
        <View style={{ flex: 1 }}>
          <Header />
          <View style={ styles.container }>
            <Input placeholder="Username" onChangeText={value => {
              this.setState({
                username: value
              })
            }} value={this.state.username} />
  
            <Input placeholder="Password" onChangeText={value => {
              this.setState({
                password: value
              })
            }} value={this.state.password} secureTextEntry />
            <Button title="Login" onPress={this.submit} />
          </View>
        </View>
      )
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      margin: 20
    }
  })