deconstruct formatMessage from useIntl

This commit is contained in:
Jason Frerich
2022-12-04 21:37:44 -06:00
parent 6e89d4458e
commit da8f13283f

View File

@@ -20,11 +20,11 @@ type Props = {
} }
const AddPeopleBox = ({channelId, containerStyle, displayName, inModal, testID}: Props) => { const AddPeopleBox = ({channelId, containerStyle, displayName, inModal, testID}: Props) => {
const intl = useIntl(); const {formatMessage} = useIntl();
const theme = useTheme(); const theme = useTheme();
const onAddPeople = useCallback(async () => { const onAddPeople = useCallback(async () => {
const title = intl.formatMessage({id: 'mobile.channel_add_people.title', defaultMessage: 'Add Members'}); const title = formatMessage({id: 'mobile.channel_add_people.title', defaultMessage: 'Add Members'});
const options = { const options = {
topBar: { topBar: {
subtitle: { subtitle: {
@@ -39,7 +39,7 @@ const AddPeopleBox = ({channelId, containerStyle, displayName, inModal, testID}:
} }
await dismissBottomSheet(); await dismissBottomSheet();
showModal(Screens.CHANNEL_ADD_PEOPLE, title, {channelId}); showModal(Screens.CHANNEL_ADD_PEOPLE, title, {channelId});
}, [intl, channelId, inModal]); }, [formatMessage, channelId, inModal]);
return ( return (
<OptionBox <OptionBox
@@ -47,7 +47,7 @@ const AddPeopleBox = ({channelId, containerStyle, displayName, inModal, testID}:
iconName='account-plus-outline' iconName='account-plus-outline'
onPress={onAddPeople} onPress={onAddPeople}
testID={testID} testID={testID}
text={intl.formatMessage({id: 'intro.add_people', defaultMessage: 'Add People'})} text={formatMessage({id: 'intro.add_people', defaultMessage: 'Add People'})}
/> />
); );
}; };