diff --git a/native/chat/message-reactions-modal.react.js b/native/chat/message-reactions-modal.react.js new file mode 100644 index 000000000..0b0a706ad --- /dev/null +++ b/native/chat/message-reactions-modal.react.js @@ -0,0 +1,141 @@ +// @flow + +import Icon from '@expo/vector-icons/FontAwesome'; +import { useNavigation } from '@react-navigation/native'; +import * as React from 'react'; +import { View, Text, FlatList, TouchableHighlight } from 'react-native'; + +import type { MessageReactionInfo } from 'lib/selectors/chat-selectors'; +import { createMessageReactionsList } from 'lib/shared/reaction-utils'; + +import Modal from '../components/modal.react'; +import type { RootNavigationProp } from '../navigation/root-navigator.react'; +import type { NavigationRoute } from '../navigation/route-names'; +import { useColors, useStyles } from '../themes/colors'; + +export type MessageReactionsModalParams = { + +reactions: $ReadOnlyMap, +}; + +type Props = { + +navigation: RootNavigationProp<'MessageReactionsModal'>, + +route: NavigationRoute<'MessageReactionsModal'>, +}; +function MessageReactionsModal(props: Props): React.Node { + const { reactions } = props.route.params; + + const styles = useStyles(unboundStyles); + const colors = useColors(); + const navigation = useNavigation(); + + const safeAreaEdges = React.useMemo(() => ['top'], []); + + const close = React.useCallback(() => navigation.goBack(), [navigation]); + + const reactionsListData = React.useMemo( + () => createMessageReactionsList(reactions), + [reactions], + ); + + const renderItem = React.useCallback( + ({ item }) => { + return ( + + {item.username} + {item.reaction} + + ); + }, + [ + styles.reactionsListReactionText, + styles.reactionsListRowContainer, + styles.reactionsListUsernameText, + ], + ); + + const itemSeperator = React.useCallback(() => { + return ; + }, [styles.reactionsListItemSeperator]); + + return ( + + + Reactions + + + + + + + ); +} + +const unboundStyles = { + modalStyle: { + // we need to set each margin property explicitly to override + marginLeft: 0, + marginRight: 0, + marginBottom: 0, + marginTop: 0, + justifyContent: 'flex-end', + flex: 0, + borderWidth: 0, + borderTopLeftRadius: 10, + borderTopRightRadius: 10, + }, + modalContainerStyle: { + justifyContent: 'flex-end', + }, + modalContentContainer: { + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + marginBottom: 24, + marginTop: 8, + }, + reactionsListContentContainer: { + paddingBottom: 16, + }, + reactionsListTitleText: { + color: 'modalForegroundLabel', + fontSize: 18, + }, + reactionsListRowContainer: { + flexDirection: 'row', + justifyContent: 'space-between', + }, + reactionsListUsernameText: { + color: 'modalForegroundLabel', + fontSize: 18, + }, + reactionsListReactionText: { + fontSize: 18, + }, + reactionsListItemSeperator: { + height: 16, + }, + closeButton: { + borderRadius: 4, + width: 18, + height: 18, + alignItems: 'center', + }, + closeIcon: { + color: 'modalBackgroundSecondaryLabel', + }, +}; + +export default MessageReactionsModal; diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js index 70f69d202..69cba9b74 100644 --- a/native/navigation/route-names.js +++ b/native/navigation/route-names.js @@ -1,184 +1,187 @@ // @flow import type { RouteProp } from '@react-navigation/native'; import type { TermsAndPrivacyModalParams } from '../account/terms-and-privacy-modal.react'; import type { ThreadPickerModalParams } from '../calendar/thread-picker-modal.react'; import type { ComposeSubchannelParams } from '../chat/compose-subchannel.react'; import type { ImagePasteModalParams } from '../chat/image-paste-modal.react'; import type { MessageListParams } from '../chat/message-list-types'; +import type { MessageReactionsModalParams } from '../chat/message-reactions-modal.react'; import type { MultimediaMessageTooltipModalParams } from '../chat/multimedia-message-tooltip-modal.react'; import type { RobotextMessageTooltipModalParams } from '../chat/robotext-message-tooltip-modal.react'; import type { AddUsersModalParams } from '../chat/settings/add-users-modal.react'; import type { ColorSelectorModalParams } from '../chat/settings/color-selector-modal.react'; import type { ComposeSubchannelModalParams } from '../chat/settings/compose-subchannel-modal.react'; import type { DeleteThreadParams } from '../chat/settings/delete-thread.react'; import type { ThreadSettingsMemberTooltipModalParams } from '../chat/settings/thread-settings-member-tooltip-modal.react'; import type { ThreadSettingsParams } from '../chat/settings/thread-settings.react'; import type { SidebarListModalParams } from '../chat/sidebar-list-modal.react'; import type { SubchannelListModalParams } from '../chat/subchannels-list-modal.react'; import type { TextMessageTooltipModalParams } from '../chat/text-message-tooltip-modal.react'; import type { CameraModalParams } from '../media/camera-modal.react'; import type { ImageModalParams } from '../media/image-modal.react'; import type { VideoPlaybackModalParams } from '../media/video-playback-modal.react'; import type { CustomServerModalParams } from '../profile/custom-server-modal.react'; import type { RelationshipListItemTooltipModalParams } from '../profile/relationship-list-item-tooltip-modal.react'; import type { ActionResultModalParams } from './action-result-modal.react'; export const ActionResultModalRouteName = 'ActionResultModal'; export const AddUsersModalRouteName = 'AddUsersModal'; export const AppearancePreferencesRouteName = 'AppearancePreferences'; export const AppRouteName = 'App'; export const AppsRouteName = 'Apps'; export const BackgroundChatThreadListRouteName = 'BackgroundChatThreadList'; export const BlockListRouteName = 'BlockList'; export const BuildInfoRouteName = 'BuildInfo'; export const CalendarRouteName = 'Calendar'; export const CameraModalRouteName = 'CameraModal'; export const ChatRouteName = 'Chat'; export const ChatThreadListRouteName = 'ChatThreadList'; export const ColorSelectorModalRouteName = 'ColorSelectorModal'; export const ComposeSubchannelModalRouteName = 'ComposeSubchannelModal'; export const ComposeSubchannelRouteName = 'ComposeSubchannel'; export const CommunityDrawerNavigatorRouteName = 'CommunityDrawerNavigator'; export const CustomServerModalRouteName = 'CustomServerModal'; export const DefaultNotificationsPreferencesRouteName = 'DefaultNotifications'; export const DeleteAccountRouteName = 'DeleteAccount'; export const DeleteThreadRouteName = 'DeleteThread'; export const DevToolsRouteName = 'DevTools'; export const EditPasswordRouteName = 'EditPassword'; export const FriendListRouteName = 'FriendList'; export const HomeChatThreadListRouteName = 'HomeChatThreadList'; export const ImageModalRouteName = 'ImageModal'; export const ImagePasteModalRouteName = 'ImagePasteModal'; export const LoggedOutModalRouteName = 'LoggedOutModal'; export const MessageListRouteName = 'MessageList'; +export const MessageReactionsModalRouteName = 'MessageReactionsModal'; export const MultimediaMessageTooltipModalRouteName = 'MultimediaMessageTooltipModal'; export const PrivacyPreferencesRouteName = 'PrivacyPreferences'; export const ProfileRouteName = 'Profile'; export const ProfileScreenRouteName = 'ProfileScreen'; export const RelationshipListItemTooltipModalRouteName = 'RelationshipListItemTooltipModal'; export const RobotextMessageTooltipModalRouteName = 'RobotextMessageTooltipModal'; export const SidebarListModalRouteName = 'SidebarListModal'; export const SubchannelsListModalRouteName = 'SubchannelsListModal'; export const TabNavigatorRouteName = 'TabNavigator'; export const TextMessageTooltipModalRouteName = 'TextMessageTooltipModal'; export const ThreadPickerModalRouteName = 'ThreadPickerModal'; export const ThreadSettingsMemberTooltipModalRouteName = 'ThreadSettingsMemberTooltipModal'; export const ThreadSettingsRouteName = 'ThreadSettings'; export const VideoPlaybackModalRouteName = 'VideoPlaybackModal'; export const TermsAndPrivacyRouteName = 'TermsAndPrivacyModal'; export type RootParamList = { +LoggedOutModal: void, +App: void, +ThreadPickerModal: ThreadPickerModalParams, +AddUsersModal: AddUsersModalParams, +CustomServerModal: CustomServerModalParams, +ColorSelectorModal: ColorSelectorModalParams, +ComposeSubchannelModal: ComposeSubchannelModalParams, +SidebarListModal: SidebarListModalParams, +ImagePasteModal: ImagePasteModalParams, +TermsAndPrivacyModal: TermsAndPrivacyModalParams, +SubchannelsListModal: SubchannelListModalParams, + +MessageReactionsModal: MessageReactionsModalParams, }; export type MessageTooltipRouteNames = | typeof RobotextMessageTooltipModalRouteName | typeof MultimediaMessageTooltipModalRouteName | typeof TextMessageTooltipModalRouteName; export type TooltipModalParamList = { +MultimediaMessageTooltipModal: MultimediaMessageTooltipModalParams, +TextMessageTooltipModal: TextMessageTooltipModalParams, +ThreadSettingsMemberTooltipModal: ThreadSettingsMemberTooltipModalParams, +RelationshipListItemTooltipModal: RelationshipListItemTooltipModalParams, +RobotextMessageTooltipModal: RobotextMessageTooltipModalParams, }; export type OverlayParamList = { +CommunityDrawerNavigator: void, +ImageModal: ImageModalParams, +ActionResultModal: ActionResultModalParams, +CameraModal: CameraModalParams, +VideoPlaybackModal: VideoPlaybackModalParams, ...TooltipModalParamList, }; export type TabParamList = { +Calendar: void, +Chat: void, +Profile: void, +Apps: void, }; export type ChatParamList = { +ChatThreadList: void, +MessageList: MessageListParams, +ComposeSubchannel: ComposeSubchannelParams, +ThreadSettings: ThreadSettingsParams, +DeleteThread: DeleteThreadParams, }; export type ChatTopTabsParamList = { +HomeChatThreadList: void, +BackgroundChatThreadList: void, }; export type ProfileParamList = { +ProfileScreen: void, +EditPassword: void, +DeleteAccount: void, +BuildInfo: void, +DevTools: void, +AppearancePreferences: void, +PrivacyPreferences: void, +DefaultNotifications: void, +FriendList: void, +BlockList: void, }; export type CommunityDrawerParamList = { +TabNavigator: void }; export type ScreenParamList = { ...RootParamList, ...OverlayParamList, ...TabParamList, ...ChatParamList, ...ChatTopTabsParamList, ...ProfileParamList, ...CommunityDrawerParamList, }; export type NavigationRoute< RouteName: string = $Keys, > = RouteProp; export const accountModals = [LoggedOutModalRouteName]; export const scrollBlockingModals = [ ImageModalRouteName, MultimediaMessageTooltipModalRouteName, TextMessageTooltipModalRouteName, ThreadSettingsMemberTooltipModalRouteName, RelationshipListItemTooltipModalRouteName, RobotextMessageTooltipModalRouteName, VideoPlaybackModalRouteName, ]; export const chatRootModals = [ AddUsersModalRouteName, ColorSelectorModalRouteName, ComposeSubchannelModalRouteName, ]; export const threadRoutes = [ MessageListRouteName, ThreadSettingsRouteName, DeleteThreadRouteName, ComposeSubchannelRouteName, ];