diff --git a/packages/react-native/Libraries/Text/BaseText/RCTBaseTextViewManager.mm b/packages/react-native/Libraries/Text/BaseText/RCTBaseTextViewManager.mm index 7c36735a2d8b..a670b6e9daa9 100644 --- a/packages/react-native/Libraries/Text/BaseText/RCTBaseTextViewManager.mm +++ b/packages/react-native/Libraries/Text/BaseText/RCTBaseTextViewManager.mm @@ -33,7 +33,6 @@ - (RCTShadowView *)shadowView RCT_REMAP_SHADOW_PROPERTY(gradientColors, textAttributes.gradientColors, NSArray) RCT_REMAP_SHADOW_PROPERTY(gradientAngle, textAttributes.gradientAngle, CGFloat) RCT_REMAP_SHADOW_PROPERTY(gradientLength, textAttributes.gradientLength, CGFloat) -RCT_REMAP_SHADOW_PROPERTY(gradientWidth, textAttributes.gradientWidth, CGFloat) // Deprecated alias for gradientLength RCT_REMAP_SHADOW_PROPERTY(gradientMode, textAttributes.gradientMode, NSString) RCT_REMAP_SHADOW_PROPERTY(opacity, textAttributes.opacity, CGFloat) // Font diff --git a/packages/react-native/Libraries/Text/RCTTextAttributes.h b/packages/react-native/Libraries/Text/RCTTextAttributes.h index e89334607729..d6e73ba603d4 100644 --- a/packages/react-native/Libraries/Text/RCTTextAttributes.h +++ b/packages/react-native/Libraries/Text/RCTTextAttributes.h @@ -34,7 +34,6 @@ __attribute__((deprecated("This API will be removed along with the legacy archit @property (nonatomic, copy, nullable) NSArray *gradientColors; @property (nonatomic, assign) CGFloat gradientAngle; @property (nonatomic, assign) CGFloat gradientLength; // Length of gradient along its axis in pixels; NAN = use default (100px) -@property (nonatomic, assign) CGFloat gradientWidth; // Deprecated alias for gradientLength; gradientLength takes precedence when both are set @property (nonatomic, copy, nullable) NSString *gradientMode; // "mirror" (default) or "clamp" @property (nonatomic, assign) CGFloat opacity; // Font diff --git a/packages/react-native/Libraries/Text/RCTTextAttributes.mm b/packages/react-native/Libraries/Text/RCTTextAttributes.mm index d911a23fbca5..6bd915d9a7e7 100644 --- a/packages/react-native/Libraries/Text/RCTTextAttributes.mm +++ b/packages/react-native/Libraries/Text/RCTTextAttributes.mm @@ -55,7 +55,6 @@ - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes _gradientColors = textAttributes->_gradientColors ?: _gradientColors; _gradientAngle = !isnan(textAttributes->_gradientAngle) ? textAttributes->_gradientAngle : _gradientAngle; _gradientLength = !isnan(textAttributes->_gradientLength) ? textAttributes->_gradientLength : _gradientLength; - _gradientWidth = !isnan(textAttributes->_gradientWidth) ? textAttributes->_gradientWidth : _gradientWidth; _gradientMode = textAttributes->_gradientMode ?: _gradientMode; _opacity = !isnan(textAttributes->_opacity) ? (isnan(_opacity) ? 1.0 : _opacity) * textAttributes->_opacity : _opacity; @@ -334,12 +333,10 @@ - (UIColor *)effectiveForegroundColor } CAGradientLayer *gradient = [CAGradientLayer layer]; - // Prefer gradientLength; fall back to the deprecated gradientWidth; otherwise default to 100. + // Use gradientLength; otherwise default to 100. CGFloat patternWidth; if (!isnan(_gradientLength) && _gradientLength > 0) { patternWidth = _gradientLength; - } else if (!isnan(_gradientWidth) && _gradientWidth > 0) { - patternWidth = _gradientWidth; } else { patternWidth = 100; } @@ -442,7 +439,7 @@ - (BOOL)isEqual:(RCTTextAttributes *)textAttributes return RCTTextAttributesCompareObjects(_foregroundColor) && RCTTextAttributesCompareObjects(_backgroundColor) && RCTTextAttributesCompareObjects(_gradientColors) && RCTTextAttributesCompareFloats(_gradientAngle) && - RCTTextAttributesCompareFloats(_gradientLength) && RCTTextAttributesCompareFloats(_gradientWidth) && + RCTTextAttributesCompareFloats(_gradientLength) && RCTTextAttributesCompareFloats(_opacity) && RCTTextAttributesCompareStrings(_gradientMode) && // Font RCTTextAttributesCompareObjects(_fontFamily) && RCTTextAttributesCompareFloats(_fontSize) && diff --git a/packages/react-native/Libraries/Text/Text.d.ts b/packages/react-native/Libraries/Text/Text.d.ts index 45a98f15f478..f0ac3edd1299 100644 --- a/packages/react-native/Libraries/Text/Text.d.ts +++ b/packages/react-native/Libraries/Text/Text.d.ts @@ -234,14 +234,6 @@ export interface TextProps */ gradientLength?: number | undefined; - /** - * @deprecated Use `gradientLength` instead. When both are provided, - * `gradientLength` takes precedence. Historically this was the width of the - * gradient pattern in pixels; it now maps to the gradient length along its - * axis. Default is 100. - */ - gradientWidth?: number | undefined; - /** * Gradient tiling mode. "mirror" (default) tiles the gradient back and forth. * "clamp" renders the gradient once from the start to the end of the text. diff --git a/packages/react-native/Libraries/Text/TextNativeComponent.js b/packages/react-native/Libraries/Text/TextNativeComponent.js index 20af534f195a..3c218beedf37 100644 --- a/packages/react-native/Libraries/Text/TextNativeComponent.js +++ b/packages/react-native/Libraries/Text/TextNativeComponent.js @@ -51,7 +51,6 @@ const textViewConfig = { gradientColors: true, gradientAngle: true, gradientLength: true, - gradientWidth: true, gradientMode: true, textStrokeWidth: true, textStrokeColor: true, @@ -72,7 +71,6 @@ const virtualTextViewConfig = { gradientColors: true, gradientAngle: true, gradientLength: true, - gradientWidth: true, gradientMode: true, textStrokeWidth: true, textStrokeColor: true, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt index ae279e27b729..dacaba062a08 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt @@ -198,19 +198,9 @@ public class TextAttributeProps private constructor() { public var gradientAngle: Float = Float.NaN private set - // Deprecated alias for gradientLength; gradientLength takes precedence when both are set. - public var gradientWidth: Float = Float.NaN + public var gradientLength: Float = Float.NaN private set - private var gradientLengthRaw: Float = Float.NaN - - /** - * Effective gradient length, preferring [gradientLengthRaw] and falling back to the deprecated - * [gradientWidth] when [gradientLengthRaw] is unset. - */ - public val gradientLength: Float - get() = if (!gradientLengthRaw.isNaN()) gradientLengthRaw else gradientWidth - public var gradientMode: String? = null private set @@ -447,9 +437,7 @@ public class TextAttributeProps private constructor() { public const val TA_KEY_TEXT_STROKE_WIDTH: Int = 31 public const val TA_KEY_TEXT_STROKE_COLOR: Int = 32 public const val TA_KEY_GRADIENT_ANGLE: Int = 33 - // Deprecated alias for TA_KEY_GRADIENT_LENGTH; gradientLength takes precedence when both are set. - // Retains its original key (34) for backwards compatibility. - public const val TA_KEY_GRADIENT_WIDTH: Int = 34 + public const val TA_KEY_GRADIENT_WIDTH: Int = 34 // Unused public const val TA_KEY_GRADIENT_MODE: Int = 35 public const val TA_KEY_GRADIENT_LENGTH: Int = 36 @@ -510,8 +498,7 @@ public class TextAttributeProps private constructor() { result.maxFontSizeMultiplier = entry.doubleValue.toFloat() TA_KEY_GRADIENT_COLORS -> result.setGradientColors(entry.mapBufferValue) TA_KEY_GRADIENT_ANGLE -> result.gradientAngle = entry.doubleValue.toFloat() - TA_KEY_GRADIENT_WIDTH -> result.gradientWidth = entry.doubleValue.toFloat() - TA_KEY_GRADIENT_LENGTH -> result.gradientLengthRaw = entry.doubleValue.toFloat() + TA_KEY_GRADIENT_LENGTH -> result.gradientLength = entry.doubleValue.toFloat() TA_KEY_GRADIENT_MODE -> result.gradientMode = entry.stringValue } } @@ -557,8 +544,7 @@ public class TextAttributeProps private constructor() { result.setRole(getStringProp(props, ViewProps.ROLE)) result.setGradientColors(getArrayProp(props, "gradientColors")) result.gradientAngle = getFloatProp(props, "gradientAngle", Float.NaN) - result.gradientLengthRaw = getFloatProp(props, "gradientLength", Float.NaN) - result.gradientWidth = getFloatProp(props, "gradientWidth", Float.NaN) + result.gradientLength = getFloatProp(props, "gradientLength", Float.NaN) result.gradientMode = getStringProp(props, "gradientMode") result.textStrokeWidth = getFloatProp(props, "textStrokeWidth", Float.NaN) if (props.hasKey("textStrokeColor")) { diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp index 1a47acf2b404..cb74e7e07dea 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp @@ -36,9 +36,6 @@ void TextAttributes::apply(TextAttributes textAttributes) { gradientLength = !std::isnan(textAttributes.gradientLength) ? textAttributes.gradientLength : gradientLength; - gradientWidth = !std::isnan(textAttributes.gradientWidth) - ? textAttributes.gradientWidth - : gradientWidth; gradientMode = textAttributes.gradientMode.has_value() ? textAttributes.gradientMode : gradientMode; @@ -200,7 +197,6 @@ bool TextAttributes::operator==(const TextAttributes& rhs) const { floatEquality(textStrokeWidth, rhs.textStrokeWidth) && floatEquality(gradientAngle, rhs.gradientAngle) && floatEquality(gradientLength, rhs.gradientLength) && - floatEquality(gradientWidth, rhs.gradientWidth) && gradientColors == rhs.gradientColors && gradientMode == rhs.gradientMode; } diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h index 5b2637c0d41d..b9924ea473b4 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -47,8 +47,6 @@ class TextAttributes : public DebugStringConvertible { std::optional> gradientColors{}; Float gradientAngle{std::numeric_limits::quiet_NaN()}; Float gradientLength{std::numeric_limits::quiet_NaN()}; - // Deprecated alias for gradientLength; gradientLength takes precedence when both are set. - Float gradientWidth{std::numeric_limits::quiet_NaN()}; std::optional gradientMode{}; // "mirror" or "clamp" // Font @@ -151,7 +149,6 @@ struct hash { textAttributes.gradientColors, textAttributes.gradientAngle, textAttributes.gradientLength, - textAttributes.gradientWidth, textAttributes.gradientMode, textAttributes.isHighlighted, textAttributes.isPressable, diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h index c24c63e9c7ee..8e3f055a8191 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h @@ -1132,9 +1132,7 @@ constexpr static MapBuffer::Key TA_KEY_GRADIENT_COLORS = 30; constexpr static MapBuffer::Key TA_KEY_TEXT_STROKE_WIDTH = 31; constexpr static MapBuffer::Key TA_KEY_TEXT_STROKE_COLOR = 32; constexpr static MapBuffer::Key TA_KEY_GRADIENT_ANGLE = 33; -// Deprecated alias for TA_KEY_GRADIENT_LENGTH; gradientLength takes precedence when both are set. -// Retains its original key (34) for backwards compatibility. -constexpr static MapBuffer::Key TA_KEY_GRADIENT_WIDTH = 34; +constexpr static MapBuffer::Key TA_KEY_GRADIENT_WIDTH = 34; // Unused constexpr static MapBuffer::Key TA_KEY_GRADIENT_MODE = 35; constexpr static MapBuffer::Key TA_KEY_GRADIENT_LENGTH = 36; @@ -1273,9 +1271,6 @@ inline MapBuffer toMapBuffer(const TextAttributes &textAttributes) if (!std::isnan(textAttributes.gradientLength)) { builder.putDouble(TA_KEY_GRADIENT_LENGTH, textAttributes.gradientLength); } - if (!std::isnan(textAttributes.gradientWidth)) { - builder.putDouble(TA_KEY_GRADIENT_WIDTH, textAttributes.gradientWidth); - } if (textAttributes.gradientMode.has_value()) { builder.putString(TA_KEY_GRADIENT_MODE, *textAttributes.gradientMode); } diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp index 17538ecebfb1..70987cc05bba 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp @@ -48,12 +48,6 @@ static TextAttributes convertRawProp( "gradientLength", sourceTextAttributes.gradientLength, defaultTextAttributes.gradientLength); - textAttributes.gradientWidth = convertRawProp( - context, - rawProps, - "gradientWidth", - sourceTextAttributes.gradientWidth, - defaultTextAttributes.gradientWidth); textAttributes.gradientMode = convertRawProp( context, rawProps, @@ -299,8 +293,6 @@ void BaseTextProps::setProp( defaults, value, textAttributes, gradientAngle, "gradientAngle"); REBUILD_FIELD_SWITCH_CASE( defaults, value, textAttributes, gradientLength, "gradientLength"); - REBUILD_FIELD_SWITCH_CASE( - defaults, value, textAttributes, gradientWidth, "gradientWidth"); REBUILD_FIELD_SWITCH_CASE( defaults, value, textAttributes, gradientMode, "gradientMode"); REBUILD_FIELD_SWITCH_CASE( diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm index b8ea1861f570..21e03b5850b4 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm @@ -162,12 +162,9 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex } CAGradientLayer *gradient = [CAGradientLayer layer]; - // Prefer gradientLength; fall back to the deprecated gradientWidth; otherwise default to 100. CGFloat patternWidth; if (!isnan(textAttributes.gradientLength) && textAttributes.gradientLength > 0) { patternWidth = textAttributes.gradientLength; - } else if (!isnan(textAttributes.gradientWidth) && textAttributes.gradientWidth > 0) { - patternWidth = textAttributes.gradientWidth; } else { patternWidth = 100; }