-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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 (#45700)
Summary: Pull Request resolved: #45700 # Changelog: [Internal] - As in the title. Reviewed By: tdn120 Differential Revision: D60280502 fbshipit-source-id: 976004e2cb289b72eef02e5288026cf6e2dba832
- Loading branch information
1 parent
006c139
commit bf0705a
Showing
3 changed files
with
38 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.
37 changes: 37 additions & 0 deletions
37
.../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,37 @@ | ||
/* | ||
* 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 = "topContentSizeChange" | ||
|
||
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 | ||
} | ||
} |