Skip to content

Commit 0a69f35

Browse files
committed
fix: use explicit TextDirection.Rtl in TextStyle for Hebrew verses
CompositionLocalProvider approach didn't reliably flip text direction for Hebrew OT text. Now using TextStyle with textDirection=TextDirection.Rtl + textAlign=TextAlign.Start directly on the Text composable — targets only the text rendering, no side effects on surrounding layout.
1 parent 62bcf88 commit 0a69f35

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

  • mobile/app/src/main/java/com/bytecats/metanoia/ui/components/bible

mobile/app/src/main/java/com/bytecats/metanoia/ui/components/bible/VerseItem.kt

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ import androidx.compose.ui.graphics.Color
1919
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
2020
import androidx.compose.ui.platform.LocalHapticFeedback
2121
import androidx.compose.ui.platform.LocalLayoutDirection
22+
import androidx.compose.ui.text.TextStyle
2223
import androidx.compose.ui.text.font.FontWeight
24+
import androidx.compose.ui.text.style.TextAlign
25+
import androidx.compose.ui.text.style.TextDirection
2326
import androidx.compose.ui.unit.LayoutDirection
2427
import androidx.compose.ui.unit.dp
2528
import androidx.compose.ui.unit.sp
@@ -112,20 +115,22 @@ fun VerseItem(
112115

113116
// Main verse text — RTL + larger font for Hebrew, LTR + normal for English
114117
if (hebrew) {
115-
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
116-
Text(
117-
text,
118+
Text(
119+
text = text,
120+
style = TextStyle(
121+
textDirection = TextDirection.Rtl,
118122
fontSize = ancientFontSize.sp,
119123
fontWeight = if (isCurrent) FontWeight.Medium else FontWeight.Light,
120-
modifier = Modifier.background(
121-
verseBackground(isCurrent, highlight, MaterialTheme.colorScheme.primary),
122-
RoundedCornerShape(4.dp)
123-
)
124+
),
125+
textAlign = TextAlign.Start,
126+
modifier = Modifier.background(
127+
verseBackground(isCurrent, highlight, MaterialTheme.colorScheme.primary),
128+
RoundedCornerShape(4.dp)
124129
)
125-
}
130+
)
126131
} else {
127132
Text(
128-
text,
133+
text = text,
129134
fontSize = englishFontSize.sp,
130135
fontWeight = if (isCurrent) FontWeight.Medium else FontWeight.Light,
131136
modifier = Modifier.background(

0 commit comments

Comments
 (0)