From b7daabf98dd1dea2ba9393bc8fa70f187979faf7 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 01/19] Add KDoc documentation to UIManagerType.kt Summary: Added comprehensive KDoc documentation to the UIManagerType annotation class and its companion object constants. This improves code readability and provides better IDE support for developers working with UIManager types. The documentation explains: - The purpose of the annotation (distinguishing between legacy and Fabric UIManager) - Each constant (DEFAULT, LEGACY, FABRIC) and their use cases - Deprecation notes for the DEFAULT constant changelog: [internal] internal Reviewed By: cortinico Differential Revision: D91553347 --- .../react/uimanager/common/UIManagerType.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt index 912d8c68f7fd69..bc20c931c1bd05 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt @@ -9,16 +9,38 @@ package com.facebook.react.uimanager.common import androidx.annotation.IntDef +/** + * Annotation class that defines the type of UIManager being used in React Native. + * + * This annotation is used to distinguish between the legacy UIManager implementation and the newer + * Fabric renderer. It helps ensure type safety when working with UIManager-related code by + * restricting values to the defined constants. + * + * @see UIManagerType.LEGACY for legacy (Paper) UIManager + * @see UIManagerType.FABRIC for Fabric renderer + */ @Retention(AnnotationRetention.SOURCE) @Suppress("DEPRECATION") @IntDef(UIManagerType.DEFAULT, UIManagerType.LEGACY, UIManagerType.FABRIC) public annotation class UIManagerType { public companion object { + /** + * Default UIManager type. Equivalent to [LEGACY]. + * + * @deprecated Use [LEGACY] instead. + */ @Deprecated( "UIManagerType.DEFAULT will be deleted in the next release of React Native. Use [LEGACY] instead." ) public const val DEFAULT: Int = 1 + + /** Represents the legacy (Paper) UIManager implementation. */ public const val LEGACY: Int = 1 + + /** + * Represents the Fabric renderer, React Native's new rendering system that provides improved + * performance and better integration with the host platform. + */ public const val FABRIC: Int = 2 } } From ce3721a46a1596bc5c5e919ca7fc5885893aadac Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 02/19] Add KDoc documentation to ViewUtil.kt Summary: Added KDoc documentation to the ViewUtil object and its NO_SURFACE_ID constant. The existing function documentation was already present. The documentation explains: - The purpose of the ViewUtil object (utilities for determining UIManager type) - The NO_SURFACE_ID constant and its usage as a placeholder for legacy UIManager changelog: [internal] internal Reviewed By: cortinico Differential Revision: D91553498 --- .../facebook/react/uimanager/common/ViewUtil.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.kt index 22bcb86a2ad250..22d34f6c63fb4b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.kt @@ -9,8 +9,23 @@ package com.facebook.react.uimanager.common import android.view.View +/** + * Utility object providing helper methods for working with React Native views. + * + * This object contains utilities for determining which UIManager (Legacy/Paper or Fabric) a view + * belongs to, based on view tags and surface IDs. These utilities are essential for routing events + * and operations to the correct UIManager implementation. + * + * @see UIManagerType + */ public object ViewUtil { + /** + * Constant representing the absence of a surface ID. + * + * This value (-1) is used as a placeholder when no surface ID is available, typically indicating + * that the view or event originated from the legacy (Paper) UIManager rather than Fabric. + */ public const val NO_SURFACE_ID: Int = -1 /** From b9bd344d8716caa6106d11abd3ceb35a43309338 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 03/19] Add KDoc documentation to BackgroundSize.kt Summary: Added comprehensive KDoc documentation to BackgroundSize.kt classes and methods: - BackgroundSizeLengthPercentage: Documented class purpose, properties (x, y), and methods (isXAuto, isYAuto, parse) - BackgroundSize sealed class: Documented the sealed class hierarchy and LengthPercentageAuto subclass - Companion object parse methods: Added parameter and return documentation This improves code readability and provides better IDE support for developers. changelog: [internal] internal Reviewed By: lenaic Differential Revision: D91554301 --- .../react/uimanager/style/BackgroundSize.kt | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundSize.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundSize.kt index f476c24baf57b6..aaeaa4d4e855de 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundSize.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundSize.kt @@ -12,15 +12,44 @@ import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableType import com.facebook.react.uimanager.LengthPercentage +/** + * Represents a background size value with horizontal (x) and vertical (y) length/percentage + * components. + * + * This class handles CSS-like background-size values where each dimension can be a length, + * percentage, or "auto". A null value for x or y indicates "auto" sizing for that dimension. + * + * @property x The horizontal size component, or null for "auto" + * @property y The vertical size component, or null for "auto" + */ internal class BackgroundSizeLengthPercentage( public val x: LengthPercentage?, public val y: LengthPercentage?, ) { + /** + * Checks if the horizontal dimension is set to auto. + * + * @return true if x is null (auto), false otherwise + */ public fun isXAuto(): Boolean = x == null + /** + * Checks if the vertical dimension is set to auto. + * + * @return true if y is null (auto), false otherwise + */ public fun isYAuto(): Boolean = y == null public companion object { + /** + * Parses a ReadableMap into a BackgroundSizeLengthPercentage. + * + * The map should contain "x" and/or "y" keys with values that are either numbers (treated as + * points), percentage strings (e.g., "50%"), or "auto". + * + * @param backgroundSizeMap The map containing x and y size values + * @return A BackgroundSizeLengthPercentage instance, or null if the map is null + */ public fun parse(backgroundSizeMap: ReadableMap?): BackgroundSizeLengthPercentage? { if (backgroundSizeMap == null) return null @@ -78,11 +107,32 @@ internal class BackgroundSizeLengthPercentage( } } +/** + * Sealed class representing CSS background-size property values. + * + * This class models the different ways a background size can be specified in CSS, currently + * supporting length/percentage/auto values for both dimensions. + * + * @see BackgroundSizeLengthPercentage + */ internal sealed class BackgroundSize { + /** + * Represents a background size specified using length, percentage, or auto values. + * + * @property lengthPercentage The parsed size values for x and y dimensions + */ public class LengthPercentageAuto(public val lengthPercentage: BackgroundSizeLengthPercentage) : BackgroundSize() public companion object { + /** + * Parses a Dynamic value into a BackgroundSize. + * + * Currently supports map values containing x/y dimensions. + * + * @param backgroundSizeValue The dynamic value to parse + * @return A BackgroundSize instance, or null if parsing fails + */ public fun parse(backgroundSizeValue: Dynamic?): BackgroundSize? { if (backgroundSizeValue == null) return null From 45267f0ef42a7de0f20b62a5140a9c64273f64fb Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 04/19] Add KDoc documentation to BackgroundPosition.kt Summary: Added KDoc documentation to BackgroundPosition.kt: - Class documentation explaining its purpose for CSS-like background positioning - Property documentation for top, left, right, bottom offset values - Parse method documentation with parameter and return descriptions changelog: [internal] internal Reviewed By: lenaic Differential Revision: D91554341 --- .../uimanager/style/BackgroundPosition.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundPosition.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundPosition.kt index 3febece11f8dec..a414fad9fe1cdd 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundPosition.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundPosition.kt @@ -11,6 +11,17 @@ import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableType import com.facebook.react.uimanager.LengthPercentage +/** + * Represents the position of a background image within its container. + * + * This class models CSS-like background-position values, allowing specification of offsets from any + * edge (top, left, right, bottom). Each offset can be a length or percentage value. + * + * @property top Offset from the top edge, or null if not specified + * @property left Offset from the left edge, or null if not specified + * @property right Offset from the right edge, or null if not specified + * @property bottom Offset from the bottom edge, or null if not specified + */ internal class BackgroundPosition( public val top: LengthPercentage?, public val left: LengthPercentage?, @@ -18,6 +29,15 @@ internal class BackgroundPosition( public val bottom: LengthPercentage?, ) { public companion object { + /** + * Parses a ReadableMap into a BackgroundPosition. + * + * The map may contain "top", "left", "right", and/or "bottom" keys with length or percentage + * values. + * + * @param backgroundPositionMap The map containing position values + * @return A BackgroundPosition instance, or null if the map is null + */ public fun parse(backgroundPositionMap: ReadableMap?): BackgroundPosition? { if (backgroundPositionMap == null) return null From 6dde9037ebff3cf45d5ae0afe01dfe8b915daf55 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 05/19] Add KDoc documentation to BackgroundRepeat.kt Summary: Added KDoc documentation to BackgroundRepeat.kt: - BackgroundRepeatKeyword enum: Documented each repeat behavior (Repeat, Space, Round, NoRepeat) - BackgroundRepeat class: Documented class purpose and x/y properties - Parse method: Added parameter and return documentation changelog: [internal] internal Reviewed By: cortinico Differential Revision: D91554444 --- .../react/uimanager/style/BackgroundRepeat.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundRepeat.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundRepeat.kt index 3ca757ed9ec145..511ed929fbb634 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundRepeat.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundRepeat.kt @@ -10,18 +10,45 @@ package com.facebook.react.uimanager.style import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableType +/** + * Enum representing the possible repeat behavior keywords for background images. + * + * These values correspond to CSS background-repeat keywords. + */ internal enum class BackgroundRepeatKeyword { + /** The image is repeated as much as needed to cover the background area. */ Repeat, + /** The image is repeated as much as possible without clipping, with space distributed evenly. */ Space, + /** The image is repeated as much as possible without clipping, scaling to fit evenly. */ Round, + /** The image is not repeated and only shown once. */ NoRepeat, } +/** + * Represents the background repeat behavior for both horizontal and vertical axes. + * + * This class models the CSS background-repeat property, specifying how background images should be + * repeated in each direction. + * + * @property x The repeat behavior for the horizontal axis + * @property y The repeat behavior for the vertical axis + */ internal class BackgroundRepeat( public val x: BackgroundRepeatKeyword, public val y: BackgroundRepeatKeyword, ) { public companion object { + /** + * Parses a ReadableMap into a BackgroundRepeat. + * + * The map should contain "x" and/or "y" keys with string values matching the + * BackgroundRepeatKeyword values. Missing values default to Repeat. + * + * @param backgroundRepeatMap The map containing repeat values + * @return A BackgroundRepeat instance, or null if the map is null + */ public fun parse(backgroundRepeatMap: ReadableMap?): BackgroundRepeat? { if (backgroundRepeatMap == null) return null From 0dd64fefddeb2e18e4d0a9c071279f25515cc508 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 06/19] Add KDoc documentation to BackgroundImageLayer.kt Summary: Added KDoc documentation to the public BackgroundImageLayer class: - Class documentation explaining its purpose for gradient-based background layers - parse() method documentation with parameter descriptions - getShader() method documentation for shader generation changelog: [internal] internal Reviewed By: lenaic Differential Revision: D91554568 --- .../uimanager/style/BackgroundImageLayer.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundImageLayer.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundImageLayer.kt index 1b1cd5d74017b4..8e5cc7d8c2a44b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundImageLayer.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundImageLayer.kt @@ -12,6 +12,16 @@ import android.graphics.Shader import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableType +/** + * Represents a single layer of a background image, typically containing a gradient. + * + * This class encapsulates gradient definitions (linear or radial) that can be applied as background + * layers to React Native views. It provides parsing from React Native bridge data and shader + * generation for rendering. + * + * @see LinearGradient + * @see RadialGradient + */ public class BackgroundImageLayer() { private lateinit var gradient: Gradient @@ -20,6 +30,16 @@ public class BackgroundImageLayer() { } public companion object { + /** + * Parses a ReadableMap into a BackgroundImageLayer. + * + * The map should contain gradient configuration including a "type" key specifying either + * "linear-gradient" or "radial-gradient". + * + * @param gradientMap The map containing gradient configuration + * @param context Android context for resource resolution + * @return A BackgroundImageLayer instance, or null if parsing fails + */ public fun parse(gradientMap: ReadableMap?, context: Context): BackgroundImageLayer? { if (gradientMap == null) { return null @@ -41,5 +61,12 @@ public class BackgroundImageLayer() { } } + /** + * Creates a shader for rendering this background layer. + * + * @param width The width of the area to fill + * @param height The height of the area to fill + * @return A Shader instance for rendering the gradient + */ public fun getShader(width: Float, height: Float): Shader = gradient.getShader(width, height) } From 0a584a71a76e9807568b56d384d6878fa74acfde Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 07/19] Add KDoc documentation to BoxShadow.kt Summary: Updated and added KDoc documentation to BoxShadow.kt: - Fixed incorrect class documentation (was incorrectly describing border radius) - Added proper documentation explaining box shadow purpose and CSS correspondence - Documented all properties: offsetX, offsetY, color, blurRadius, spreadDistance, inset - Added parse method documentation with parameter descriptions changelog: [internal] internal Reviewed By: lenaic Differential Revision: D91554604 --- .../react/uimanager/style/BoxShadow.kt | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BoxShadow.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BoxShadow.kt index e82e370571664c..68a883b7d43fa6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BoxShadow.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BoxShadow.kt @@ -14,7 +14,19 @@ import com.facebook.react.bridge.JSApplicationCausedNativeException import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableType -/** Represents all logical properties and shorthands for border radius. */ +/** + * Represents a box shadow effect that can be applied to a React Native view. + * + * This data class models the CSS box-shadow property, including offset, blur, spread, color, and + * inset options. + * + * @property offsetX The horizontal offset of the shadow in pixels + * @property offsetY The vertical offset of the shadow in pixels + * @property color The color of the shadow, or null for default + * @property blurRadius The blur radius of the shadow, or null for no blur + * @property spreadDistance The spread distance of the shadow, or null for no spread + * @property inset Whether the shadow is inset (inner shadow), or null for outer shadow + */ public data class BoxShadow( val offsetX: Float, val offsetY: Float, @@ -24,6 +36,16 @@ public data class BoxShadow( val inset: Boolean? = null, ) { public companion object { + /** + * Parses a ReadableMap into a BoxShadow. + * + * The map must contain "offsetX" and "offsetY" keys. Optional keys include "color", + * "blurRadius", "spreadDistance", and "inset". + * + * @param boxShadow The map containing box shadow configuration + * @param context Android context for color resolution + * @return A BoxShadow instance, or null if required fields are missing + */ @JvmStatic public fun parse(boxShadow: ReadableMap?, context: Context): BoxShadow? { if (boxShadow == null || !(boxShadow.hasKey("offsetX") && boxShadow.hasKey("offsetY"))) { From fa7047097d05b1930f515fb278744b486ddc5c89 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 08/19] Add KDoc documentation to BorderColors.kt Summary: Added KDoc documentation to BorderColors.kt: - ColorEdges data class: Documented purpose and properties (left, top, right, bottom) - BorderColors value class: Documented logical edge color storage and resolution - resolve() method: Documented layout direction handling and RTL support changelog: [internal] internal Reviewed By: lenaic Differential Revision: D91554628 --- .../react/uimanager/style/BorderColors.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderColors.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderColors.kt index c39cb74bbb9a1f..d42df53d388435 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderColors.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderColors.kt @@ -13,6 +13,17 @@ import android.util.LayoutDirection import androidx.annotation.ColorInt import com.facebook.react.modules.i18nmanager.I18nUtil +/** + * Represents resolved border colors for all four physical edges of a box. + * + * This data class contains the final computed color values after resolving logical properties based + * on layout direction. + * + * @property left Color for the left edge + * @property top Color for the top edge + * @property right Color for the right edge + * @property bottom Color for the bottom edge + */ internal data class ColorEdges( @param:ColorInt val left: Int = Color.BLACK, @param:ColorInt val top: Int = Color.BLACK, @@ -20,11 +31,33 @@ internal data class ColorEdges( @param:ColorInt val bottom: Int = Color.BLACK, ) +/** + * Represents border colors using logical edge properties. + * + * This inline value class stores colors for all logical edges (start, end, block-start, block-end, + * etc.) and resolves them to physical edges based on layout direction and RTL settings. + * + * @property edgeColors Array of colors indexed by [LogicalEdge] ordinal values + * @see LogicalEdge + * @see ColorEdges + */ @JvmInline internal value class BorderColors( @param:ColorInt val edgeColors: Array = arrayOfNulls(LogicalEdge.values().size) ) { + /** + * Resolves logical edge colors to physical edge colors based on layout direction. + * + * This method handles RTL layout direction and the doLeftAndRightSwapInRTL setting to correctly + * map logical properties (start, end, block-start, block-end) to physical edges (left, right, + * top, bottom). + * + * @param layoutDirection The resolved layout direction (LTR or RTL) + * @param context Android context for RTL swap preference + * @return ColorEdges with resolved physical edge colors + * @throws IllegalArgumentException if layoutDirection is not LTR or RTL + */ fun resolve(layoutDirection: Int, context: Context): ColorEdges { return when (layoutDirection) { LayoutDirection.LTR -> From fb0bba80e9e0f747dda779d7b1ee5bde61f5993d Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 09/19] Add KDoc documentation to CornerRadii.kt Summary: Enhanced KDoc documentation for CornerRadii.kt: - Expanded class documentation with detailed explanation - Added property documentation for horizontal and vertical radii - Documented secondary constructor for LengthPercentage resolution - Added toPixelFromDIP() method documentation changelog: [internal] internal Reviewed By: lenaic Differential Revision: D91554663 --- .../react/uimanager/style/CornerRadii.kt | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/CornerRadii.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/CornerRadii.kt index 3135ff322368c2..b81231f707a4e1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/CornerRadii.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/CornerRadii.kt @@ -10,17 +10,37 @@ package com.facebook.react.uimanager.style import com.facebook.react.uimanager.LengthPercentage import com.facebook.react.uimanager.PixelUtil -/** Represents the resolved horizontal and vertical radii of the ellipse representing a corner. */ +/** + * Represents the resolved horizontal and vertical radii of the ellipse representing a corner. + * + * This data class stores the computed radius values for a single corner of a view's border. Each + * corner can have an elliptical shape with different horizontal and vertical radii. + * + * @property horizontal The horizontal radius of the corner ellipse in pixels + * @property vertical The vertical radius of the corner ellipse in pixels + */ public data class CornerRadii( val horizontal: Float = 0f, val vertical: Float = 0f, ) { + /** + * Creates CornerRadii by resolving a LengthPercentage value against reference dimensions. + * + * @param length The length/percentage value to resolve + * @param referenceWidth The reference width for percentage calculations + * @param referenceHeight The reference height for percentage calculations + */ public constructor( length: LengthPercentage, referenceWidth: Float, referenceHeight: Float, ) : this(horizontal = length.resolve(referenceWidth), vertical = length.resolve(referenceHeight)) + /** + * Converts the corner radii from density-independent pixels (DIP) to physical pixels. + * + * @return A new CornerRadii with values converted to pixels + */ public fun toPixelFromDIP(): CornerRadii { return CornerRadii(PixelUtil.toPixelFromDIP(horizontal), PixelUtil.toPixelFromDIP(vertical)) } From 9179e5ffc899e99c26f4cc1adf7f92e521459269 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 10/19] Add KDoc documentation to ColorStop.kt Summary: Converted inline comments to proper KDoc documentation: - ColorStop class: Documented gradient color stop with examples - ProcessedColorStop class: Documented processed color stop after fix-up - ColorStopUtils object: Added comprehensive documentation explaining CSS spec compliance - getFixedColorStops method: Documented the fix-up algorithm steps changelog: [internal] internal Reviewed By: javache Differential Revision: D91554709 --- .../react/uimanager/style/ColorStop.kt | 52 ++++++++++++++++--- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt index 811ebda4b6d0d9..c7bdb8434c81fc 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt @@ -14,18 +14,56 @@ import com.facebook.react.uimanager.LengthPercentageType import com.facebook.react.uimanager.PixelUtil import kotlin.math.ln -// ColorStop type is passed by user, so color and position both could be null. -// e.g. -// color is null in transition hint syntax: (red, 20%, green) -// position can be null too (red 20%, green, purple) +/** + * Represents a color stop in a gradient as specified by the user. + * + * Color stops define the colors and their positions within a gradient. Both color and position can + * be null to support CSS gradient syntax features like transition hints. + * + * Examples: + * - color is null in transition hint syntax: (red, 20%, green) + * - position can be null too: (red 20%, green, purple) + * + * @property color The color value at this stop, or null for transition hints + * @property position The position of this stop as a length or percentage, or null for auto + */ internal class ColorStop(var color: Int? = null, val position: LengthPercentage? = null) -// ProcessedColorStop type describes type after processing. -// Here both types are nullable to keep it convenient for the color stop fix up algorithm. -// Final Color stop will have both non-null, we check for non null after calling getFixedColorStop. +/** + * Represents a color stop after processing with resolved position. + * + * This class is used internally during the color stop fix-up algorithm. Both properties are + * nullable to accommodate intermediate states during processing, but will be non-null after + * [ColorStopUtils.getFixedColorStops] completes. + * + * @property color The resolved color value, or null during processing + * @property position The resolved position as a fraction (0.0 to 1.0), or null during processing + */ internal class ProcessedColorStop(var color: Int? = null, val position: Float? = null) +/** + * Utility object for processing gradient color stops according to CSS specification. + * + * This object implements the color stop fix-up algorithm as defined in the CSS Images Module Level + * 4 specification, handling position interpolation and transition hints. + * + * @see CSS Images Module + * Level 4 + */ internal object ColorStopUtils { + /** + * Processes a list of color stops into fixed color stops with resolved positions. + * + * This method implements the CSS color stop fix-up algorithm: + * 1. Sets first stop position to 0% and last to 100% if not specified + * 2. Ensures positions are monotonically increasing + * 3. Interpolates positions for stops without explicit positions + * 4. Processes transition hints by generating intermediate color stops + * + * @param colorStops The input color stops from user specification + * @param gradientLineLength The length of the gradient line in pixels + * @return A list of processed color stops with all positions resolved + */ fun getFixedColorStops( colorStops: List, gradientLineLength: Float, From 8d220e976c9d35a35260f4bf28a81c74e7d3e360 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 11/19] Add KDoc documentation to BorderRadiusStyle.kt Summary: Enhanced KDoc documentation for BorderRadiusStyle.kt: - BorderRadiusProp enum: Expanded documentation explaining physical vs logical properties - BorderRadiusStyle data class: Comprehensive class documentation - set()/get() methods: Added parameter and return documentation - hasRoundedBorders(): Added method documentation - resolve(): Documented layout direction handling and CSS spec compliance changelog: [internal] internal Reviewed By: javache Differential Revision: D91554764 --- .../uimanager/style/BorderRadiusStyle.kt | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt index f7b46e1395cb1f..e478867b0d714b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt @@ -12,7 +12,12 @@ import android.util.LayoutDirection import com.facebook.react.modules.i18nmanager.I18nUtil import com.facebook.react.uimanager.LengthPercentage -/** Represents the collection of possible border radius style properties. */ +/** + * Enum representing all possible border radius style property names. + * + * This includes both physical corner properties (e.g., BORDER_TOP_LEFT_RADIUS) and logical corner + * properties (e.g., BORDER_START_START_RADIUS) that adapt to layout direction. + */ public enum class BorderRadiusProp { BORDER_RADIUS, BORDER_TOP_LEFT_RADIUS, @@ -29,7 +34,16 @@ public enum class BorderRadiusProp { BORDER_START_START_RADIUS, } -/** Represents all logical properties and shorthands for border radius. */ +/** + * Represents all logical and physical border radius properties and shorthands. + * + * This data class stores border radius values using both physical corner names (topLeft, topRight, + * etc.) and logical corner names (topStart, startStart, etc.) that adapt to layout direction. + * Values are stored as [LengthPercentage] to support both absolute and percentage-based radii. + * + * @see BorderRadiusProp + * @see ComputedBorderRadius + */ internal data class BorderRadiusStyle( var uniform: LengthPercentage? = null, var topLeft: LengthPercentage? = null, @@ -49,6 +63,12 @@ internal data class BorderRadiusStyle( properties.forEach { (k, v) -> set(k, v) } } + /** + * Sets a border radius property value. + * + * @param property The border radius property to set + * @param value The length/percentage value, or null to clear + */ fun set(property: BorderRadiusProp, value: LengthPercentage?) { when (property) { BorderRadiusProp.BORDER_RADIUS -> uniform = value @@ -67,6 +87,12 @@ internal data class BorderRadiusStyle( } } + /** + * Gets a border radius property value. + * + * @param property The border radius property to get + * @return The length/percentage value, or null if not set + */ fun get(property: BorderRadiusProp): LengthPercentage? { return when (property) { BorderRadiusProp.BORDER_RADIUS -> uniform @@ -85,6 +111,11 @@ internal data class BorderRadiusStyle( } } + /** + * Checks if any border radius property is set. + * + * @return true if at least one border radius is defined + */ fun hasRoundedBorders(): Boolean { return uniform != null || topLeft != null || @@ -101,6 +132,19 @@ internal data class BorderRadiusStyle( endEnd != null } + /** + * Resolves logical border radius properties to physical corners based on layout direction. + * + * This method converts logical properties (startStart, topEnd, etc.) to physical corners + * (topLeft, topRight, etc.) based on the layout direction and RTL settings. It also ensures + * corner radii do not overlap per the CSS specification. + * + * @param layoutDirection The resolved layout direction (LTR or RTL) + * @param context Android context for RTL configuration + * @param width The width of the element for percentage resolution + * @param height The height of the element for percentage resolution + * @return ComputedBorderRadius with resolved physical corner radii + */ fun resolve( layoutDirection: Int, context: Context, From e387267f8741eb8735d2a8ea91531669ac489193 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 12/19] Add KDoc documentation to RadialGradient.kt Summary: Added comprehensive KDoc documentation to RadialGradient.kt: - RadialGradient class: Documented CSS radial gradient implementation with spec link - Shape enum: Documented CIRCLE and ELLIPSE values - GradientSize sealed class: Documented sizing options (Keyword and Dimensions) - KeywordType enum: Added property documentation changelog: [internal] internal Reviewed By: javache Differential Revision: D91554808 --- .../react/uimanager/style/RadialGradient.kt | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt index 523e2c482cf17e..deaceccc87f6c9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt @@ -23,6 +23,19 @@ import kotlin.math.min import kotlin.math.pow import kotlin.math.sqrt +/** + * Represents a CSS radial gradient for background rendering. + * + * This class implements the CSS radial-gradient specification, supporting circular and elliptical + * shapes, various sizing keywords, and custom positioning. It generates an Android Shader for + * rendering. + * + * @property shape The shape of the gradient (circle or ellipse) + * @property size The sizing specification (keyword or explicit dimensions) + * @property position The center position of the gradient + * @property colorStops The list of color stops defining the gradient colors + * @see CSS Radial Gradients + */ internal class RadialGradient( val shape: Shape, val size: GradientSize, @@ -129,8 +142,15 @@ internal class RadialGradient( } } + /** + * Enum representing the shape of a radial gradient. + * + * @see CSS circle + */ internal enum class Shape { + /** A circular gradient with equal horizontal and vertical radii. */ CIRCLE, + /** An elliptical gradient that can have different horizontal and vertical radii. */ ELLIPSE; companion object { @@ -144,11 +164,33 @@ internal class RadialGradient( } } + /** + * Sealed class representing the sizing specification for a radial gradient. + * + * Sizes can be specified using keywords (closest-side, farthest-corner, etc.) or explicit + * dimensions. + */ sealed class GradientSize { + /** + * Represents a size specified using a CSS keyword. + * + * @property keyword The sizing keyword + */ class Keyword(val keyword: KeywordType) : GradientSize() + /** + * Represents a size specified using explicit horizontal and vertical dimensions. + * + * @property x The horizontal radius + * @property y The vertical radius + */ class Dimensions(val x: LengthPercentage, val y: LengthPercentage) : GradientSize() + /** + * Enum of CSS radial gradient sizing keywords. + * + * @property value The CSS string value + */ enum class KeywordType(val value: String) { CLOSEST_SIDE("closest-side"), FARTHEST_SIDE("farthest-side"), From fdbcfb668ccf455ec48ac9ce320cecb5bb8bbc14 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 13/19] Add KDoc documentation to LinearGradient.kt Summary: Added comprehensive KDoc documentation to LinearGradient.kt: - LinearGradient class: Documented CSS linear gradient implementation with spec link - Direction sealed class: Documented direction options - Angle class: Documented angle-based direction - Keyword class: Documented keyword-based direction - KeywordType enum: Added documentation for each corner keyword changelog: [internal] internal Reviewed By: javache Differential Revision: D91554850 --- .../react/uimanager/style/LinearGradient.kt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt index 969724d0ee1447..57a90bcbc7388f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt @@ -18,6 +18,16 @@ import kotlin.math.atan import kotlin.math.sqrt import kotlin.math.tan +/** + * Represents a CSS linear gradient for background rendering. + * + * This class implements the CSS linear-gradient specification, supporting angle-based and + * keyword-based directions along with color stops. It generates an Android Shader for rendering. + * + * @property direction The direction of the gradient (angle or keyword) + * @property colorStops The list of color stops defining the gradient colors + * @see CSS Linear Gradients + */ internal class LinearGradient(val direction: Direction, val colorStops: List) : Gradient { companion object { @@ -76,15 +86,39 @@ internal class LinearGradient(val direction: Direction, val colorStops: List Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 14/19] Add KDoc documentation to Gradient.kt Summary: Added KDoc documentation to the Gradient interface: - Interface documentation explaining CSS gradient to Android Shader conversion - getShader() method documentation with parameter and return descriptions - Added see references to implementations changelog: [internal] internal Reviewed By: javache Differential Revision: D91554867 --- .../facebook/react/uimanager/style/Gradient.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Gradient.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Gradient.kt index f5b4650bfb98af..8ba14a4637bb44 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Gradient.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Gradient.kt @@ -9,6 +9,22 @@ package com.facebook.react.uimanager.style import android.graphics.Shader +/** + * Interface representing a CSS gradient that can be rendered as an Android Shader. + * + * Implementations of this interface (such as [LinearGradient] and [RadialGradient]) convert CSS + * gradient definitions into Android Shader objects for rendering backgrounds. + * + * @see LinearGradient + * @see RadialGradient + */ internal interface Gradient { + /** + * Creates an Android Shader for rendering this gradient. + * + * @param width The width of the area to fill + * @param height The height of the area to fill + * @return A Shader instance configured for this gradient + */ fun getShader(width: Float, height: Float): Shader } From 196f52022efdb56558d4f7929bdab62c6c616e82 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 15/19] Add KDoc documentation to BorderInsets.kt Summary: Enhanced KDoc documentation for BorderInsets.kt: - Fixed typo in class documentation ("pox" -> "box") - Expanded class documentation with see reference - Added setBorderWidth() method documentation - Added resolve() method documentation with layout direction handling changelog: [internal] internal Reviewed By: javache Differential Revision: D91554902 --- .../react/uimanager/style/BorderInsets.kt | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderInsets.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderInsets.kt index 1b06c3ca1123ef..67b0424f10c087 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderInsets.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderInsets.kt @@ -12,14 +12,38 @@ import android.graphics.RectF import android.util.LayoutDirection import com.facebook.react.modules.i18nmanager.I18nUtil -/** Represents the insets from border pox to padding box (i.e. border widths) */ +/** + * Represents the insets from border box to padding box (i.e., border widths). + * + * This class stores border widths using logical edge properties and resolves them to physical edges + * based on layout direction. It supports all logical edges defined in [LogicalEdge]. + * + * @see LogicalEdge + */ internal class BorderInsets { private val edgeInsets = arrayOfNulls(LogicalEdge.values().size) + /** + * Sets the border width for a specific logical edge. + * + * @param edge The logical edge to set + * @param width The border width in pixels, or null to clear + */ fun setBorderWidth(edge: LogicalEdge, width: Float?) { edgeInsets[edge.ordinal] = width } + /** + * Resolves logical edge insets to physical edge insets based on layout direction. + * + * This method handles LTR/RTL layout direction and the doLeftAndRightSwapInRTL setting to + * correctly map logical properties to physical edges. + * + * @param layoutDirection The resolved layout direction (LTR or RTL) + * @param context Android context for RTL swap preference + * @return RectF with left, top, right, bottom insets + * @throws IllegalArgumentException if layoutDirection is not LTR or RTL + */ fun resolve( layoutDirection: Int, context: Context, From faa2650af5c0359f88c71c7773820b9c6745cb2a Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 16/19] Add KDoc documentation to BorderStyle.kt Summary: Added KDoc documentation to BorderStyle.kt: - Enum documentation explaining CSS border-style correspondence - Documented each style value: SOLID, DASHED, DOTTED - Added fromString() method documentation changelog: [internal] internal Reviewed By: javache Differential Revision: D91554949 --- .../facebook/react/uimanager/style/BorderStyle.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderStyle.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderStyle.kt index c23030b3fc9000..2ee343cdee15bf 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderStyle.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderStyle.kt @@ -7,12 +7,26 @@ package com.facebook.react.uimanager.style +/** + * Enum representing the possible border rendering styles. + * + * These values correspond to CSS border-style property values supported by React Native. + */ public enum class BorderStyle { + /** A solid continuous line. */ SOLID, + /** A series of dashes. */ DASHED, + /** A series of dots. */ DOTTED; public companion object { + /** + * Parses a string into a BorderStyle. + * + * @param borderStyle The string value (case-insensitive) + * @return The corresponding BorderStyle, or null if not recognized + */ @JvmStatic public fun fromString(borderStyle: String): BorderStyle? { return when (borderStyle.lowercase()) { From 97241f45f96714f073664af245a405d0dba71802 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 17/19] Add KDoc documentation to LogicalEdge.kt Summary: Added comprehensive KDoc documentation to LogicalEdge.kt: - Expanded enum documentation explaining physical vs logical edge naming - Documented each enum value: ALL, LEFT, RIGHT, TOP, BOTTOM, START, END, HORIZONTAL, VERTICAL, BLOCK_START, BLOCK_END, BLOCK - Added toSpacingType() method documentation - Added fromSpacingType() method documentation changelog: [internal] internal Reviewed By: javache Differential Revision: D91555014 --- .../react/uimanager/style/LogicalEdge.kt | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LogicalEdge.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LogicalEdge.kt index dbbd05e74d1832..bde6db4888301d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LogicalEdge.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LogicalEdge.kt @@ -10,41 +10,61 @@ package com.facebook.react.uimanager.style import com.facebook.react.uimanager.Spacing import java.lang.IllegalArgumentException -/** Represents the collection of possible box edges and shorthands. */ +/** + * Enum representing all possible box edges using both physical and logical naming conventions. + * + * This enum includes physical edges (LEFT, RIGHT, TOP, BOTTOM), logical edges that adapt to writing + * direction (START, END, BLOCK_START, BLOCK_END), and shorthand values (ALL, HORIZONTAL, VERTICAL, + * BLOCK). Each value can be converted to a [Spacing] type for layout calculations. + * + * @see Spacing + */ public enum class LogicalEdge { + /** Shorthand for all four edges. */ ALL { override fun toSpacingType(): Int = Spacing.ALL }, + /** The physical left edge. */ LEFT { override fun toSpacingType(): Int = Spacing.LEFT }, + /** The physical right edge. */ RIGHT { override fun toSpacingType(): Int = Spacing.RIGHT }, + /** The physical top edge. */ TOP { override fun toSpacingType(): Int = Spacing.TOP }, + /** The physical bottom edge. */ BOTTOM { override fun toSpacingType(): Int = Spacing.BOTTOM }, + /** The logical start edge (left in LTR, right in RTL). */ START { override fun toSpacingType(): Int = Spacing.START }, + /** The logical end edge (right in LTR, left in RTL). */ END { override fun toSpacingType(): Int = Spacing.END }, + /** Shorthand for left and right edges. */ HORIZONTAL { override fun toSpacingType(): Int = Spacing.HORIZONTAL }, + /** Shorthand for top and bottom edges. */ VERTICAL { override fun toSpacingType(): Int = Spacing.VERTICAL }, + /** The logical block-start edge (typically top in horizontal writing modes). */ BLOCK_START { override fun toSpacingType(): Int = Spacing.BLOCK_START }, + /** The logical block-end edge (typically bottom in horizontal writing modes). */ BLOCK_END { override fun toSpacingType(): Int = Spacing.BLOCK_END }, + /** Shorthand for block-start and block-end edges. */ BLOCK { override fun toSpacingType(): Int = Spacing.BLOCK }; @@ -54,9 +74,21 @@ public enum class LogicalEdge { // INLINE_END, // INLINE; + /** + * Converts this logical edge to the corresponding Spacing type constant. + * + * @return The Spacing constant for this edge + */ public abstract fun toSpacingType(): Int public companion object { + /** + * Converts a Spacing type constant to the corresponding LogicalEdge. + * + * @param spacingType The Spacing constant + * @return The corresponding LogicalEdge + * @throws IllegalArgumentException if the spacing type is not recognized + */ @JvmStatic public fun fromSpacingType(spacingType: Int): LogicalEdge { return when (spacingType) { From 3c9cadfb24a05176e3e878e3512c51323716223c Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 18/19] Add KDoc documentation to ComputedBorderRadius.kt Summary: Enhanced KDoc documentation for ComputedBorderRadius.kt: - ComputedBorderRadiusProp enum: Expanded documentation and documented each value - ComputedBorderRadius data class: Enhanced class documentation with property descriptions - hasRoundedBorders(): Added method documentation - isUniform(): Added method documentation - get(): Added method documentation - Secondary constructor: Added documentation changelog: [internal] internal Reviewed By: javache Differential Revision: D91555054 --- .../uimanager/style/ComputedBorderRadius.kt | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ComputedBorderRadius.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ComputedBorderRadius.kt index 234f04bd4f2cee..09fb0ad82bc250 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ComputedBorderRadius.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ComputedBorderRadius.kt @@ -7,21 +7,47 @@ package com.facebook.react.uimanager.style -/** Represents the collection of possible computed border radius style properties. */ +/** + * Enum representing the computed border radius properties for each physical corner. + * + * Unlike [BorderRadiusProp] which includes logical properties, this enum only contains the four + * physical corners after layout direction resolution. + */ public enum class ComputedBorderRadiusProp { + /** The computed border radius for the top-left corner. */ COMPUTED_BORDER_TOP_LEFT_RADIUS, + /** The computed border radius for the top-right corner. */ COMPUTED_BORDER_TOP_RIGHT_RADIUS, + /** The computed border radius for the bottom-right corner. */ COMPUTED_BORDER_BOTTOM_RIGHT_RADIUS, + /** The computed border radius for the bottom-left corner. */ COMPUTED_BORDER_BOTTOM_LEFT_RADIUS, } -/** Physical edge lengths (in DIPs) for a border-radius. */ +/** + * Represents the resolved border radius values for all four physical corners. + * + * This data class contains the final computed [CornerRadii] values (in DIPs) after resolving + * logical properties based on layout direction and ensuring no corner overlap per CSS spec. + * + * @property topLeft The radii for the top-left corner + * @property topRight The radii for the top-right corner + * @property bottomLeft The radii for the bottom-left corner + * @property bottomRight The radii for the bottom-right corner + * @see BorderRadiusStyle + * @see CornerRadii + */ public data class ComputedBorderRadius( val topLeft: CornerRadii, val topRight: CornerRadii, val bottomLeft: CornerRadii, val bottomRight: CornerRadii, ) { + /** + * Checks if any corner has a non-zero border radius. + * + * @return true if at least one corner has a positive radius + */ public fun hasRoundedBorders(): Boolean { return topLeft.horizontal > 0f || topLeft.vertical > 0f || @@ -32,10 +58,21 @@ public data class ComputedBorderRadius( bottomRight.horizontal > 0f } + /** + * Checks if all corners have the same radius values. + * + * @return true if all corners are equal + */ public fun isUniform(): Boolean { return topLeft == topRight && topLeft == bottomLeft && topLeft == bottomRight } + /** + * Gets the corner radii for a specific computed border radius property. + * + * @param property The computed border radius property + * @return The CornerRadii for the specified corner + */ public fun get(property: ComputedBorderRadiusProp): CornerRadii { return when (property) { ComputedBorderRadiusProp.COMPUTED_BORDER_TOP_LEFT_RADIUS -> topLeft @@ -45,6 +82,7 @@ public data class ComputedBorderRadius( } } + /** Creates a ComputedBorderRadius with all corners set to zero radius. */ public constructor() : this(CornerRadii(0f, 0f), CornerRadii(0f, 0f), CornerRadii(0f, 0f), CornerRadii(0f, 0f)) } From 2858ac62efd94c42799dcfd47a0696b3030df877 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 27 Jan 2026 13:36:23 -0800 Subject: [PATCH 19/19] Add KDoc documentation to Overflow.kt Summary: Added KDoc documentation to Overflow.kt: - Enum documentation explaining CSS overflow correspondence - Documented each value: VISIBLE, HIDDEN, SCROLL - Added fromString() method documentation changelog: [internal] internal Reviewed By: javache Differential Revision: D91555087 --- .../facebook/react/uimanager/style/Overflow.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Overflow.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Overflow.kt index 46200742c47855..1b86546ae73396 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Overflow.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Overflow.kt @@ -7,12 +7,27 @@ package com.facebook.react.uimanager.style +/** + * Enum representing the overflow behavior of a view's content. + * + * These values correspond to CSS overflow property values, controlling how content that exceeds the + * view's bounds is handled. + */ internal enum class Overflow { + /** Content is not clipped and may be visible outside the view's bounds. */ VISIBLE, + /** Content is clipped to the view's bounds without scrolling. */ HIDDEN, + /** Content is clipped to the view's bounds but can be scrolled to reveal hidden content. */ SCROLL; companion object { + /** + * Parses a string into an Overflow value. + * + * @param overflow The string value (case-insensitive) + * @return The corresponding Overflow, or null if not recognized + */ @JvmStatic fun fromString(overflow: String): Overflow? { return when (overflow.lowercase()) {