Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3358591
D7614.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7614.diff
View Options
diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js
--- a/native/chat/message-list-container.react.js
+++ b/native/chat/message-list-container.react.js
@@ -1,9 +1,10 @@
// @flow
+import Icon from '@expo/vector-icons/FontAwesome5.js';
import { useNavigationState } from '@react-navigation/native';
import invariant from 'invariant';
import * as React from 'react';
-import { View } from 'react-native';
+import { View, Text } from 'react-native';
import genesis from 'lib/facts/genesis.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
@@ -209,6 +210,18 @@
}
const unboundStyles = {
+ pinnedCountBanner: {
+ backgroundColor: 'panelForeground',
+ height: 30,
+ flexDirection: 'row',
+ textAlign: 'center',
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
+ pinnedCountText: {
+ color: 'panelBackgroundLabel',
+ marginRight: 5,
+ },
container: {
backgroundColor: 'listBackground',
flex: 1,
@@ -349,8 +362,39 @@
state => threadInfoSelector(state)[genesis.id],
);
+ let bannerText;
+ if (!threadInfo.pinnedCount || threadInfo.pinnedCount === 0) {
+ bannerText = '';
+ } else {
+ const messageNoun = threadInfo.pinnedCount === 1 ? 'message' : 'messages';
+ bannerText = `${threadInfo.pinnedCount} pinned ${messageNoun}`;
+ }
+
+ const pinnedCountBanner = React.useMemo(() => {
+ if (!bannerText) {
+ return null;
+ }
+
+ return (
+ <View style={styles.pinnedCountBanner}>
+ <Text style={styles.pinnedCountText}>{bannerText}</Text>
+ <Icon
+ name="chevron-right"
+ size={12}
+ color={colors.panelBackgroundLabel}
+ />
+ </View>
+ );
+ }, [
+ bannerText,
+ styles.pinnedCountBanner,
+ styles.pinnedCountText,
+ colors.panelBackgroundLabel,
+ ]);
+
return (
<MessageListContextProvider threadInfo={threadInfo}>
+ {pinnedCountBanner}
<MessageListContainer
{...props}
usernameInputText={usernameInputText}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 5:36 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578501
Default Alt Text
D7614.diff (2 KB)
Attached To
Mode
D7614: [native] Display the number of pinned messages in a banner across chat
Attached
Detach File
Event Timeline
Log In to Comment