import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { Button, TextInput, View } from 'react-native'; export default function LocalLogin({ doLoginAction }) { const [enabled, setEnableSubmit] = useState(false); const [password, setPassword] = useState(null); const [username, setUsername] = useState(null); const _handleLoginSubmit = () => { doLoginAction(username, password); }; const _updateState = (field, value) => { if (field === 'username') { setUsername(value); } if (field === 'password') { setPassword(value); } if (!!username && !!password) { setEnableSubmit(true); } }; return ( _updateState('username', text)} value={username} /> _updateState('password', text)} value={password} />