Skip to content

Commit fdbcfb6

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent e387267 commit fdbcfb6

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ import kotlin.math.atan
1818
import kotlin.math.sqrt
1919
import kotlin.math.tan
2020

21+
/**
22+
* Represents a CSS linear gradient for background rendering.
23+
*
24+
* This class implements the CSS linear-gradient specification, supporting angle-based and
25+
* keyword-based directions along with color stops. It generates an Android Shader for rendering.
26+
*
27+
* @property direction The direction of the gradient (angle or keyword)
28+
* @property colorStops The list of color stops defining the gradient colors
29+
* @see <a href="https://www.w3.org/TR/css-images-3/#linear-gradients">CSS Linear Gradients</a>
30+
*/
2131
internal class LinearGradient(val direction: Direction, val colorStops: List<ColorStop>) :
2232
Gradient {
2333
companion object {
@@ -76,15 +86,39 @@ internal class LinearGradient(val direction: Direction, val colorStops: List<Col
7686
}
7787
}
7888

89+
/**
90+
* Sealed class representing the direction of a linear gradient.
91+
*
92+
* Directions can be specified using explicit angles or CSS keywords.
93+
*/
7994
sealed class Direction {
95+
/**
96+
* Represents a direction specified as an angle in degrees.
97+
*
98+
* @property angle The angle in degrees (0 = to top, 90 = to right, etc.)
99+
*/
80100
class Angle(val angle: Double) : Direction()
81101

102+
/**
103+
* Represents a direction specified using a CSS keyword.
104+
*
105+
* @property keyword The direction keyword
106+
*/
82107
class Keyword(val keyword: KeywordType) : Direction()
83108

109+
/**
110+
* Enum of CSS linear gradient direction keywords.
111+
*
112+
* @property value The CSS string value
113+
*/
84114
enum class KeywordType(val value: String) {
115+
/** Gradient runs toward the top-right corner. */
85116
TO_TOP_RIGHT("to top right"),
117+
/** Gradient runs toward the bottom-right corner. */
86118
TO_BOTTOM_RIGHT("to bottom right"),
119+
/** Gradient runs toward the top-left corner. */
87120
TO_TOP_LEFT("to top left"),
121+
/** Gradient runs toward the bottom-left corner. */
88122
TO_BOTTOM_LEFT("to bottom left");
89123

90124
companion object {

0 commit comments

Comments
 (0)