Skip to content

Commit

Permalink
Kotlinify SimpleViewManager (#43834)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #43834

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55708429

fbshipit-source-id: ff76e5dc2e8c6d99b7792ed58e8bcd5e1441b2dd
  • Loading branch information
fabriziocucci authored and facebook-github-bot committed Apr 4, 2024
1 parent af35442 commit 06a3028
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.uimanager;
package com.facebook.react.uimanager

import android.view.View;
import com.facebook.infer.annotation.Nullsafe;
import android.view.View

/**
* Common base class for most of the {@link ViewManager}s. It provides support for most common
Expand All @@ -18,20 +17,15 @@
*
* @param <T> the view handled by this manager
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public abstract class SimpleViewManager<T extends View>
extends BaseViewManager<T, LayoutShadowNode> {
public abstract class SimpleViewManager<T : View> : BaseViewManager<T, LayoutShadowNode>() {

@Override
public LayoutShadowNode createShadowNodeInstance() {
return new LayoutShadowNode();
override public fun createShadowNodeInstance(): LayoutShadowNode {
return LayoutShadowNode()
}

@Override
public Class<LayoutShadowNode> getShadowNodeClass() {
return LayoutShadowNode.class;
override public fun getShadowNodeClass(): Class<LayoutShadowNode> {
return LayoutShadowNode::class.java
}

@Override
public void updateExtraData(T root, Object extraData) {}
override public fun updateExtraData(root: T, extraData: Any?): Unit = Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.robolectric.RuntimeEnvironment
@RunWith(RobolectricTestRunner::class)
class SimpleViewPropertyTest {

private class ConcreteViewManager : SimpleViewManager<View?>() {
private class ConcreteViewManager : SimpleViewManager<View>() {
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "foo")
fun setFoo(view: View, foo: Boolean) = Unit
Expand Down

0 comments on commit 06a3028

Please sign in to comment.