Skip to content

Commit

Permalink
Undo breaking change on Dynamic.type and Dynamic.isNull (#45378)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #45378

Kotlin consumers of those APIs are forced with this breaking change:

```
# Before thanks to Java property conversion
Dynamic.type
# After
Dynamic.getType()
```
This restores the old more idiomatic API by moving those 2 funcitons to be vals.

Changelog:
[Android] [Fixed] - Undo breaking change on Dynamic.type and Dynamic.isNull

Reviewed By: javache

Differential Revision: D59631783

fbshipit-source-id: 8d720af34e104ee0e4f3120302a4a84fc17a7b1c
  • Loading branch information
cortinico authored and facebook-github-bot committed Jul 11, 2024
1 parent 3849830 commit 5e31b45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ package com.facebook.react.bridge
* pass one of multiple types down to the native layer.
*/
public interface Dynamic {
public val type: ReadableType

public val isNull: Boolean

public fun asArray(): ReadableArray

public fun asBoolean(): Boolean
Expand All @@ -24,9 +28,5 @@ public interface Dynamic {

public fun asString(): String

public fun getType(): ReadableType

public fun isNull(): Boolean

public fun recycle(): Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class LengthPercentage(
public companion object {
@JvmStatic
public fun setFromDynamic(dynamic: Dynamic): LengthPercentage? {
return when (dynamic.getType()) {
return when (dynamic.type) {
ReadableType.Number -> {
val value = dynamic.asDouble()
if (value >= 0f) {
Expand Down Expand Up @@ -54,7 +54,7 @@ public class LengthPercentage(
}
}
else -> {
FLog.w(ReactConstants.TAG, "Unsupported type for radius property: ${dynamic.getType()}")
FLog.w(ReactConstants.TAG, "Unsupported type for radius property: ${dynamic.type}")
null
}
}
Expand Down

0 comments on commit 5e31b45

Please sign in to comment.