Skip to content

Commit 196f520

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent 65a5d62 commit 196f520

1 file changed

Lines changed: 25 additions & 1 deletion

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/BorderInsets.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,38 @@ import android.graphics.RectF
1212
import android.util.LayoutDirection
1313
import com.facebook.react.modules.i18nmanager.I18nUtil
1414

15-
/** Represents the insets from border pox to padding box (i.e. border widths) */
15+
/**
16+
* Represents the insets from border box to padding box (i.e., border widths).
17+
*
18+
* This class stores border widths using logical edge properties and resolves them to physical edges
19+
* based on layout direction. It supports all logical edges defined in [LogicalEdge].
20+
*
21+
* @see LogicalEdge
22+
*/
1623
internal class BorderInsets {
1724
private val edgeInsets = arrayOfNulls<Float?>(LogicalEdge.values().size)
1825

26+
/**
27+
* Sets the border width for a specific logical edge.
28+
*
29+
* @param edge The logical edge to set
30+
* @param width The border width in pixels, or null to clear
31+
*/
1932
fun setBorderWidth(edge: LogicalEdge, width: Float?) {
2033
edgeInsets[edge.ordinal] = width
2134
}
2235

36+
/**
37+
* Resolves logical edge insets to physical edge insets based on layout direction.
38+
*
39+
* This method handles LTR/RTL layout direction and the doLeftAndRightSwapInRTL setting to
40+
* correctly map logical properties to physical edges.
41+
*
42+
* @param layoutDirection The resolved layout direction (LTR or RTL)
43+
* @param context Android context for RTL swap preference
44+
* @return RectF with left, top, right, bottom insets
45+
* @throws IllegalArgumentException if layoutDirection is not LTR or RTL
46+
*/
2347
fun resolve(
2448
layoutDirection: Int,
2549
context: Context,

0 commit comments

Comments
 (0)