Kotlinify DrawerStateChangedEvent (#43835)

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

Changelog: [Internal]

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

Reviewed By: alanleedev

Differential Revision: D55709997

fbshipit-source-id: 43c89680ca373c6f68119f63107c616568df0cbc
This commit is contained in:
Fabrizio Cucci
2024-04-04 02:00:36 -07:00
committed by Facebook GitHub Bot
parent 4b580c0060
commit f937f55ec4
3 changed files with 50 additions and 51 deletions
@@ -6010,15 +6010,18 @@ public final class com/facebook/react/views/drawer/events/DrawerSlideEvent : com
public final class com/facebook/react/views/drawer/events/DrawerSlideEvent$Companion {
}
public class com/facebook/react/views/drawer/events/DrawerStateChangedEvent : com/facebook/react/uimanager/events/Event {
public final class com/facebook/react/views/drawer/events/DrawerStateChangedEvent : com/facebook/react/uimanager/events/Event {
public static final field Companion Lcom/facebook/react/views/drawer/events/DrawerStateChangedEvent$Companion;
public static final field EVENT_NAME Ljava/lang/String;
public fun <init> (II)V
public fun <init> (III)V
public fun getDrawerState ()I
protected fun getEventData ()Lcom/facebook/react/bridge/WritableMap;
public final fun getDrawerState ()I
public fun getEventName ()Ljava/lang/String;
}
public final class com/facebook/react/views/drawer/events/DrawerStateChangedEvent$Companion {
}
public abstract interface class com/facebook/react/views/image/GlobalImageLoadListener {
public abstract fun onLoadAttempt (Landroid/net/Uri;)V
}
@@ -1,48 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.drawer.events;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.common.ViewUtil;
import com.facebook.react.uimanager.events.Event;
@Nullsafe(Nullsafe.Mode.LOCAL)
public class DrawerStateChangedEvent extends Event<DrawerStateChangedEvent> {
public static final String EVENT_NAME = "topDrawerStateChanged";
private final int mDrawerState;
@Deprecated
public DrawerStateChangedEvent(int viewId, int drawerState) {
this(ViewUtil.NO_SURFACE_ID, viewId, drawerState);
}
public DrawerStateChangedEvent(int surfaceId, int viewId, int drawerState) {
super(surfaceId, viewId);
mDrawerState = drawerState;
}
public int getDrawerState() {
return mDrawerState;
}
@Override
public String getEventName() {
return EVENT_NAME;
}
@Override
protected WritableMap getEventData() {
WritableMap eventData = Arguments.createMap();
eventData.putDouble("drawerState", getDrawerState());
return eventData;
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.drawer.events
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableMap
import com.facebook.react.uimanager.common.ViewUtil
import com.facebook.react.uimanager.events.Event
public class DrawerStateChangedEvent : Event<DrawerStateChangedEvent> {
private val drawerState: Int
@Deprecated(
"Use constructor with surfaceId",
ReplaceWith("DrawerStateChangedEvent(surfaceId, viewId, drawerState)"))
public constructor(
viewId: Int,
drawerState: Int
) : this(ViewUtil.NO_SURFACE_ID, viewId, drawerState)
public constructor(surfaceId: Int, viewId: Int, drawerState: Int) : super(surfaceId, viewId) {
this.drawerState = drawerState
}
public fun getDrawerState(): Int = drawerState
override public fun getEventName(): String = EVENT_NAME
override protected fun getEventData(): WritableMap? {
val eventData: WritableMap = Arguments.createMap()
eventData.putInt("drawerState", getDrawerState())
return eventData
}
public companion object {
public const val EVENT_NAME: String = "topDrawerStateChanged"
}
}