about summary refs log tree commit diff
path: root/src/view/com/util/text
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-04-06 17:12:48 -0500
committerGitHub <noreply@github.com>2023-04-06 17:12:48 -0500
commit7c99df33adb722ec207d24a9caf7292a95b75154 (patch)
tree2eae8e0fc426cdffbd7b9afe0c69983011aed4c0 /src/view/com/util/text
parent1fa9402453d4de5577d4f7fdb0b4d807121d033c (diff)
downloadvoidsky-7c99df33adb722ec207d24a9caf7292a95b75154.tar.zst
Fix to post overflow on web (close #395) (#407)
Diffstat (limited to 'src/view/com/util/text')
-rw-r--r--src/view/com/util/text/RichText.tsx15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/view/com/util/text/RichText.tsx b/src/view/com/util/text/RichText.tsx
index 804db002a..0dc13fd34 100644
--- a/src/view/com/util/text/RichText.tsx
+++ b/src/view/com/util/text/RichText.tsx
@@ -8,6 +8,8 @@ import {toShortUrl} from 'lib/strings/url-helpers'
 import {useTheme, TypographyVariant} from 'lib/ThemeContext'
 import {usePalette} from 'lib/hooks/usePalette'
 
+const WORD_WRAP = {wordWrap: 1}
+
 export function RichText({
   testID,
   type = 'md',
@@ -39,7 +41,8 @@ export function RichText({
         lineHeight: 30,
       }
       return (
-        <Text testID={testID} style={[style, pal.text]}>
+        // @ts-ignore web only -prf
+        <Text testID={testID} style={[style, pal.text]} dataSet={WORD_WRAP}>
           {text}
         </Text>
       )
@@ -48,7 +51,9 @@ export function RichText({
       <Text
         testID={testID}
         type={type}
-        style={[style, pal.text, lineHeightStyle]}>
+        style={[style, pal.text, lineHeightStyle]}
+        // @ts-ignore web only -prf
+        dataSet={WORD_WRAP}>
         {text}
       </Text>
     )
@@ -72,6 +77,7 @@ export function RichText({
           text={segment.text}
           href={`/profile/${mention.did}`}
           style={[style, lineHeightStyle, pal.link]}
+          dataSet={WORD_WRAP}
         />,
       )
     } else if (link && AppBskyRichtextFacet.validateLink(link).success) {
@@ -82,6 +88,7 @@ export function RichText({
           text={toShortUrl(segment.text)}
           href={link.uri}
           style={[style, lineHeightStyle, pal.link]}
+          dataSet={WORD_WRAP}
         />,
       )
     } else {
@@ -94,7 +101,9 @@ export function RichText({
       testID={testID}
       type={type}
       style={[style, pal.text, lineHeightStyle]}
-      numberOfLines={numberOfLines}>
+      numberOfLines={numberOfLines}
+      // @ts-ignore web only -prf
+      dataSet={WORD_WRAP}>
       {els}
     </Text>
   )