diff --git a/app/screens/channel_info/options/pinned_messages/index.ts b/app/screens/channel_info/options/pinned_messages/index.ts index df4ec24e0..f5eaf0772 100644 --- a/app/screens/channel_info/options/pinned_messages/index.ts +++ b/app/screens/channel_info/options/pinned_messages/index.ts @@ -6,7 +6,7 @@ import withObservables from '@nozbe/with-observables'; import {of as of$} from 'rxjs'; import {switchMap} from 'rxjs/operators'; -import {observeChannelInfo} from '@queries/servers/channel'; +import {observeChannel, observeChannelInfo} from '@queries/servers/channel'; import PinnedMessages from './pinned_messages'; @@ -17,13 +17,16 @@ type Props = WithDatabaseArgs & { } const enhanced = withObservables(['channelId'], ({channelId, database}: Props) => { + const channel = observeChannel(database, channelId); const info = observeChannelInfo(database, channelId); const count = info.pipe( switchMap((i) => of$(i?.pinnedPostCount || 0)), ); + const displayName = channel.pipe(switchMap((c) => of$(c?.displayName))); return { count, + displayName, }; }); diff --git a/app/screens/channel_info/options/pinned_messages/pinned_messages.tsx b/app/screens/channel_info/options/pinned_messages/pinned_messages.tsx index dc7c5ff6c..7e325a4ed 100644 --- a/app/screens/channel_info/options/pinned_messages/pinned_messages.tsx +++ b/app/screens/channel_info/options/pinned_messages/pinned_messages.tsx @@ -8,19 +8,34 @@ import {Platform} from 'react-native'; import {goToScreen} from '@app/screens/navigation'; import OptionItem from '@components/option_item'; import {Screens} from '@constants'; +import {useTheme} from '@context/theme'; import {preventDoubleTap} from '@utils/tap'; +import {changeOpacity} from '@utils/theme'; type Props = { channelId: string; count: number; + displayName: string; } -const PinnedMessages = ({channelId, count}: Props) => { +const PinnedMessages = ({channelId, count, displayName}: Props) => { + const theme = useTheme(); const {formatMessage} = useIntl(); const title = formatMessage({id: 'channel_info.pinned_messages', defaultMessage: 'Pinned Messages'}); const goToPinnedMessages = preventDoubleTap(() => { - goToScreen(Screens.PINNED_MESSAGES, title, {channelId}); + const options = { + topBar: { + title: { + text: title, + }, + subtitle: { + color: changeOpacity(theme.sidebarHeaderTextColor, 0.72), + text: displayName, + }, + }, + }; + goToScreen(Screens.PINNED_MESSAGES, title, {channelId}, options); }); return ( diff --git a/app/screens/pinned_messages/empty/index.tsx b/app/screens/pinned_messages/empty/index.tsx index bdbbde360..0bf0077a7 100644 --- a/app/screens/pinned_messages/empty/index.tsx +++ b/app/screens/pinned_messages/empty/index.tsx @@ -43,7 +43,7 @@ function EmptySavedPosts() { testID='pinned_messages.empty.title' />