Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor login form into a single component #2363

Merged
merged 10 commits into from
Apr 20, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import _ from 'underscore';
import styles from '../../../styles/styles';
import themeColors from '../../../styles/themes/default';
import ButtonWithLoader from '../../../components/ButtonWithLoader';
import {fetchAccountDetails} from '../../../libs/actions/Session';
import ONYXKEYS from '../../../ONYXKEYS';
import styles from '../../styles/styles';
import themeColors from '../../styles/themes/default';
import ButtonWithLoader from '../../components/ButtonWithLoader';
import {fetchAccountDetails} from '../../libs/actions/Session';
import ONYXKEYS from '../../ONYXKEYS';

const propTypes = {
/* Onyx Props */
Expand All @@ -33,7 +33,7 @@ const defaultProps = {
account: {},
};

class LoginFormNarrow extends React.Component {
class LoginForm extends React.Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -77,6 +77,7 @@ class LoginFormNarrow extends React.Component {
autoCapitalize="none"
placeholder="Phone or Email"
placeholderTextColor={themeColors.placeholderText}
autofocus
/>
</View>
<View>
Expand Down Expand Up @@ -108,9 +109,9 @@ class LoginFormNarrow extends React.Component {
}
}

LoginFormNarrow.propTypes = propTypes;
LoginFormNarrow.defaultProps = defaultProps;
LoginForm.propTypes = propTypes;
LoginForm.defaultProps = defaultProps;

export default withOnyx({
account: {key: ONYXKEYS.ACCOUNT},
})(LoginFormNarrow);
})(LoginForm);
19 changes: 0 additions & 19 deletions src/pages/signin/LoginForm/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/pages/signin/LoginForm/index.native.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/pages/signin/SignInPageLayout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const propTypes = {
const SignInPageLayout = props => (
!props.isSmallScreenWidth
// eslint-disable-next-line react/jsx-props-no-spreading
? <SignInPageLayoutWide {...props} />
? <SignInPageLayoutWide {...props}>{props.children}</SignInPageLayoutWide>
// eslint-disable-next-line react/jsx-props-no-spreading
: <SignInPageLayoutNarrow {...props} />
: <SignInPageLayoutNarrow {...props}>{props.children}</SignInPageLayoutNarrow>
);

SignInPageLayout.propTypes = propTypes;
Expand Down