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

Fix validation messages hidden behind keyboard #4174

Merged
merged 3 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/pages/signin/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ class LoginForm extends React.Component {
autoFocus={canFocusInputOnScreenFocus()}
/>
</View>
<View style={[styles.mt5]}>
<Button
success
text={this.props.translate('common.continue')}
isLoading={this.props.account.loading}
onPress={this.validateAndSubmitForm}
/>
</View>

{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
Expand All @@ -113,6 +104,15 @@ class LoginForm extends React.Component {
{this.props.account.success}
</Text>
)}
<View style={[styles.mt5]}>
<Button
success
text={this.props.translate('common.continue')}
isLoading={this.props.account.loading}
onPress={this.validateAndSubmitForm}
/>
</View>

</>
);
}
Expand Down
18 changes: 13 additions & 5 deletions src/pages/signin/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import styles from '../../styles/styles';
import Button from '../../components/Button';
import Text from '../../components/Text';
Expand Down Expand Up @@ -110,6 +111,18 @@ class PasswordForm extends React.Component {
/>
</View>
)}

{this.props.account && !_.isEmpty(this.props.account.error) && (
<Text style={[styles.formError]}>
{this.props.account.error}
</Text>
)}

{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
</Text>
)}
<View>
<Button
success
Expand All @@ -120,11 +133,6 @@ class PasswordForm extends React.Component {
/>
<ChangeExpensifyLoginLink />
</View>
{this.state.formError && (
<Text style={[styles.formError]}>
{this.state.formError}
</Text>
)}
</>
);
}
Expand Down
11 changes: 5 additions & 6 deletions src/pages/signin/ResendValidationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class ResendValidationForm extends React.Component {
{this.props.translate('resendValidationForm.weSentYouMagicSignInLink')}
</Text>
</View>
{!_.isEmpty(this.state.formSuccess) && (
<Text style={[styles.formSuccess]}>
{this.state.formSuccess}
</Text>
)}
<View style={[styles.mt4]}>
<Button
success
Expand All @@ -90,12 +95,6 @@ class ResendValidationForm extends React.Component {
/>
<ChangeExpensifyLoginLink />
</View>

{!_.isEmpty(this.state.formSuccess) && (
<Text style={[styles.formSuccess]}>
{this.state.formSuccess}
</Text>
)}
</>
);
}
Expand Down
15 changes: 1 addition & 14 deletions src/pages/signin/SignInPage.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, {Component} from 'react';
import {
SafeAreaView, View,
SafeAreaView,
} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import Text from '../../components/Text';
import ONYXKEYS from '../../ONYXKEYS';
import styles from '../../styles/styles';
import updateUnread from '../../libs/UnreadIndicatorUpdater/updateUnread/index';
Expand Down Expand Up @@ -94,17 +92,6 @@ class SignInPage extends Component {
{showPasswordForm && <PasswordForm />}

{showResendValidationLinkForm && <ResendValidationForm />}

{/* Because of the custom layout of the login form, session errors are displayed differently */}
{!showLoginForm && (
<View>
{this.props.account && !_.isEmpty(this.props.account.error) && (
<Text style={[styles.formError]}>
{this.props.account.error}
</Text>
)}
</View>
)}
</SignInPageLayout>
</SafeAreaView>
</>
Expand Down
52 changes: 27 additions & 25 deletions src/pages/signin/SignInPageLayout/SignInPageLayoutNarrow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {ScrollView, View} from 'react-native';
import {ScrollView, View, KeyboardAvoidingView} from 'react-native';
import PropTypes from 'prop-types';
import styles from '../../../styles/styles';
import variables from '../../../styles/variables';
Expand All @@ -21,38 +21,40 @@ const propTypes = {
const SignInPageLayoutNarrow = props => (
<ScrollView
keyboardShouldPersistTaps="handled"
contentContainerStyle={[
showsVerticalScrollIndicator={false}
style={[
styles.flexGrow1,
styles.pb5,
styles.mh5,
styles.signInPageNarrowContentContainer,
styles.alignSelfCenter,
]}
>
<View style={[styles.flexGrow1]}>
<View
style={[
styles.signInPageInnerNative,
styles.flex1,
styles.dFlex,
styles.flexColumn,
props.windowHeight > props.windowWidth ? styles.mt40Percentage : null,
]}
>
<View style={[styles.signInPageLogoNative, styles.mb2]}>
<ExpensifyCashLogo
width={variables.componentSizeLarge}
height={variables.componentSizeLarge}
/>
<KeyboardAvoidingView behavior="position">
<View style={[styles.flexGrow1]}>
<View
style={[
styles.signInPageInnerNative,
styles.flex1,
styles.dFlex,
styles.flexColumn,
props.windowHeight > props.windowWidth ? styles.mt40Percentage : null,
]}
>
<View style={[styles.signInPageLogoNative, styles.mb2]}>
<ExpensifyCashLogo
width={variables.componentSizeLarge}
height={variables.componentSizeLarge}
/>
</View>
<Text style={[styles.mv5, styles.textLabel, styles.h3]}>
{props.translate('welcomeText.phrase1')}
</Text>
{props.children}
</View>
<Text style={[styles.mv5, styles.textLabel, styles.h3]}>
{props.translate('welcomeText.phrase1')}
</Text>
{props.children}
</View>
<View style={[styles.mt3]}>
<TermsAndLicenses />
</View>
</KeyboardAvoidingView>
<View style={[styles.mt3, styles.mb5, styles.alignSelfCenter]}>
<TermsAndLicenses />
</View>
</ScrollView>
);
Expand Down