diff --git a/native/chat/message-reactions-modal.react.js b/native/chat/message-reactions-modal.react.js new file mode 100644 --- /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 --- a/native/navigation/route-names.js +++ b/native/navigation/route-names.js @@ -7,6 +7,7 @@ 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'; @@ -53,6 +54,7 @@ export const ImagePasteModalRouteName = 'ImagePasteModal'; export const LoggedOutModalRouteName = 'LoggedOutModal'; export const MessageListRouteName = 'MessageList'; +export const MessageReactionsModalRouteName = 'MessageReactionsModal'; export const MultimediaMessageTooltipModalRouteName = 'MultimediaMessageTooltipModal'; export const PrivacyPreferencesRouteName = 'PrivacyPreferences'; @@ -85,6 +87,7 @@ +ImagePasteModal: ImagePasteModalParams, +TermsAndPrivacyModal: TermsAndPrivacyModalParams, +SubchannelsListModal: SubchannelListModalParams, + +MessageReactionsModal: MessageReactionsModalParams, }; export type MessageTooltipRouteNames =