From e8587757ced208708311d80838c9b24777f8edbb Mon Sep 17 00:00:00 2001 From: Justin Shillingford Date: Mon, 29 Jun 2020 16:13:29 -0400 Subject: Created LoginInput Component --- src/components/common/LoginInput.tsx | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/components/common/LoginInput.tsx (limited to 'src/components/common') diff --git a/src/components/common/LoginInput.tsx b/src/components/common/LoginInput.tsx new file mode 100644 index 00000000..ca33db92 --- /dev/null +++ b/src/components/common/LoginInput.tsx @@ -0,0 +1,58 @@ +import React from 'react'; +import {TextInput, StyleSheet} from 'react-native'; +import PropTypes from 'prop-types'; + +const LoginInput = (props: LoginInputProps) => { + return ( + props.onChangeText(input)} + defaultValue={props.type} + onSubmitEditing={props.onSubmitEditing} + blurOnSubmit={props.isUsername ? false : undefined} + // ref={props.isUsername ? undefined : useRef()} + secureTextEntry={props.isUsername ? false : true} + focus={props.isUsername ? undefined : props.focusPasswordInput} + /> + ); +}; + +const styles = StyleSheet.create({ + credentials: { + top: 190, + width: 248, + height: 40, + fontSize: 20, + color: '#FFFFFF', + borderColor: '#FFFDFD', + borderWidth: 2, + borderRadius: 20, + paddingLeft: 13, + marginVertical: 15, + }, +}); + +LoginInput.propTypes = { + type: PropTypes.string.isRequired, + isUsername: PropTypes.bool.isRequired, + onChangeText: PropTypes.func.isRequired, + onSubmitEditing: PropTypes.func, + ref: PropTypes.any, + focusPasswordInput: PropTypes.bool, +}; + +export default LoginInput; -- cgit v1.2.3-70-g09d2 From 94f966fb947262405130488cbe84cabfc2989fb2 Mon Sep 17 00:00:00 2001 From: Justin Shillingford Date: Mon, 29 Jun 2020 16:25:14 -0400 Subject: Removed TextInput focus code for now Also miscellaneous code cleanup --- src/components/common/LoginInput.tsx | 4 ++-- src/screens/Login.tsx | 19 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'src/components/common') diff --git a/src/components/common/LoginInput.tsx b/src/components/common/LoginInput.tsx index ca33db92..55d2e662 100644 --- a/src/components/common/LoginInput.tsx +++ b/src/components/common/LoginInput.tsx @@ -26,7 +26,7 @@ const LoginInput = (props: LoginInputProps) => { blurOnSubmit={props.isUsername ? false : undefined} // ref={props.isUsername ? undefined : useRef()} secureTextEntry={props.isUsername ? false : true} - focus={props.isUsername ? undefined : props.focusPasswordInput} + // focus={props.isUsername ? undefined : props.focusPasswordInput} /> ); }; @@ -51,7 +51,7 @@ LoginInput.propTypes = { isUsername: PropTypes.bool.isRequired, onChangeText: PropTypes.func.isRequired, onSubmitEditing: PropTypes.func, - ref: PropTypes.any, +// ref: PropTypes.any, focusPasswordInput: PropTypes.bool, }; diff --git a/src/screens/Login.tsx b/src/screens/Login.tsx index 2b4a10dc..e7778f1d 100644 --- a/src/screens/Login.tsx +++ b/src/screens/Login.tsx @@ -87,11 +87,15 @@ const Login = ({navigation}: LoginProps) => { } }; + /* + Handler for the submit button on the Username keyboard + */ const handleUsernameSubmit = () => { - setData({ - ...data, - focusPasswordInput: true, - }); + // setData({ + // ...data, + // focusPasswordInput: true, + // }); + Alert.alert("Coming soon 🚧") }; return ( @@ -164,13 +168,6 @@ const Login = ({navigation}: LoginProps) => { - // - // Welcome to Tagg! Login page goes here. - //