-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Solved closing of keyboard on changing text field on profile page #9441
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
Merged
Merged
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
8e9b60d
fixed closing of keyboard on changing text field on profile page
liyamahendra 54e0294
Solved the incorrect display of error at bottom
liyamahendra 26d331a
Solved automatic timezone checkbox not being clickable
liyamahendra 060f307
Making CheckboxWithLabel compatible with the Form
liyamahendra d04ecac
Renamed Set Automatic Timezone Checkbox inputID
liyamahendra 7d07035
Moved the character limit value to CONST
liyamahendra c4e1cf3
refactored doesFailCharacterLimit function and ProfilePage validation
liyamahendra e844388
Refactoring ProfilePage validation
liyamahendra 651efb7
Fixed lint error
liyamahendra 885ef63
added JSDoc for validate method
liyamahendra 7fe6433
Using PROFILE_INPUTS_CHARACTER_LIMIT in RequestCallPage and PersonalD…
liyamahendra c7e6ae2
Removed the redundant style
liyamahendra a9a8b78
Refactored form name from PROFILE_FORM to PROFILE_SETTINGS_FORM
liyamahendra bcbee9a
refactored ProfilePage
liyamahendra fafbdeb
Removed inputID from LoginField
liyamahendra bacc8eb
Removed usage of getMaxCharacterError from validate method
liyamahendra 10cfb09
Added missing import for Localize
liyamahendra b901c3c
Added JSdocs for values
liyamahendra e2e3e85
Removed firstName, lastName and pronouns from state
liyamahendra db10881
Removed firstName, lastName and pronouns from state and console.log s…
liyamahendra 3fe935b
Moved state variables to class properties
liyamahendra 329595b
changed if condition to ternary operator
liyamahendra 0368f9b
Adding early return instead of conditionally wrapped function body
liyamahendra 849ea0f
Added flexGrow1 to form style
liyamahendra 614109e
Fixed self-select picker
liyamahendra b750b7b
Merge branch 'Expensify:main' into 9234
liyamahendra 6bc29d9
Renamed PROFILE_INPUTS_CHARACTER_LIMIT to FORM_CHARACTER_LIMIT
liyamahendra bd42089
Making isAvatarChanged to true when updateAvatar is called
liyamahendra 3c1b5c3
Saving draft values for all form elements
liyamahendra 49f8a6d
Moved AvatarWithImagePicker outside form
liyamahendra 0c93128
created a new function doesFailCharacterLimitAfterTrim
liyamahendra fe5933a
Resolved enable/disable of timezone picker
liyamahendra 0e9ffbc
resolved conflicts
liyamahendra 1542247
Merge branch 'Expensify:main' into 9234
liyamahendra 303ab2c
Moved AvatarWithImagePicker inside Form
liyamahendra 369ebe9
Merge branch '9234' of https://github.com/liyamahendra/Expensify into…
liyamahendra 10f7274
Resolved conflicts due to rename of myPersonalDetails to currentUserP…
liyamahendra b60e13e
removed doesFailCharacterLimit
liyamahendra a1a1f38
Tested change related to currentUserPersonalDetails
liyamahendra 7174104
solved the timezone guessing
liyamahendra e916b9f
Moved logins to state
liyamahendra eab67a8
Resolved merge conflicts
liyamahendra 557c218
added missing curly brace
liyamahendra 2247af9
Resolved conflicts
liyamahendra f43cbe7
Update src/libs/ValidationUtils.js
liyamahendra af2ba91
Keeping both doesFailCharacterLimit and doesFailCharacterLimitAfterTrim
liyamahendra a6d08bc
Revert package-lock.json
liyamahendra 3ef2ae7
Update package-lock.json to main's codebase
liyamahendra 78dcfd3
Fixed lint issue
liyamahendra 7f88f46
Added a new line at bottom of package-lock.json
liyamahendra 1791c52
Using doesFailCharacterLimit and trimming values
liyamahendra b760b67
Merge branch 'Expensify:main' into 9234
liyamahendra 60c468b
Removed trim
liyamahendra 3109ce3
Changes suggested by @luacmartins - Update src/pages/settings/Profile…
liyamahendra c088aca
Using PersonalDetails.updateProfile
liyamahendra 63785a9
Merge branch 'Expensify:main' into 9234
liyamahendra 4a7dcd8
Update src/pages/settings/Profile/ProfilePage.js
liyamahendra 8e0b8b5
Update src/pages/settings/Profile/ProfilePage.js
liyamahendra 13c853d
Update src/libs/actions/PersonalDetails.js
liyamahendra b80c9b8
Update src/pages/settings/Profile/ProfilePage.js
liyamahendra 6664779
Update PersonalDetails.js
liyamahendra 5822b7e
resolved conflicts
liyamahendra a059ebe
Removed shouldSaveDraft
liyamahendra 313df27
Updated updateProfile function
liyamahendra 30e704d
Moved PROFILE_SETTINGS_FORM to CONST
liyamahendra 9dd6f06
Fixed lint - removed unused variable
liyamahendra c87184c
Resolved merge conflicts
liyamahendra 82dd959
Removed KeyboardAvoidingView
liyamahendra da7d1b1
Resolved lint errors
liyamahendra 963d242
resolved conflicts
liyamahendra 447cd8a
Solved profile avatar update crash
liyamahendra a9c2cff
Trigger checks again
liyamahendra 36061f6
Trigger checks again
liyamahendra 9686c11
Using lodashGet for firstName and lastName
liyamahendra a796a5b
Removed unused constants
liyamahendra d035720
removed empty lines
liyamahendra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ import lodashGet from 'lodash/get'; | |||||||||||||
| import React, {Component} from 'react'; | ||||||||||||||
| import {withOnyx} from 'react-native-onyx'; | ||||||||||||||
| import PropTypes from 'prop-types'; | ||||||||||||||
| import {View, ScrollView} from 'react-native'; | ||||||||||||||
| import {View} from 'react-native'; | ||||||||||||||
| import Str from 'expensify-common/lib/str'; | ||||||||||||||
| import moment from 'moment-timezone'; | ||||||||||||||
| import _ from 'underscore'; | ||||||||||||||
|
|
@@ -17,16 +17,16 @@ import styles from '../../../styles/styles'; | |||||||||||||
| import Text from '../../../components/Text'; | ||||||||||||||
| import LoginField from './LoginField'; | ||||||||||||||
| import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; | ||||||||||||||
| import * as Localize from '../../../libs/Localize'; | ||||||||||||||
| import compose from '../../../libs/compose'; | ||||||||||||||
| import Button from '../../../components/Button'; | ||||||||||||||
| import FixedFooter from '../../../components/FixedFooter'; | ||||||||||||||
| import TextInput from '../../../components/TextInput'; | ||||||||||||||
| import Picker from '../../../components/Picker'; | ||||||||||||||
| import FullNameInputRow from '../../../components/FullNameInputRow'; | ||||||||||||||
| import CheckboxWithLabel from '../../../components/CheckboxWithLabel'; | ||||||||||||||
| import AvatarWithImagePicker from '../../../components/AvatarWithImagePicker'; | ||||||||||||||
| import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../components/withCurrentUserPersonalDetails'; | ||||||||||||||
| import * as ValidationUtils from '../../../libs/ValidationUtils'; | ||||||||||||||
| import * as ReportUtils from '../../../libs/ReportUtils'; | ||||||||||||||
| import Form from '../../../components/Form'; | ||||||||||||||
| import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; | ||||||||||||||
|
|
||||||||||||||
| const propTypes = { | ||||||||||||||
|
|
@@ -65,24 +65,19 @@ class ProfilePage extends Component { | |||||||||||||
| constructor(props) { | ||||||||||||||
| super(props); | ||||||||||||||
|
|
||||||||||||||
| const currentUserDetails = this.props.currentUserPersonalDetails || {}; | ||||||||||||||
| this.defaultAvatar = ReportUtils.getDefaultAvatar(this.props.currentUserPersonalDetails.login); | ||||||||||||||
| this.avatar = {uri: lodashGet(this.props.currentUserPersonalDetails, 'avatar') || this.defaultAvatar}; | ||||||||||||||
| this.pronouns = props.currentUserPersonalDetails.pronouns; | ||||||||||||||
| this.state = { | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| firstName: currentUserDetails.firstName || '', | ||||||||||||||
| hasFirstNameError: false, | ||||||||||||||
| lastName: currentUserDetails.lastName || '', | ||||||||||||||
| hasLastNameError: false, | ||||||||||||||
| pronouns: currentUserDetails.pronouns || '', | ||||||||||||||
| hasPronounError: false, | ||||||||||||||
| hasSelfSelectedPronouns: !_.isEmpty(currentUserDetails.pronouns) && !currentUserDetails.pronouns.startsWith(CONST.PRONOUNS.PREFIX), | ||||||||||||||
| selectedTimezone: lodashGet(currentUserDetails, 'timezone.selected', CONST.DEFAULT_TIME_ZONE.selected), | ||||||||||||||
| isAutomaticTimezone: lodashGet(currentUserDetails, 'timezone.automatic', CONST.DEFAULT_TIME_ZONE.automatic), | ||||||||||||||
| logins: this.getLogins(props.loginList), | ||||||||||||||
| selectedTimezone: lodashGet(props.currentUserPersonalDetails.timezone, 'selected', CONST.DEFAULT_TIME_ZONE.selected), | ||||||||||||||
| isAutomaticTimezone: lodashGet(props.currentUserPersonalDetails.timezone, 'automatic', CONST.DEFAULT_TIME_ZONE.automatic), | ||||||||||||||
| hasSelfSelectedPronouns: !_.isEmpty(props.currentUserPersonalDetails.pronouns) && !props.currentUserPersonalDetails.pronouns.startsWith(CONST.PRONOUNS.PREFIX), | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| this.getLogins = this.getLogins.bind(this); | ||||||||||||||
| this.setAutomaticTimezone = this.setAutomaticTimezone.bind(this); | ||||||||||||||
| this.validate = this.validate.bind(this); | ||||||||||||||
| this.updatePersonalDetails = this.updatePersonalDetails.bind(this); | ||||||||||||||
| this.validateInputs = this.validateInputs.bind(this); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| componentDidUpdate(prevProps) { | ||||||||||||||
|
|
@@ -101,18 +96,6 @@ class ProfilePage extends Component { | |||||||||||||
| this.setState(stateToUpdate); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Set the form to use automatic timezone | ||||||||||||||
| * | ||||||||||||||
| * @param {Boolean} isAutomaticTimezone | ||||||||||||||
| */ | ||||||||||||||
| setAutomaticTimezone(isAutomaticTimezone) { | ||||||||||||||
| this.setState(({selectedTimezone}) => ({ | ||||||||||||||
| isAutomaticTimezone, | ||||||||||||||
| selectedTimezone: isAutomaticTimezone ? moment.tz.guess() : selectedTimezone, | ||||||||||||||
luacmartins marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| })); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Get the most validated login of each type | ||||||||||||||
| * | ||||||||||||||
|
|
@@ -145,51 +128,74 @@ class ProfilePage extends Component { | |||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Submit form to update personal details | ||||||||||||||
| * @param {Object} values | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| * @param {String} values.firstName | ||||||||||||||
| * @param {String} values.lastName | ||||||||||||||
| * @param {String} values.pronouns | ||||||||||||||
| * @param {Boolean} values.isAutomaticTimezone | ||||||||||||||
| * @param {String} values.timezone | ||||||||||||||
| * @param {String} values.selfSelectedPronoun | ||||||||||||||
| */ | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| updatePersonalDetails() { | ||||||||||||||
| if (!this.validateInputs()) { | ||||||||||||||
| return; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| updatePersonalDetails(values) { | ||||||||||||||
| PersonalDetails.updateProfile( | ||||||||||||||
| this.state.firstName.trim(), | ||||||||||||||
| this.state.lastName.trim(), | ||||||||||||||
| this.state.pronouns.trim(), | ||||||||||||||
| values.firstName.trim(), | ||||||||||||||
| values.lastName.trim(), | ||||||||||||||
| (this.state.hasSelfSelectedPronouns) ? values.selfSelectedPronoun.trim() : values.pronouns.trim(), | ||||||||||||||
| { | ||||||||||||||
| automatic: this.state.isAutomaticTimezone, | ||||||||||||||
| selected: this.state.selectedTimezone, | ||||||||||||||
| automatic: values.isAutomaticTimezone, | ||||||||||||||
| selected: values.timezone, | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| }, | ||||||||||||||
| ); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| validateInputs() { | ||||||||||||||
| const [hasFirstNameError, hasLastNameError, hasPronounError] = ValidationUtils.doesFailCharacterLimit( | ||||||||||||||
| 50, | ||||||||||||||
| [this.state.firstName.trim(), this.state.lastName.trim(), this.state.pronouns.trim()], | ||||||||||||||
| /** | ||||||||||||||
| * @param {Object} values - An object containing the value of each inputID | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| * @param {String} values.firstName | ||||||||||||||
| * @param {String} values.lastName | ||||||||||||||
| * @param {String} values.pronouns | ||||||||||||||
| * @param {Boolean} values.isAutomaticTimezone | ||||||||||||||
| * @param {String} values.timezone | ||||||||||||||
| * @param {String} values.selfSelectedPronoun | ||||||||||||||
| * @returns {Object} - An object containing the errors for each inputID | ||||||||||||||
| */ | ||||||||||||||
| validate(values) { | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| const errors = {}; | ||||||||||||||
|
|
||||||||||||||
| const [hasFirstNameError, hasLastNameError, hasPronounError] = ValidationUtils.doesFailCharacterLimitAfterTrim( | ||||||||||||||
| CONST.FORM_CHARACTER_LIMIT, | ||||||||||||||
| [values.firstName, values.lastName, values.pronouns], | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| const hasSelfSelectedPronouns = values.pronouns === CONST.PRONOUNS.SELF_SELECT; | ||||||||||||||
| this.pronouns = hasSelfSelectedPronouns ? '' : values.pronouns; | ||||||||||||||
| this.setState({ | ||||||||||||||
| hasFirstNameError, | ||||||||||||||
| hasLastNameError, | ||||||||||||||
| hasPronounError, | ||||||||||||||
| hasSelfSelectedPronouns, | ||||||||||||||
luacmartins marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| isAutomaticTimezone: values.isAutomaticTimezone, | ||||||||||||||
| selectedTimezone: values.isAutomaticTimezone ? moment.tz.guess() : values.timezone, | ||||||||||||||
| }); | ||||||||||||||
| return !hasFirstNameError && !hasLastNameError && !hasPronounError; | ||||||||||||||
|
|
||||||||||||||
| if (hasFirstNameError) { | ||||||||||||||
| errors.firstName = Localize.translateLocal('personalDetails.error.characterLimit', {limit: CONST.FORM_CHARACTER_LIMIT}); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (hasLastNameError) { | ||||||||||||||
| errors.lastName = Localize.translateLocal('personalDetails.error.characterLimit', {limit: CONST.FORM_CHARACTER_LIMIT}); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (hasPronounError) { | ||||||||||||||
| errors.pronouns = Localize.translateLocal('personalDetails.error.characterLimit', {limit: CONST.FORM_CHARACTER_LIMIT}); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| return errors; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| render() { | ||||||||||||||
| const pronounsList = _.map(this.props.translate('pronouns'), (value, key) => ({ | ||||||||||||||
| label: value, | ||||||||||||||
| value: `${CONST.PRONOUNS.PREFIX}${key}`, | ||||||||||||||
| })); | ||||||||||||||
|
|
||||||||||||||
| // Disables button if none of the form values have changed | ||||||||||||||
| const currentUserDetails = this.props.currentUserPersonalDetails || {}; | ||||||||||||||
| const isButtonDisabled = (currentUserDetails.firstName === this.state.firstName.trim()) | ||||||||||||||
| && (currentUserDetails.lastName === this.state.lastName.trim()) | ||||||||||||||
| && (lodashGet(currentUserDetails, 'timezone.selected') === this.state.selectedTimezone) | ||||||||||||||
| && (lodashGet(currentUserDetails, 'timezone.automatic') === this.state.isAutomaticTimezone) | ||||||||||||||
| && (currentUserDetails.pronouns === this.state.pronouns.trim()); | ||||||||||||||
|
|
||||||||||||||
| const pronounsPickerValue = this.state.hasSelfSelectedPronouns ? CONST.PRONOUNS.SELF_SELECT : this.state.pronouns; | ||||||||||||||
| const pronounsPickerValue = this.state.hasSelfSelectedPronouns ? CONST.PRONOUNS.SELF_SELECT : this.pronouns; | ||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
| <ScreenWrapper> | ||||||||||||||
|
|
@@ -199,10 +205,16 @@ class ProfilePage extends Component { | |||||||||||||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS)} | ||||||||||||||
| onCloseButtonPress={() => Navigation.dismissModal(true)} | ||||||||||||||
| /> | ||||||||||||||
| <ScrollView style={styles.flex1} contentContainerStyle={styles.p5}> | ||||||||||||||
| <Form | ||||||||||||||
| style={[styles.flexGrow1, styles.ph5]} | ||||||||||||||
| formID={CONST.PROFILE_SETTINGS_FORM} | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI now'days we put the form IDs here: Lines 171 to 176 in ff5affd
|
||||||||||||||
| validate={this.validate} | ||||||||||||||
| onSubmit={this.updatePersonalDetails} | ||||||||||||||
| submitButtonText={this.props.translate('common.save')} | ||||||||||||||
| > | ||||||||||||||
| <OfflineWithFeedback | ||||||||||||||
| pendingAction={lodashGet(currentUserDetails, 'pendingFields.avatar', null)} | ||||||||||||||
| errors={lodashGet(currentUserDetails, 'errorFields.avatar', null)} | ||||||||||||||
| pendingAction={lodashGet(this.props.currentUserPersonalDetails, 'pendingFields.avatar', null)} | ||||||||||||||
| errors={lodashGet(this.props.currentUserPersonalDetails, 'errorFields.avatar', null)} | ||||||||||||||
| errorRowStyles={[styles.mt6]} | ||||||||||||||
| onClose={PersonalDetails.clearAvatarErrors} | ||||||||||||||
| > | ||||||||||||||
|
|
@@ -213,45 +225,49 @@ class ProfilePage extends Component { | |||||||||||||
| onImageRemoved={PersonalDetails.deleteAvatar} | ||||||||||||||
| anchorPosition={styles.createMenuPositionProfile} | ||||||||||||||
| size={CONST.AVATAR_SIZE.LARGE} | ||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
|
||||||||||||||
| /> | ||||||||||||||
| </OfflineWithFeedback> | ||||||||||||||
| <Text style={[styles.mt6, styles.mb6]}> | ||||||||||||||
| {this.props.translate('profilePage.tellUsAboutYourself')} | ||||||||||||||
| </Text> | ||||||||||||||
| <FullNameInputRow | ||||||||||||||
| firstName={this.state.firstName} | ||||||||||||||
| firstNameError={PersonalDetails.getMaxCharacterError(this.state.hasFirstNameError)} | ||||||||||||||
| lastName={this.state.lastName} | ||||||||||||||
| lastNameError={PersonalDetails.getMaxCharacterError(this.state.hasLastNameError)} | ||||||||||||||
| onChangeFirstName={firstName => this.setState({firstName})} | ||||||||||||||
| onChangeLastName={lastName => this.setState({lastName})} | ||||||||||||||
| style={[styles.mt4, styles.mb4]} | ||||||||||||||
| /> | ||||||||||||||
|
|
||||||||||||||
liyamahendra marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| <View style={[styles.flexRow, styles.mt4, styles.mb4]}> | ||||||||||||||
| <View style={styles.flex1}> | ||||||||||||||
| <TextInput | ||||||||||||||
| inputID="firstName" | ||||||||||||||
| name="fname" | ||||||||||||||
| label={this.props.translate('common.firstName')} | ||||||||||||||
| defaultValue={lodashGet(currentUserDetails, 'firstName', '')} | ||||||||||||||
| placeholder={this.props.translate('profilePage.john')} | ||||||||||||||
| /> | ||||||||||||||
| </View> | ||||||||||||||
| <View style={[styles.flex1, styles.ml2]}> | ||||||||||||||
| <TextInput | ||||||||||||||
| inputID="lastName" | ||||||||||||||
| name="lname" | ||||||||||||||
| label={this.props.translate('common.lastName')} | ||||||||||||||
| defaultValue={lodashGet(currentUserDetails, 'lastName', '')} | ||||||||||||||
| placeholder={this.props.translate('profilePage.doe')} | ||||||||||||||
| /> | ||||||||||||||
| </View> | ||||||||||||||
| </View> | ||||||||||||||
| <View style={styles.mb6}> | ||||||||||||||
| <Picker | ||||||||||||||
| inputID="pronouns" | ||||||||||||||
| label={this.props.translate('profilePage.preferredPronouns')} | ||||||||||||||
| onInputChange={(pronouns) => { | ||||||||||||||
| const hasSelfSelectedPronouns = pronouns === CONST.PRONOUNS.SELF_SELECT; | ||||||||||||||
| this.setState({ | ||||||||||||||
| pronouns: hasSelfSelectedPronouns ? '' : pronouns, | ||||||||||||||
| hasSelfSelectedPronouns, | ||||||||||||||
| }); | ||||||||||||||
| }} | ||||||||||||||
| items={pronounsList} | ||||||||||||||
| placeholder={{ | ||||||||||||||
| value: '', | ||||||||||||||
| label: this.props.translate('profilePage.selectYourPronouns'), | ||||||||||||||
| }} | ||||||||||||||
| value={pronounsPickerValue} | ||||||||||||||
| defaultValue={pronounsPickerValue} | ||||||||||||||
| /> | ||||||||||||||
| {this.state.hasSelfSelectedPronouns && ( | ||||||||||||||
| <View style={styles.mt2}> | ||||||||||||||
| <TextInput | ||||||||||||||
| value={this.state.pronouns} | ||||||||||||||
| onChangeText={pronouns => this.setState({pronouns})} | ||||||||||||||
| inputID="selfSelectedPronoun" | ||||||||||||||
| defaultValue={this.pronouns} | ||||||||||||||
| placeholder={this.props.translate('profilePage.selfSelectYourPronoun')} | ||||||||||||||
| errorText={PersonalDetails.getMaxCharacterError(this.state.hasPronounError)} | ||||||||||||||
| /> | ||||||||||||||
| </View> | ||||||||||||||
| )} | ||||||||||||||
|
|
@@ -260,37 +276,30 @@ class ProfilePage extends Component { | |||||||||||||
| label={this.props.translate('profilePage.emailAddress')} | ||||||||||||||
| type="email" | ||||||||||||||
| login={this.state.logins.email} | ||||||||||||||
| defaultValue={this.state.logins.email} | ||||||||||||||
| /> | ||||||||||||||
| <LoginField | ||||||||||||||
| label={this.props.translate('common.phoneNumber')} | ||||||||||||||
| type="phone" | ||||||||||||||
| login={this.state.logins.phone} | ||||||||||||||
| defaultValue={this.state.logins.phone} | ||||||||||||||
| /> | ||||||||||||||
| <View style={styles.mb3}> | ||||||||||||||
| <Picker | ||||||||||||||
| inputID="timezone" | ||||||||||||||
| label={this.props.translate('profilePage.timezone')} | ||||||||||||||
| onInputChange={selectedTimezone => this.setState({selectedTimezone})} | ||||||||||||||
| items={timezones} | ||||||||||||||
| isDisabled={this.state.isAutomaticTimezone} | ||||||||||||||
| defaultValue={this.state.selectedTimezone} | ||||||||||||||
| value={this.state.selectedTimezone} | ||||||||||||||
| /> | ||||||||||||||
| </View> | ||||||||||||||
| <CheckboxWithLabel | ||||||||||||||
| inputID="isAutomaticTimezone" | ||||||||||||||
| label={this.props.translate('profilePage.setMyTimezoneAutomatically')} | ||||||||||||||
| isChecked={this.state.isAutomaticTimezone} | ||||||||||||||
| onInputChange={this.setAutomaticTimezone} | ||||||||||||||
| /> | ||||||||||||||
| </ScrollView> | ||||||||||||||
| <FixedFooter> | ||||||||||||||
| <Button | ||||||||||||||
| success | ||||||||||||||
| isDisabled={isButtonDisabled} | ||||||||||||||
| onPress={this.updatePersonalDetails} | ||||||||||||||
| style={[styles.w100]} | ||||||||||||||
| text={this.props.translate('common.save')} | ||||||||||||||
| pressOnEnter | ||||||||||||||
| defaultValue={this.state.isAutomaticTimezone} | ||||||||||||||
| /> | ||||||||||||||
| </FixedFooter> | ||||||||||||||
| </Form> | ||||||||||||||
| </ScreenWrapper> | ||||||||||||||
| ); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.