- Linting... Prettier...

This commit is contained in:
2019-08-07 01:59:10 -04:00
parent 3dc8589fb4
commit 847c9b192a
102 changed files with 2161 additions and 2109 deletions

View File

@@ -4,52 +4,47 @@ 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 [ enabled, setEnableSubmit ] = useState(false);
const [ password, setPassword ] = useState(null);
const [ username, setUsername ] = useState(null);
const _handleLoginSubmit = () => {
doLoginAction(username, password);
};
const _handleLoginSubmit = () => {
doLoginAction(username, password);
};
const _updateState = (field, value) => {
if (field === 'username') {
setUsername(value);
}
const _updateState = (field, value) => {
if (field === 'username') {
setUsername(value);
}
if (field === 'password') {
setPassword(value);
}
if (field === 'password') {
setPassword(value);
}
if (!!username && !!password) {
setEnableSubmit(true);
}
};
if (!!username && !!password) {
setEnableSubmit(true);
}
};
return (
<View style={styles.loginWrap}>
<TextInput
style={{height: 40}}
placeholder="email"
onChangeText={(text) => _updateState('username', text)}
value={username}
/>
<TextInput
style={{height: 40}}
placeholder="password"
onChangeText={(text) => _updateState('password', text)}
value={password}
/>
<Button
disabled={!enabled}
onPress={_handleLoginSubmit}
title="Login"
/>
</View>
);
return (
<View style={styles.loginWrap}>
<TextInput
style={{ height: 40 }}
placeholder="email"
onChangeText={(text) => _updateState('username', text)}
value={username}
/>
<TextInput
style={{ height: 40 }}
placeholder="password"
onChangeText={(text) => _updateState('password', text)}
value={password}
/>
<Button disabled={!enabled} onPress={_handleLoginSubmit} title="Login" />
</View>
);
}
LocalLogin.propTypes = {
doLoginAction: PropTypes.func.isRequired,
doLoginAction: PropTypes.func.isRequired,
};