diff --git a/package.json b/package.json index 714441c9..08394d14 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "react-native-tab-view": "^3.3.4", "react-redux": "^8.0.5", "rn-placeholder": "^3.0.3", - "rtl-detect": "^1.0.4", "valid-url": "^1.0.9", "zeego": "^1.0.2" }, diff --git a/src/components/Timeline/Shared/Content.tsx b/src/components/Timeline/Shared/Content.tsx index a803c5e7..c6003378 100644 --- a/src/components/Timeline/Shared/Content.tsx +++ b/src/components/Timeline/Shared/Content.tsx @@ -3,10 +3,10 @@ import CustomText from '@components/Text' import { usePreferencesQuery } from '@utils/queryHooks/preferences' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' +import i18next from 'i18next' import React, { useContext } from 'react' import { useTranslation } from 'react-i18next' import { Platform, View } from 'react-native' -import { isRtlLang } from 'rtl-detect' import StatusContext from './Context' export interface Props { @@ -23,6 +23,11 @@ const TimelineContent: React.FC = ({ notificationOwnToot = false, setSpoi const { data: preferences } = usePreferencesQuery() + const isRTLiOSTextStyles = + Platform.OS === 'ios' && status.language && i18next.dir(status.language) === 'rtl' + ? ({ writingDirection: 'rtl' } as { writingDirection: 'rtl' }) + : undefined + return ( {status.spoiler_text?.length ? ( @@ -37,11 +42,7 @@ const TimelineContent: React.FC = ({ notificationOwnToot = false, setSpoi numberOfLines={999} highlighted={highlighted} disableDetails={disableDetails} - textStyles={ - Platform.OS === 'ios' && status.language && isRtlLang(status.language) - ? { writingDirection: 'rtl' } - : undefined - } + textStyles={isRTLiOSTextStyles} /> {inThread ? ( = ({ notificationOwnToot = false, setSpoi setSpoilerExpanded={setSpoilerExpanded} highlighted={highlighted} disableDetails={disableDetails} - textStyles={ - Platform.OS === 'ios' && status.language && isRtlLang(status.language) - ? { writingDirection: 'rtl' } - : undefined - } + textStyles={isRTLiOSTextStyles} /> ) : ( @@ -90,11 +87,7 @@ const TimelineContent: React.FC = ({ notificationOwnToot = false, setSpoi tags={status.tags} numberOfLines={highlighted || inThread ? 999 : notificationOwnToot ? 2 : undefined} disableDetails={disableDetails} - textStyles={ - Platform.OS === 'ios' && status.language && isRtlLang(status.language) - ? { writingDirection: 'rtl' } - : undefined - } + textStyles={isRTLiOSTextStyles} /> )} diff --git a/yarn.lock b/yarn.lock index 76a3f0bd..8af41fd1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10232,7 +10232,7 @@ __metadata: languageName: node linkType: hard -"rtl-detect@npm:^1.0.2, rtl-detect@npm:^1.0.4": +"rtl-detect@npm:^1.0.2": version: 1.0.4 resolution: "rtl-detect@npm:1.0.4" checksum: d562535baa0db62f57f0a1d4676297bff72fd6b94e88f0f0900d5c3e810ab512c5c4cadffd3e05fbe8d9c74310c919afa3ea8c1001c244e5555e8eef12d02d6f @@ -11304,7 +11304,6 @@ __metadata: react-native-tab-view: ^3.3.4 react-redux: ^8.0.5 rn-placeholder: ^3.0.3 - rtl-detect: ^1.0.4 typescript: ^4.9.4 valid-url: ^1.0.9 zeego: ^1.0.2