@@ -265,6 +265,9 @@ private static int parseNumericFontWeight(String fontWeightString) {
265
265
protected int mTextAlign = Gravity .NO_GRAVITY ;
266
266
protected int mTextBreakStrategy =
267
267
(Build .VERSION .SDK_INT < Build .VERSION_CODES .M ) ? 0 : Layout .BREAK_STRATEGY_HIGH_QUALITY ;
268
+ protected int mJustificationMode =
269
+ (Build .VERSION .SDK_INT < Build .VERSION_CODES .O ) ? 0 : Layout .JUSTIFICATION_MODE_NONE ;
270
+ protected TextTransform mTextTransform = TextTransform .UNSET ;
268
271
269
272
protected float mTextShadowOffsetDx = 0 ;
270
273
protected float mTextShadowOffsetDy = 0 ;
@@ -357,19 +360,28 @@ public void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
357
360
358
361
@ ReactProp (name = ViewProps .TEXT_ALIGN )
359
362
public void setTextAlign (@ Nullable String textAlign ) {
360
- if (textAlign == null || "auto" .equals (textAlign )) {
361
- mTextAlign = Gravity .NO_GRAVITY ;
362
- } else if ("left" .equals (textAlign )) {
363
- mTextAlign = Gravity .LEFT ;
364
- } else if ("right" .equals (textAlign )) {
365
- mTextAlign = Gravity .RIGHT ;
366
- } else if ("center" .equals (textAlign )) {
367
- mTextAlign = Gravity .CENTER_HORIZONTAL ;
368
- } else if ("justify" .equals (textAlign )) {
369
- // Fallback gracefully for cross-platform compat instead of error
363
+ if ("justify" .equals (textAlign )) {
364
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
365
+ mJustificationMode = Layout .JUSTIFICATION_MODE_INTER_WORD ;
366
+ }
370
367
mTextAlign = Gravity .LEFT ;
371
368
} else {
372
- throw new JSApplicationIllegalArgumentException ("Invalid textAlign: " + textAlign );
369
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
370
+ mJustificationMode = Layout .JUSTIFICATION_MODE_NONE ;
371
+ }
372
+
373
+ if (textAlign == null || "auto" .equals (textAlign )) {
374
+ mTextAlign = Gravity .NO_GRAVITY ;
375
+ } else if ("left" .equals (textAlign )) {
376
+ mTextAlign = Gravity .LEFT ;
377
+ } else if ("right" .equals (textAlign )) {
378
+ mTextAlign = Gravity .RIGHT ;
379
+ } else if ("center" .equals (textAlign )) {
380
+ mTextAlign = Gravity .CENTER_HORIZONTAL ;
381
+ } else {
382
+ throw new JSApplicationIllegalArgumentException ("Invalid textAlign: " + textAlign );
383
+ }
384
+
373
385
}
374
386
markUpdated ();
375
387
}
0 commit comments