1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Unfortunately iOS does not display RTL languages automatically like Android does, so some simple JS library is needed
This commit is contained in:
xmflsct
2022-12-15 00:03:09 +01:00
parent 4a35e910c1
commit c90c8ee8d4
7 changed files with 28 additions and 2 deletions

View File

@ -2,7 +2,9 @@ import { ParseHTML } from '@components/Parse'
import { getInstanceAccount } from '@utils/slices/instancesSlice'
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import { useSelector } from 'react-redux'
import { isRtlLang } from 'rtl-detect'
import StatusContext from './Context'
export interface Props {
@ -31,6 +33,11 @@ const TimelineContent: React.FC<Props> = ({ notificationOwnToot = false, setSpoi
numberOfLines={999}
highlighted={highlighted}
disableDetails={disableDetails}
textStyles={
Platform.OS === 'ios' && status.language && isRtlLang(status.language)
? { writingDirection: 'rtl' }
: undefined
}
/>
<ParseHTML
content={status.content}
@ -50,6 +57,11 @@ const TimelineContent: React.FC<Props> = ({ notificationOwnToot = false, setSpoi
setSpoilerExpanded={setSpoilerExpanded}
highlighted={highlighted}
disableDetails={disableDetails}
textStyles={
Platform.OS === 'ios' && status.language && isRtlLang(status.language)
? { writingDirection: 'rtl' }
: undefined
}
/>
</>
) : (
@ -62,6 +74,11 @@ const TimelineContent: React.FC<Props> = ({ 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
}
/>
)}
</>