mattermost-mobile/app/screens/edit_profile/components/profile_error.tsx
Avinash Lingaloo 47e4306361
MM-39712 - Edit Profile Screen without image picker (#5849)
* feature edit profile screen

* minor refactoring

* Apply suggestions from code review

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* ts fixes

* revert floatingTextInput label

This reverts commit a778e1f76191aea7c1a18d60a23ffbd6d3dec0eb.

* code clean up

* Apply suggestions from code review

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* code fix

* code fix

* Adding preventDoubleTap

* rename id to fieldKey

* Update edit_profile.tsx

* wip

* navigating through fields; partly done

* navigating through fields - partly done

* navigating through fields; partly done

* completed field navigation

* added theme into dependency array

* code clean up

* revert conditions for disabling fields

* Added colorFilters prop to Loading component

* Completed loading feature on Edit Profile screen

* code clean up

* Add profile_error

* renamed valid_mime_types to  valid_image_mime_types

* added props isDisabled to email field

* refactored next field logic

* fix

* fix

* code clean up

* code clean up

* Updated ESLINT hook rules to warning instead of disabled

* code fix

* code fix

* new line within your_profile component

* added memo for Field component

* added canSave to dependency array

* update loading component - color filter

* Update app/screens/edit_profile/edit_profile.tsx

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* dependency fix

* fix to fetch my latest status

* fix to remove unnecessary user id for local action updateLocalUser

* prevents bouncing for iOS

* code revert

* Adding  textInputStyle and animatedTextStyle to FloatingTextInput component

* correction after dev session

* adding changes as per new ux

* Update edit_profile.tsx

* corrections after ux review

* ux review

* ux review

* code clean up

* Adding userProfileFields into useMemo

* Add enableSaveButton to dependency of submitUser

* Revert fetching status on userProfile

* EditProfile enable extraScrollHeight on iOS only

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-12-23 15:16:55 +04:00

60 lines
1.7 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {View} from 'react-native';
import CompassIcon from '@components/compass_icon';
import ErrorText from '@components/error_text';
import {useTheme} from '@context/theme';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
import {typography} from '@utils/typography';
type DisplayErrorProps = {
error: Partial<ClientErrorProps> | string;
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
errorContainer: {
backgroundColor: changeOpacity(theme.errorTextColor, 0.08),
width: '100%',
maxHeight: 48,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
},
text: {
...typography('Heading', 100),
color: theme.centerChannelColor,
},
icon: {
color: changeOpacity(theme.dndIndicator, 0.64),
...typography('Heading', 300),
marginRight: 9,
},
};
});
const ProfileError = ({error}: DisplayErrorProps) => {
const theme = useTheme();
const style = getStyleSheet(theme);
return (
<View style={style.errorContainer}>
<CompassIcon
style={style.icon}
size={18}
name='alert-outline'
/>
<ErrorText
theme={theme}
testID='edit_profile.error.text'
error={error}
textStyle={style.text}
/>
</View>
);
};
export default ProfileError;