From 0272cd5d47be6b6ce4b7f3c9afadbe9268022089 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 25 Jul 2018 04:50:22 -0400 Subject: [PATCH] MM-11421 Add max lengths when editing user profile fields (#1940) --- app/screens/edit_profile/edit_profile.js | 3 +++ app/screens/edit_profile/edit_profile_item.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/app/screens/edit_profile/edit_profile.js b/app/screens/edit_profile/edit_profile.js index bb937bbd9..c4ceddc0d 100644 --- a/app/screens/edit_profile/edit_profile.js +++ b/app/screens/edit_profile/edit_profile.js @@ -294,6 +294,7 @@ export default class EditProfile extends PureComponent { id: 'user.settings.general.field_handled_externally', defaultMessage: 'This field is handled through your login provider. If you want to change it, you need to do so through your login provider.', })} + maxLength={22} updateValue={this.updateField} theme={theme} value={username} @@ -385,6 +386,7 @@ export default class EditProfile extends PureComponent { id: 'user.settings.general.field_handled_externally', defaultMessage: 'This field is handled through your login provider. If you want to change it, you need to do so through your login provider.', })} + maxLength={22} updateValue={this.updateField} theme={theme} value={nickname} @@ -409,6 +411,7 @@ export default class EditProfile extends PureComponent { id: 'user.settings.general.field_handled_externally', defaultMessage: 'This field is handled through your login provider. If you want to change it, you need to do so through your login provider.', })} + maxLength={128} updateValue={this.updateField} theme={theme} value={position} diff --git a/app/screens/edit_profile/edit_profile_item.js b/app/screens/edit_profile/edit_profile_item.js index b1ee3751a..7dc784027 100644 --- a/app/screens/edit_profile/edit_profile_item.js +++ b/app/screens/edit_profile/edit_profile_item.js @@ -21,6 +21,7 @@ export default class AccountSettingsItem extends PureComponent { defaultMessage: PropTypes.string.isRequired, }), helpText: PropTypes.string, + maxLength: PropTypes.number, optional: PropTypes.bool, theme: PropTypes.object.isRequired, updateValue: PropTypes.func.isRequired, @@ -72,6 +73,7 @@ export default class AccountSettingsItem extends PureComponent { style={[style.input, disabled ? style.disabled : null]} autoCapitalize='none' autoCorrect={false} + maxLength={this.props.maxLength} editable={!disabled} underlineColorAndroid='transparent' disableFullscreenUI={true}