Fix FieldsBelowInit: Move property declarations before init block (#55513)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55513

Fixed FieldsBelowInit lint warning in SurfaceHandlerBinding.kt.

Moved the property declarations (surfaceId, isRunning, moduleName) before the
init block to follow Kotlin best practices for initialization order.

Note: These are computed properties (getters) that call native methods, so the
warning was technically a false positive, but reordering improves code clarity.

changelog: [internal] internal

Reviewed By: alanleedev, NickGerleman

Differential Revision: D92024128

fbshipit-source-id: 8627edf02806d8767b72ed9adcbb15a5e2fca927
This commit is contained in:
David Vacca authored and meta-codesync[bot] committed 2026-02-26 10:51:40 -08:00
1 parent 47684ca48f
commit fc9940da1b
1 file changed
+6 -6
@@ -13,12 +13,6 @@ import com.facebook.react.fabric.mounting.LayoutMetricsConversions
internal open class SurfaceHandlerBinding(moduleName: String) : HybridClassBase() {
init {
initHybrid(NO_SURFACE_ID, moduleName)
}
private external fun initHybrid(surfaceId: Int, moduleName: String)
val surfaceId: Int
get() = _getSurfaceId()
@@ -28,6 +22,12 @@ internal open class SurfaceHandlerBinding(moduleName: String) : HybridClassBase(
val moduleName: String
get() = _getModuleName()
init {
initHybrid(NO_SURFACE_ID, moduleName)
}
private external fun initHybrid(surfaceId: Int, moduleName: String)
private external fun _getSurfaceId(): Int
private external fun _getModuleName(): String