* update dev deps
* partial update dependencies
* update watermelondb
* update rn to 0.76.5, expo to 52.0.18 and others
* upgrade android firebase
* upgrade detox deps
* fix package-lock.json
* update emm and paste-input
* update turbo-log
* update network library
* fix tests
* review feedback
* fix Keyboard blocking signIn button
* Fall back to iphone 14 iOS 17.2 simulator as app crashes on iOS 17.4
* changes in deleteCredentialsForServer is causing a crash
* withOptions x2 clearly is wrong
* re-add cli-platform-apple fix
* fix: RN 0.76.5 issue with bottom sheet disappearing (#8478)
* experiment, using view vs BottomSheetView
* revert previous & try disabling enableDynamicSizing
* revert an unintended removal
---------
Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Rahim Rahman <rahim.rahman@mattermost.com>
(cherry picked from commit 2f3dfbbbfa)
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {useEffect} from 'react';
|
|
|
|
import {fetchUserByIdBatched} from '@actions/remote/user';
|
|
import CompassIcon from '@components/compass_icon';
|
|
import ProfilePicture from '@components/profile_picture';
|
|
import {useServerUrl} from '@context/server';
|
|
import {useTheme} from '@context/theme';
|
|
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
|
|
|
import type UserModel from '@typings/database/models/servers/user';
|
|
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
|
|
|
|
type Props = {
|
|
authorId: string;
|
|
author?: UserModel;
|
|
isOnCenterBg?: boolean;
|
|
style: StyleProp<Intersection<TextStyle, ViewStyle>>;
|
|
size: number;
|
|
}
|
|
|
|
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
|
|
status: {
|
|
backgroundColor: theme.sidebarBg,
|
|
borderWidth: 0,
|
|
},
|
|
statusOnCenterBg: {
|
|
backgroundColor: theme.centerChannelBg,
|
|
},
|
|
icon: {
|
|
color: changeOpacity(theme.sidebarText, 0.4),
|
|
left: 1,
|
|
},
|
|
iconOnCenterBg: {
|
|
color: changeOpacity(theme.centerChannelColor, 0.72),
|
|
},
|
|
}));
|
|
|
|
const DmAvatar = ({
|
|
authorId,
|
|
author,
|
|
isOnCenterBg,
|
|
style,
|
|
size,
|
|
}: Props) => {
|
|
const theme = useTheme();
|
|
const serverUrl = useServerUrl();
|
|
const styles = getStyleSheet(theme);
|
|
|
|
useEffect(() => {
|
|
if (authorId && !author) {
|
|
fetchUserByIdBatched(serverUrl, authorId);
|
|
}
|
|
}, []);
|
|
if (author?.deleteAt) {
|
|
return (
|
|
<CompassIcon
|
|
name='archive-outline'
|
|
style={[styles.icon, style, isOnCenterBg && styles.iconOnCenterBg]}
|
|
size={24}
|
|
/>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<ProfilePicture
|
|
author={author}
|
|
size={size}
|
|
showStatus={true}
|
|
statusSize={12}
|
|
statusStyle={[styles.status, isOnCenterBg && styles.statusOnCenterBg]}
|
|
containerStyle={style}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default DmAvatar;
|