Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -5561,11 +5561,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,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.runtime.internal.bolts

import com.facebook.react.bridge.UiThreadUtil
import java.util.concurrent.Executor

/**
* This was created because the helper methods in [java.util.concurrent.Executors] do not work as
* people would normally expect.
*
* Normally, you would think that a cached thread pool would create new threads when necessary,
* queue them when the pool is full, and kill threads when they've been inactive for a certain
* period of time. This is not how [java.util.concurrent.Executors.newCachedThreadPool] works.
*
* Instead, [java.util.concurrent.Executors.newCachedThreadPool] executes all tasks on a new or
* cached thread immediately because corePoolSize is 0, SynchronousQueue is a queue with size 0 and
* maxPoolSize is Integer.MAX_VALUE. This is dangerous because it can create an unchecked amount of
* threads.
*/
internal object Executors {
@JvmField public val UI_THREAD: Executor = UIThreadExecutor()
@JvmField public val IMMEDIATE: Executor = ImmediateExecutor()

private class UIThreadExecutor : Executor {
override fun execute(command: Runnable) {
UiThreadUtil.runOnUiThread(command)
}
}

/**
* An [java.util.concurrent.Executor] that schedules tasks to run asynchronously on the UI thread.
*/
private class ImmediateExecutor : Executor {
override fun execute(command: Runnable) {
command.run()
}
}
}

This file was deleted.

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
}
}