Skip to content

Commit

Permalink
revert passing booleans into FullNameInputRow
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-hull committed Jan 5, 2022
1 parent 43209e4 commit 7c99096
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/components/FullNameInputRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import _ from 'underscore';
import styles from '../styles/styles';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import TextInput from './TextInput';
import * as PersonalDetails from '../libs/actions/PersonalDetails';

const propTypes = {
...withLocalizePropTypes,
Expand All @@ -19,14 +18,14 @@ const propTypes = {
/** Used to prefill the firstName input, can also be used to make it a controlled input */
firstName: PropTypes.string,

/** If first name input should show error */
hasFirstNameError: PropTypes.bool,
/** Error message to display below firstName input */
firstNameError: PropTypes.string,

/** Used to prefill the lastName input, can also be used to make it a controlled input */
lastName: PropTypes.string,

/** If last name input should show error */
hasLastNameError: PropTypes.bool,
/** Error message to display below lastName input */
lastNameError: PropTypes.string,

/** Additional styles to add after local styles */
style: PropTypes.oneOfType([
Expand All @@ -36,9 +35,9 @@ const propTypes = {
};
const defaultProps = {
firstName: '',
hasFirstNameError: false,
firstNameError: '',
lastName: '',
hasLastNameError: false,
lastNameError: '',
style: {},
};

Expand All @@ -50,7 +49,7 @@ const FullNameInputRow = (props) => {
<TextInput
label={props.translate('common.firstName')}
value={props.firstName}
errorText={PersonalDetails.getMaxCharacterError(props.hasFirstNameError)}
errorText={props.firstNameError}
onChangeText={props.onChangeFirstName}
placeholder={props.translate('profilePage.john')}
/>
Expand All @@ -59,7 +58,7 @@ const FullNameInputRow = (props) => {
<TextInput
label={props.translate('common.lastName')}
value={props.lastName}
errorText={PersonalDetails.getMaxCharacterError(props.hasLastNameError)}
errorText={props.lastNameError}
onChangeText={props.onChangeLastName}
placeholder={props.translate('profilePage.doe')}
/>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/RequestCallPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import KeyboardAvoidingView from '../components/KeyboardAvoidingView';
import RequestCallIcon from '../../assets/images/request-call.svg';
import LoginUtil from '../libs/LoginUtil';
import * as ValidationUtils from '../libs/ValidationUtils';
import * as PersonalDetails from '../libs/actions/PersonalDetails';

const propTypes = {
...withLocalizePropTypes,
Expand Down Expand Up @@ -222,9 +223,9 @@ class RequestCallPage extends Component {
</Text>
<FullNameInputRow
firstName={this.state.firstName}
hasFirstNameError={this.state.firstNameError}
hasFirstNameError={PersonalDetails.getMaxCharacterError(this.state.firstNameError)}
lastName={this.state.lastName}
hasLastNameError={this.state.lastNameError}
hasLastNameError={PersonalDetails.getMaxCharacterError(this.state.lastNameError)}
onChangeFirstName={firstName => this.setState({firstName})}
onChangeLastName={lastName => this.setState({lastName})}
style={[styles.mv4]}
Expand Down

0 comments on commit 7c99096

Please sign in to comment.