Files
mattermost-mobile/app/screens/thread_options/options/open_in_channel_option.tsx
Elias Nahum 7aa5bd0611 Update Dependencies and bug fixes (#7000)
* update dependencies

* update dependencies

* feedback review

* update @mattermost/react-native-turbo-mailer
2023-01-24 09:14:23 +02:00

40 lines
1.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useCallback} from 'react';
import {useIntl} from 'react-intl';
import {showPermalink} from '@actions/remote/permalink';
import {BaseOption} from '@components/common_post_options';
import {useServerUrl} from '@context/server';
import {t} from '@i18n';
import {dismissBottomSheet} from '@screens/navigation';
import type {AvailableScreens} from '@typings/screens/navigation';
type Props = {
bottomSheetId: AvailableScreens;
threadId: string;
}
const OpenInChannelOption = ({bottomSheetId, threadId}: Props) => {
const intl = useIntl();
const serverUrl = useServerUrl();
const onHandlePress = useCallback(async () => {
await dismissBottomSheet(bottomSheetId);
showPermalink(serverUrl, '', threadId);
}, [bottomSheetId, intl, serverUrl, threadId]);
return (
<BaseOption
i18nId={t('global_threads.options.open_in_channel')}
defaultMessage='Open in Channel'
iconName='globe'
onPress={onHandlePress}
testID='thread_options.open_in_channel.option'
/>
);
};
export default OpenInChannelOption;