mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Migrate ReactContentSizeChangedEvent to Kotlin (#50204)
Summary: Migrate com.facebook.react.views.textinput.ReactContentSizeChangedEvent to Kotlin. ## Changelog: [INTERNAL] - Migrate com.facebook.react.views.textinput.ReactContentSizeChangedEvent to Kotlin Pull Request resolved: https://github.com/facebook/react-native/pull/50204 Test Plan: ```bash yarn test-android yarn android ``` Reviewed By: javache Differential Revision: D71681505 Pulled By: arushikesarwani94 fbshipit-source-id: f4d63251afc48652032e9beaf60073797f2bb246
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cd04aae1a3
commit
7c7d64496d
@@ -7034,14 +7034,17 @@ public abstract interface class com/facebook/react/views/textinput/ContentSizeWa
|
||||
public abstract fun onLayout ()V
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/textinput/ReactContentSizeChangedEvent : com/facebook/react/uimanager/events/Event {
|
||||
public final class com/facebook/react/views/textinput/ReactContentSizeChangedEvent : com/facebook/react/uimanager/events/Event {
|
||||
public static final field Companion Lcom/facebook/react/views/textinput/ReactContentSizeChangedEvent$Companion;
|
||||
public static final field EVENT_NAME Ljava/lang/String;
|
||||
public fun <init> (IFF)V
|
||||
public fun <init> (IIFF)V
|
||||
protected fun getEventData ()Lcom/facebook/react/bridge/WritableMap;
|
||||
public fun getEventName ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class com/facebook/react/views/textinput/ReactContentSizeChangedEvent$Companion {
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/textinput/ReactEditText : androidx/appcompat/widget/AppCompatEditText {
|
||||
public static final field DEBUG_MODE Z
|
||||
protected field mContainsImages Z
|
||||
|
||||
-54
@@ -1,54 +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.textinput;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
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;
|
||||
|
||||
/** Event emitted by EditText native view when content size changes. */
|
||||
public class ReactContentSizeChangedEvent extends Event<ReactTextChangedEvent> {
|
||||
|
||||
public static final String EVENT_NAME = "topContentSizeChange";
|
||||
|
||||
private float mContentWidth;
|
||||
private float mContentHeight;
|
||||
|
||||
@Deprecated
|
||||
public ReactContentSizeChangedEvent(int viewId, float contentSizeWidth, float contentSizeHeight) {
|
||||
this(ViewUtil.NO_SURFACE_ID, viewId, contentSizeWidth, contentSizeHeight);
|
||||
}
|
||||
|
||||
public ReactContentSizeChangedEvent(
|
||||
int surfaceId, int viewId, float contentSizeWidth, float contentSizeHeight) {
|
||||
super(surfaceId, viewId);
|
||||
mContentWidth = contentSizeWidth;
|
||||
mContentHeight = contentSizeHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventName() {
|
||||
return EVENT_NAME;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected WritableMap getEventData() {
|
||||
WritableMap eventData = Arguments.createMap();
|
||||
|
||||
WritableMap contentSize = Arguments.createMap();
|
||||
contentSize.putDouble("width", mContentWidth);
|
||||
contentSize.putDouble("height", mContentHeight);
|
||||
eventData.putMap("contentSize", contentSize);
|
||||
|
||||
eventData.putInt("target", getViewTag());
|
||||
return eventData;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.textinput
|
||||
|
||||
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
|
||||
|
||||
/** Event emitted by EditText native view when content size changes. */
|
||||
public class ReactContentSizeChangedEvent(
|
||||
surfaceId: Int,
|
||||
viewId: Int,
|
||||
private val contentWidth: Float,
|
||||
private val contentHeight: Float
|
||||
) : Event<ReactTextChangedEvent>(surfaceId, viewId) {
|
||||
@Deprecated(
|
||||
"Use the constructor with surfaceId instead",
|
||||
ReplaceWith(
|
||||
"ReactContentSizeChangedEvent(surfaceId, viewId, contentSizeWidth, contentSizeHeight)"))
|
||||
public constructor(
|
||||
viewId: Int,
|
||||
contentSizeWidth: Float,
|
||||
contentSizeHeight: Float
|
||||
) : this(ViewUtil.NO_SURFACE_ID, viewId, contentSizeWidth, contentSizeHeight)
|
||||
|
||||
override fun getEventName(): String = EVENT_NAME
|
||||
|
||||
override fun getEventData(): WritableMap? {
|
||||
val contentSize =
|
||||
Arguments.createMap().apply {
|
||||
putDouble("width", contentWidth.toDouble())
|
||||
putDouble("height", contentHeight.toDouble())
|
||||
}
|
||||
|
||||
return Arguments.createMap().apply {
|
||||
putMap("contentSize", contentSize)
|
||||
putInt("target", viewTag)
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
public const val EVENT_NAME: String = "topContentSizeChange"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user