Skip to content

Commit e02bc88

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Fix FieldsBelowInit: Reorder properties in DiffClampAnimatedNode (facebook#55361)
Summary: Fixed FieldsBelowInit lint error in DiffClampAnimatedNode.kt. Moved `inputNodeValue` computed property above the init block to follow Kotlin initialization order conventions. changelog: [internal] internal Reviewed By: cortinico Differential Revision: D91737148
1 parent 0971316 commit e02bc88

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ internal class DiffClampAnimatedNode(
2121
private val maxValue: Double
2222
private var lastValue: Double = 0.0
2323

24+
private val inputNodeValue: Double
25+
get() {
26+
val animatedNode = nativeAnimatedNodesManager.getNodeById(inputNodeTag)
27+
if (animatedNode == null || animatedNode !is ValueAnimatedNode) {
28+
throw JSApplicationCausedNativeException(
29+
"Illegal node ID set as an input for Animated.DiffClamp node"
30+
)
31+
}
32+
return animatedNode.getValue()
33+
}
34+
2435
init {
2536
inputNodeTag = config.getInt("input")
2637
minValue = config.getDouble("min")
@@ -35,17 +46,6 @@ internal class DiffClampAnimatedNode(
3546
nodeValue = min(max(nodeValue + diff, minValue), maxValue)
3647
}
3748

38-
private val inputNodeValue: Double
39-
get() {
40-
val animatedNode = nativeAnimatedNodesManager.getNodeById(inputNodeTag)
41-
if (animatedNode == null || animatedNode !is ValueAnimatedNode) {
42-
throw JSApplicationCausedNativeException(
43-
"Illegal node ID set as an input for Animated.DiffClamp node"
44-
)
45-
}
46-
return animatedNode.getValue()
47-
}
48-
4949
override fun prettyPrint(): String =
5050
"DiffClampAnimatedNode[$tag]: InputNodeTag: $inputNodeTag min: $minValue " +
5151
"max: $maxValue lastValue: $lastValue super: ${super.prettyPrint()}"

0 commit comments

Comments
 (0)