Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e2553d4
Add 'All' tab in Reactions List
try-catch-stack Aug 4, 2022
6ae31b1
Add names to message reactions
try-catch-stack Aug 5, 2022
3797933
useRealName settings
try-catch-stack Aug 11, 2022
1debafa
Move ReactionsList components to separate files
try-catch-stack Aug 11, 2022
78f17c6
Add unit tests and storybook stories
try-catch-stack Aug 22, 2022
d5bfbc2
Add detox test
try-catch-stack Aug 24, 2022
2adbfcb
Fix UsersList styles
diegolmello Aug 25, 2022
501bfca
Move useSelector to top
diegolmello Aug 25, 2022
8a891a4
ListHeaderComponent can be a React component instead of a function
diegolmello Aug 25, 2022
ff4e50b
Fixing more styles
diegolmello Aug 25, 2022
cde3ec7
All tab emojis
diegolmello Aug 25, 2022
fc8e85b
Fix tab styles
diegolmello Aug 25, 2022
40e3346
Fix flatlist notch
diegolmello Aug 25, 2022
3e2a0e8
Fixing tab styles
diegolmello Aug 25, 2022
75afd5d
Update snapshots
diegolmello Aug 25, 2022
fbd5cf4
Fix tabWidth issue on landscape and useRealName on all tab
try-catch-stack Aug 25, 2022
51602c6
Merge branch 'develop' into improve.reactions-list
diegolmello Sep 29, 2022
ea30a99
Fix storybook not displaying the component
diegolmello Sep 29, 2022
2f2e955
Stop baseUrl prop drill
diegolmello Sep 29, 2022
c06e66b
Stop width prop drill
diegolmello Sep 29, 2022
746d8a5
baseUrl and width on RoomView
diegolmello Sep 29, 2022
fba798f
Add 80% snap
diegolmello Sep 29, 2022
21bf216
Update tests
diegolmello Sep 29, 2022
a9f8797
Remove username prop drill and fix some tests
diegolmello Sep 29, 2022
efc03af
Minor style change on header
diegolmello Sep 29, 2022
dc599c5
Update detox tests
diegolmello Sep 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions app/containers/ReactionsList/AllTab.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import { Text, View, FlatList } from 'react-native';
import { useSelector } from 'react-redux';

import Emoji from '../message/Emoji';
import { useTheme } from '../../theme';
import { IReaction } from '../../definitions';
import { IReaction, IApplicationState } from '../../definitions';
import { TGetCustomEmoji } from '../../definitions/IEmoji';
import I18n from '../../i18n';
import styles from './styles';
Expand All @@ -25,15 +26,25 @@ interface IAllTabProps {

const AllReactionsListItem = ({ item, baseUrl, getCustomEmoji, username }: IAllReactionsListItemProps) => {
const { colors } = useTheme();
const useRealName = useSelector((state: IApplicationState) => state.settings.UI_Use_Real_Name);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I react, it doesn't apply use real name anymore

Simulator.Screen.Recording.-.iPhone.11.Pro.-.2022-09-01.at.12.54.43.mp4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could reproduce this on web app as well so probably an issue with the API.

const count = item.usernames.length;
let usernames = item.usernames
.slice(0, 3)
.map((otherUsername: string) => (username === otherUsername ? I18n.t('you') : otherUsername))
.join(', ');

let displayNames;
if (useRealName && item.names) {
Comment thread
diegolmello marked this conversation as resolved.
Resolved
displayNames = item.names
.slice(0, 3)
.map((name, index) => (item.usernames[index] === username ? I18n.t('you') : name))
.join(', ');
} else {
displayNames = item.usernames
.slice(0, 3)
.map((otherUsername: string) => (username === otherUsername ? I18n.t('you') : otherUsername))
.join(', ');
}
if (count > 3) {
usernames = `${usernames} ${I18n.t('and_more')} ${count - 3}`;
displayNames = `${displayNames} ${I18n.t('and_more')} ${count - 3}`;
} else {
usernames = usernames.replace(/,(?=[^,]*$)/, ` ${I18n.t('and')}`);
displayNames = displayNames.replace(/,(?=[^,]*$)/, ` ${I18n.t('and')}`);
}
return (
<View style={styles.listItemContainer}>
Expand All @@ -48,7 +59,7 @@ const AllReactionsListItem = ({ item, baseUrl, getCustomEmoji, username }: IAllR
<Text style={[styles.allListNPeopleReacted, { color: colors.bodyText }]}>
{count === 1 ? I18n.t('1_person_reacted') : I18n.t('N_people_reacted', { n: count })}
</Text>
<Text style={[styles.allListWhoReacted, { color: colors.auxiliaryText }]}>{usernames}</Text>
<Text style={[styles.allListWhoReacted, { color: colors.auxiliaryText }]}>{displayNames}</Text>
</View>
</View>
);
Expand Down
5 changes: 4 additions & 1 deletion app/containers/ReactionsList/ReactionsTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { IReaction } from '../../definitions';
import { TGetCustomEmoji } from '../../definitions/IEmoji';
import I18n from '../../i18n';
import styles, { MIN_TAB_WIDTH } from './styles';
import { useOrientation } from '../../dimensions';

interface ITabBarItem {
baseUrl: string;
Expand Down Expand Up @@ -58,7 +59,9 @@ const TabBarItem = ({ tab, index, goToPage, baseUrl, getCustomEmoji }: ITabBarIt
};

const ReactionsTabBar = ({ tabs, activeTab, goToPage, baseUrl, getCustomEmoji, width }: IReactionsTabBar): React.ReactElement => {
const tabWidth = tabs && Math.max(width / tabs.length, MIN_TAB_WIDTH);
const { isLandscape } = useOrientation();
const reactionsListWidth = isLandscape ? width / 2 : width;
const tabWidth = tabs && Math.max(reactionsListWidth / tabs.length, MIN_TAB_WIDTH);
const { colors } = useTheme();
return (
<View testID='reactionsTabBar'>
Expand Down