forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ContenstSizeChangeEvent.java->.kt (facebook#45700)
Summary: Pull Request resolved: facebook#45700 # Changelog: [Internal] - As in the title. Differential Revision: D60280502
- Loading branch information
1 parent
9c61d9a
commit 76fca59
Showing
3 changed files
with
42 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
...eactAndroid/src/main/java/com/facebook/react/uimanager/events/ContentSizeChangeEvent.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
.../ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ContentSizeChangeEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |