Skip to content

Commit

Permalink
Migrate ContenstSizeChangeEvent.java->.kt (facebook#45700)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#45700

# Changelog:
[Internal] -

As in the title.

Differential Revision: D60280502
  • Loading branch information
rshest authored and facebook-github-bot committed Jul 26, 2024
1 parent 9c61d9a commit 76fca59
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 55 deletions.
4 changes: 1 addition & 3 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -5563,11 +5563,9 @@ public class com/facebook/react/uimanager/events/BlackHoleEventDispatcher : com/
public fun unregisterEventEmitter (I)V
}

public class com/facebook/react/uimanager/events/ContentSizeChangeEvent : com/facebook/react/uimanager/events/Event {
public static final field EVENT_NAME Ljava/lang/String;
public final class com/facebook/react/uimanager/events/ContentSizeChangeEvent : com/facebook/react/uimanager/events/Event {
public fun <init> (III)V
public fun <init> (IIII)V
protected fun getEventData ()Lcom/facebook/react/bridge/WritableMap;
public fun getEventName ()Ljava/lang/String;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.
*/

@file:Suppress("DEPRECATION")

package com.facebook.react.uimanager.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableMap
import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel

/** Event dispatched when total width or height of a view's children changes. */
@Deprecated("Please define your own event for custom components")
public class ContentSizeChangeEvent(
surfaceId: Int,
viewTag: Int,
private val width: Int,
private val height: Int
) : Event<ContentSizeChangeEvent>(surfaceId, viewTag) {
@Deprecated(
"Please specify surfaceId explicitly in the constructor.",
ReplaceWith("constructor(surfaceId, viewTag, width, height)"))
public constructor(viewTag: Int, width: Int, height: Int) : this(-1, viewTag, width, height)

public override fun getEventName(): String = EVENT_NAME

protected override fun getEventData(): WritableMap {
val res = Arguments.createMap()
res.putDouble("width", toDIPFromPixel(width.toFloat()).toDouble())
res.putDouble("height", toDIPFromPixel(height.toFloat()).toDouble())
return res
}

private companion object {
private const val EVENT_NAME: String = "topContentSizeChange"
}
}

0 comments on commit 76fca59

Please sign in to comment.