[FIX] Avatar's size on display mode change (#4042)
* fix: avatar's size * update snapshot * update: snapshots Co-authored-by: GleidsonDaniel <gleidson10daniel@hotmail.com>
This commit is contained in:
parent
8012031cd3
commit
aab4e4b12a
|
@ -32,7 +32,7 @@ class AvatarContainer extends React.Component<IAvatar, any> {
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: IAvatar, nextState: { avatarETag: string }) {
|
shouldComponentUpdate(nextProps: IAvatar, nextState: { avatarETag: string }) {
|
||||||
const { avatarETag } = this.state;
|
const { avatarETag } = this.state;
|
||||||
const { text, type, externalProviderUrl } = this.props;
|
const { text, type, size, externalProviderUrl } = this.props;
|
||||||
if (nextProps.externalProviderUrl !== externalProviderUrl) {
|
if (nextProps.externalProviderUrl !== externalProviderUrl) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,10 @@ class AvatarContainer extends React.Component<IAvatar, any> {
|
||||||
if (nextProps.type !== type) {
|
if (nextProps.type !== type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (nextProps.size !== size) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ export const LeftActions = React.memo(({ theme, transX, isRead, width, onToggleR
|
||||||
const viewHeight = isCondensed ? { height: ROW_HEIGHT_CONDENSED } : null;
|
const viewHeight = isCondensed ? { height: ROW_HEIGHT_CONDENSED } : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.actionsContainer, styles.actionLeftContainer]} pointerEvents='box-none'>
|
<View style={[styles.actionsContainer, styles.actionsLeftContainer]} pointerEvents='box-none'>
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.actionLeftButtonContainer,
|
styles.actionLeftButtonContainer,
|
||||||
|
|
|
@ -23,7 +23,6 @@ interface IRoomItem {
|
||||||
avatar: string;
|
avatar: string;
|
||||||
showLastMessage: boolean;
|
showLastMessage: boolean;
|
||||||
username: string;
|
username: string;
|
||||||
avatarSize: number;
|
|
||||||
testID: string;
|
testID: string;
|
||||||
width: number;
|
width: number;
|
||||||
status: TUserStatus;
|
status: TUserStatus;
|
||||||
|
@ -59,7 +58,6 @@ interface IRoomItem {
|
||||||
onLongPress(): void;
|
onLongPress(): void;
|
||||||
hideChannel(): void;
|
hideChannel(): void;
|
||||||
autoJoin: boolean;
|
autoJoin: boolean;
|
||||||
size?: number;
|
|
||||||
showAvatar: boolean;
|
showAvatar: boolean;
|
||||||
displayMode: string;
|
displayMode: string;
|
||||||
sourceType: IOmnichannelSource;
|
sourceType: IOmnichannelSource;
|
||||||
|
@ -72,7 +70,6 @@ const RoomItem = ({
|
||||||
name,
|
name,
|
||||||
avatar,
|
avatar,
|
||||||
width,
|
width,
|
||||||
avatarSize = 48,
|
|
||||||
username,
|
username,
|
||||||
showLastMessage,
|
showLastMessage,
|
||||||
status = 'offline',
|
status = 'offline',
|
||||||
|
@ -125,7 +122,6 @@ const RoomItem = ({
|
||||||
<Wrapper
|
<Wrapper
|
||||||
accessibilityLabel={accessibilityLabel}
|
accessibilityLabel={accessibilityLabel}
|
||||||
avatar={avatar}
|
avatar={avatar}
|
||||||
avatarSize={avatarSize}
|
|
||||||
type={type}
|
type={type}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
rid={rid}
|
rid={rid}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import styles from './styles';
|
||||||
interface IWrapper {
|
interface IWrapper {
|
||||||
accessibilityLabel: string;
|
accessibilityLabel: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
avatarSize: number;
|
|
||||||
type: string;
|
type: string;
|
||||||
theme: TSupportedThemes;
|
theme: TSupportedThemes;
|
||||||
rid: string;
|
rid: string;
|
||||||
|
|
|
@ -16,7 +16,6 @@ interface IRoomItemContainerProps {
|
||||||
onPress: Function;
|
onPress: Function;
|
||||||
onLongPress: Function;
|
onLongPress: Function;
|
||||||
username: string;
|
username: string;
|
||||||
avatarSize: number;
|
|
||||||
width: number;
|
width: number;
|
||||||
status: TUserStatus;
|
status: TUserStatus;
|
||||||
toggleFav(): void;
|
toggleFav(): void;
|
||||||
|
@ -56,7 +55,6 @@ class RoomItemContainer extends React.Component<IRoomItemContainerProps, any> {
|
||||||
private roomSubscription: any;
|
private roomSubscription: any;
|
||||||
|
|
||||||
static defaultProps: Partial<IRoomItemContainerProps> = {
|
static defaultProps: Partial<IRoomItemContainerProps> = {
|
||||||
avatarSize: 48,
|
|
||||||
status: 'offline',
|
status: 'offline',
|
||||||
getUserPresence: () => {},
|
getUserPresence: () => {},
|
||||||
getRoomTitle: () => 'title',
|
getRoomTitle: () => 'title',
|
||||||
|
@ -145,7 +143,6 @@ class RoomItemContainer extends React.Component<IRoomItemContainerProps, any> {
|
||||||
hideChannel,
|
hideChannel,
|
||||||
theme,
|
theme,
|
||||||
isFocused,
|
isFocused,
|
||||||
avatarSize,
|
|
||||||
status,
|
status,
|
||||||
showLastMessage,
|
showLastMessage,
|
||||||
username,
|
username,
|
||||||
|
@ -198,7 +195,6 @@ class RoomItemContainer extends React.Component<IRoomItemContainerProps, any> {
|
||||||
type={item.t}
|
type={item.t}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
isFocused={isFocused}
|
isFocused={isFocused}
|
||||||
size={avatarSize}
|
|
||||||
prid={item.prid}
|
prid={item.prid}
|
||||||
status={status}
|
status={status}
|
||||||
hideUnreadStatus={item.hideUnreadStatus}
|
hideUnreadStatus={item.hideUnreadStatus}
|
||||||
|
|
|
@ -8,7 +8,7 @@ export const ACTION_WIDTH = 80;
|
||||||
export const SMALL_SWIPE = ACTION_WIDTH / 2;
|
export const SMALL_SWIPE = ACTION_WIDTH / 2;
|
||||||
export const LONG_SWIPE = ACTION_WIDTH * 3;
|
export const LONG_SWIPE = ACTION_WIDTH * 3;
|
||||||
|
|
||||||
export default StyleSheet.create<any>({
|
export default StyleSheet.create({
|
||||||
flex: {
|
flex: {
|
||||||
flex: 1
|
flex: 1
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue