react-native 0.73.0-rc.7 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +0 -10
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +33 -38
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/package.json +1 -1
package/React/Base/RCTVersion.m
CHANGED
package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java
CHANGED
|
@@ -75,16 +75,6 @@ public abstract class ReactTextAnchorViewManager<T extends View, C extends React
|
|
|
75
75
|
view.setAdjustFontSizeToFit(adjustsFontSizeToFit);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
@ReactProp(name = ViewProps.ALLOW_FONT_SCALING, defaultBoolean = true)
|
|
79
|
-
public void setAllowFontScaling(ReactTextView view, boolean allowFontScaling) {
|
|
80
|
-
view.setAllowFontScaling(allowFontScaling);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@ReactProp(name = ViewProps.MAX_FONT_SIZE_MULTIPLIER, defaultFloat = Float.NaN)
|
|
84
|
-
public void setMaxFontSizeMultiplier(ReactTextView view, float maxFontSizeMultiplier) {
|
|
85
|
-
view.setMaxFontSizeMultiplier(maxFontSizeMultiplier);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
78
|
@ReactProp(name = ViewProps.FONT_SIZE)
|
|
89
79
|
public void setFontSize(ReactTextView view, float fontSize) {
|
|
90
80
|
view.setFontSize(fontSize);
|
|
@@ -58,6 +58,8 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
58
58
|
private int mNumberOfLines;
|
|
59
59
|
private TextUtils.TruncateAt mEllipsizeLocation;
|
|
60
60
|
private boolean mAdjustsFontSizeToFit;
|
|
61
|
+
private float mFontSize = Float.NaN;
|
|
62
|
+
private float mLetterSpacing = Float.NaN;
|
|
61
63
|
private int mLinkifyMaskType;
|
|
62
64
|
private boolean mNotifyOnInlineViewLayout;
|
|
63
65
|
private boolean mTextIsSelectable;
|
|
@@ -65,12 +67,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
65
67
|
private ReactViewBackgroundManager mReactBackgroundManager;
|
|
66
68
|
private Spannable mSpanned;
|
|
67
69
|
|
|
68
|
-
/**
|
|
69
|
-
* Used to collect some text size affecting attributes to fix some text cut-off issues when users
|
|
70
|
-
* adjust text size and font weight to the max value in system font settings.
|
|
71
|
-
*/
|
|
72
|
-
private TextAttributes mTextAttributes;
|
|
73
|
-
|
|
74
70
|
public ReactTextView(Context context) {
|
|
75
71
|
super(context);
|
|
76
72
|
|
|
@@ -102,7 +98,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
102
98
|
mEllipsizeLocation = TextUtils.TruncateAt.END;
|
|
103
99
|
|
|
104
100
|
mSpanned = null;
|
|
105
|
-
mTextAttributes = new TextAttributes();
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
/* package */ void recycleView() {
|
|
@@ -592,6 +587,29 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
592
587
|
mAdjustsFontSizeToFit = adjustsFontSizeToFit;
|
|
593
588
|
}
|
|
594
589
|
|
|
590
|
+
public void setFontSize(float fontSize) {
|
|
591
|
+
mFontSize =
|
|
592
|
+
mAdjustsFontSizeToFit
|
|
593
|
+
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize))
|
|
594
|
+
: (float) Math.ceil(PixelUtil.toPixelFromDIP(fontSize));
|
|
595
|
+
|
|
596
|
+
applyTextAttributes();
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
public void setLetterSpacing(float letterSpacing) {
|
|
600
|
+
if (Float.isNaN(letterSpacing)) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
float letterSpacingPixels = PixelUtil.toPixelFromDIP(letterSpacing);
|
|
605
|
+
|
|
606
|
+
// `letterSpacingPixels` and `getEffectiveFontSize` are both in pixels,
|
|
607
|
+
// yielding an accurate em value.
|
|
608
|
+
mLetterSpacing = letterSpacingPixels / mFontSize;
|
|
609
|
+
|
|
610
|
+
applyTextAttributes();
|
|
611
|
+
}
|
|
612
|
+
|
|
595
613
|
public void setEllipsizeLocation(TextUtils.TruncateAt ellipsizeLocation) {
|
|
596
614
|
mEllipsizeLocation = ellipsizeLocation;
|
|
597
615
|
}
|
|
@@ -607,8 +625,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
607
625
|
? null
|
|
608
626
|
: mEllipsizeLocation;
|
|
609
627
|
setEllipsize(ellipsizeLocation);
|
|
610
|
-
|
|
611
|
-
applyTextAttributes();
|
|
612
628
|
}
|
|
613
629
|
|
|
614
630
|
@Override
|
|
@@ -664,37 +680,16 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
664
680
|
return super.dispatchHoverEvent(event);
|
|
665
681
|
}
|
|
666
682
|
|
|
667
|
-
public void setLetterSpacing(float letterSpacing) {
|
|
668
|
-
mTextAttributes.setLetterSpacing(letterSpacing);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
public void setAllowFontScaling(boolean allowFontScaling) {
|
|
672
|
-
if (mTextAttributes.getAllowFontScaling() != allowFontScaling) {
|
|
673
|
-
mTextAttributes.setAllowFontScaling(allowFontScaling);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
public void setFontSize(float fontSize) {
|
|
678
|
-
mTextAttributes.setFontSize(fontSize);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
public void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
|
|
682
|
-
if (maxFontSizeMultiplier != mTextAttributes.getMaxFontSizeMultiplier()) {
|
|
683
|
-
mTextAttributes.setMaxFontSizeMultiplier(maxFontSizeMultiplier);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
683
|
private void applyTextAttributes() {
|
|
688
|
-
//
|
|
689
|
-
//
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
684
|
+
// Workaround for an issue where text can be cut off with an ellipsis when
|
|
685
|
+
// using certain font sizes and padding. Sets the provided text size and
|
|
686
|
+
// letter spacing to ensure consistent rendering and prevent cut-off.
|
|
687
|
+
if (!Float.isNaN(mFontSize)) {
|
|
688
|
+
setTextSize(TypedValue.COMPLEX_UNIT_PX, mFontSize);
|
|
689
|
+
}
|
|
694
690
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
super.setLetterSpacing(effectiveLetterSpacing);
|
|
691
|
+
if (!Float.isNaN(mLetterSpacing)) {
|
|
692
|
+
super.setLetterSpacing(mLetterSpacing);
|
|
698
693
|
}
|
|
699
694
|
}
|
|
700
695
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|