mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Undo breaking change on ViewManagerDelegate.kt String params (#47086)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47086 When we migrated `ViewManagerDelegate` to Kotlin, we convered his string params to be `String` (rather than `String?`). Existing implementation of this interface in OSS written in Kotlin were using `String?` due to this interface being in Java (and not being Nullsafe annotated). Therefore now changing this interface from `String?` to `String` is a breaking change for them. Affected libraries are: https://github.com/search?q=%22fun+receiveCommand%28%22+%22commandId%3A+String%3F%22+%22args%3A+ReadableArray%22+language%3Akotlin+-org%3Afacebook+-is%3Afork&type=code&p=4 This prevents the breaking change and should be included in 0.76. Changelog: [Android] [Fixed] - Undo breaking change on ViewManagerDelegate.kt String params Reviewed By: cipolleschi Differential Revision: D64532446 fbshipit-source-id: aac286554ad0e35f557160f900bcbad1acc5930d
This commit is contained in:
committed by
Riccardo Cipolleschi
parent
ab0d812cc6
commit
ce1620616c
+2
-2
@@ -22,7 +22,7 @@ import com.facebook.yoga.YogaConstants
|
||||
public abstract class BaseViewManagerDelegate<T : View, U : BaseViewManagerInterface<T>>(
|
||||
@Suppress("NoHungarianNotation") @JvmField protected val mViewManager: U
|
||||
) : ViewManagerDelegate<T> {
|
||||
override public fun setProperty(view: T, propName: String, value: Any?) {
|
||||
override public fun setProperty(view: T, propName: String?, value: Any?) {
|
||||
when (propName) {
|
||||
ViewProps.ACCESSIBILITY_ACTIONS ->
|
||||
mViewManager.setAccessibilityActions(view, value as ReadableArray?)
|
||||
@@ -104,6 +104,6 @@ public abstract class BaseViewManagerDelegate<T : View, U : BaseViewManagerInter
|
||||
}
|
||||
}
|
||||
|
||||
override public fun receiveCommand(view: T, commandName: String, args: ReadableArray?): Unit =
|
||||
override public fun receiveCommand(view: T, commandName: String?, args: ReadableArray?): Unit =
|
||||
Unit
|
||||
}
|
||||
|
||||
+19
-2
@@ -18,7 +18,24 @@ import com.facebook.react.bridge.ReadableArray
|
||||
* @param <T> the type of the view supported by this delegate </T>
|
||||
*/
|
||||
public interface ViewManagerDelegate<T : View?> {
|
||||
public fun setProperty(view: T, propName: String, value: Any?)
|
||||
|
||||
public fun receiveCommand(view: T, commandName: String, args: ReadableArray?)
|
||||
/**
|
||||
* Sets a property on a view managed by this view manager.
|
||||
*
|
||||
* @param view the view to set the property on
|
||||
* @param propName the name of the property to set (NOTE: should be `String` but is kept as
|
||||
* `String?` to avoid breaking changes)
|
||||
* @param value the value to set the property to
|
||||
*/
|
||||
public fun setProperty(view: T, propName: String?, value: Any?)
|
||||
|
||||
/**
|
||||
* Executes a command from JS to the view
|
||||
*
|
||||
* @param view the view to execute the command on
|
||||
* @param commandName the name of the command to execute (NOTE: should be `String` but is kept as
|
||||
* `String?` to avoid breaking changes)
|
||||
* @param args the arguments to pass to the command
|
||||
*/
|
||||
public fun receiveCommand(view: T, commandName: String?, args: ReadableArray?)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user