diff --git a/src/screens/Compose.tsx b/src/screens/Compose.tsx index c807725f..3c02df5e 100644 --- a/src/screens/Compose.tsx +++ b/src/screens/Compose.tsx @@ -5,8 +5,8 @@ import { HeaderLeft, HeaderRight } from '@components/Header' import { createNativeStackNavigator } from '@react-navigation/native-stack' import haptics from '@root/components/haptics' import { useAppDispatch } from '@root/store' -import formatText from '@screens/Compose/formatText' import ComposeRoot from '@screens/Compose/Root' +import formatText from '@screens/Compose/utils/formatText' import * as Sentry from '@sentry/react-native' import { RootStackScreenProps } from '@utils/navigation/navigators' import { useTimelineMutation } from '@utils/queryHooks/timeline' diff --git a/src/screens/Compose/DraftsList/Root.tsx b/src/screens/Compose/DraftsList/Root.tsx index aa8fd1c9..7ea9ffa1 100644 --- a/src/screens/Compose/DraftsList/Root.tsx +++ b/src/screens/Compose/DraftsList/Root.tsx @@ -14,8 +14,8 @@ import { Dimensions, Image, Modal, Platform, Pressable, View } from 'react-nativ import { PanGestureHandler } from 'react-native-gesture-handler' import { SwipeListView } from 'react-native-swipe-list-view' import { useSelector } from 'react-redux' -import formatText from '../formatText' import ComposeContext from '../utils/createContext' +import formatText from '../utils/formatText' import { ComposeStateDraft, ExtendedAttachment } from '../utils/types' export interface Props { diff --git a/src/screens/Compose/Root/Header/SpoilerInput.tsx b/src/screens/Compose/Root/Header/SpoilerInput.tsx index b16ae90e..ed991158 100644 --- a/src/screens/Compose/Root/Header/SpoilerInput.tsx +++ b/src/screens/Compose/Root/Header/SpoilerInput.tsx @@ -7,8 +7,8 @@ import React, { useContext } from 'react' import { useTranslation } from 'react-i18next' import { TextInput } from 'react-native' import { useSelector } from 'react-redux' -import formatText from '../../formatText' import ComposeContext from '../../utils/createContext' +import formatText from '../../utils/formatText' const ComposeSpoilerInput: React.FC = () => { const { composeState, composeDispatch } = useContext(ComposeContext) diff --git a/src/screens/Compose/Root/Header/TextInput.tsx b/src/screens/Compose/Root/Header/TextInput.tsx index ab1f9f8a..e8216012 100644 --- a/src/screens/Compose/Root/Header/TextInput.tsx +++ b/src/screens/Compose/Root/Header/TextInput.tsx @@ -9,8 +9,8 @@ import React, { useContext } from 'react' import { useTranslation } from 'react-i18next' import { Alert } from 'react-native' import { useSelector } from 'react-redux' -import formatText from '../../formatText' import ComposeContext from '../../utils/createContext' +import formatText from '../../utils/formatText' import { uploadAttachment } from '../Footer/addAttachment' const ComposeTextInput: React.FC = () => { diff --git a/src/screens/Compose/Root/Suggestion.tsx b/src/screens/Compose/Root/Suggestion.tsx index 61a127d2..8f02b8b5 100644 --- a/src/screens/Compose/Root/Suggestion.tsx +++ b/src/screens/Compose/Root/Suggestion.tsx @@ -3,8 +3,8 @@ import analytics from '@components/analytics' import haptics from '@components/haptics' import ComponentHashtag from '@components/Hashtag' import React, { useContext, useEffect } from 'react' -import formatText from '../formatText' import ComposeContext from '../utils/createContext' +import formatText from '../utils/formatText' type Props = { item: Mastodon.Account & Mastodon.Tag } diff --git a/src/screens/Compose/formatText.tsx b/src/screens/Compose/utils/formatText.tsx similarity index 96% rename from src/screens/Compose/formatText.tsx rename to src/screens/Compose/utils/formatText.tsx index ef198307..a82be98f 100644 --- a/src/screens/Compose/formatText.tsx +++ b/src/screens/Compose/utils/formatText.tsx @@ -3,8 +3,8 @@ import { debounce, differenceWith, isEqual } from 'lodash' import React, { Dispatch } from 'react' import { FetchOptions } from 'react-query/types/core/query' import { useTheme } from '@utils/styles/ThemeManager' -import { ComposeAction, ComposeState } from './utils/types' -import { instanceConfigurationStatusCharsURL } from './Root' +import { ComposeAction, ComposeState } from './types' +import { instanceConfigurationStatusCharsURL } from '../Root' import CustomText from '@components/Text' import { emojis } from '@components/Emojis' @@ -43,7 +43,7 @@ linkify var tail = text.slice(pos) if (!self.re.hashtag) { - self.re.hashtag = new RegExp('^[A-Za-z0-9_]+') + self.re.hashtag = new RegExp('^[\\S]+') } if (self.re.hashtag.test(tail)) { return tail.match(self.re.hashtag)![0].length