Skip to content

Add EventEmitterListener when ShadowNodeFamily is created #50264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<9a17ecc37b3ecd8c0830d9875e8b4453>>
* @generated SignedSource<<9f43ddaa47a45d604adda2e2296c1484>>
*/

/**
Expand Down Expand Up @@ -42,6 +42,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun animatedShouldSignalBatch(): Boolean = accessor.animatedShouldSignalBatch()

/**
* Use a C++ implementation of Native Animated instead of the platform implementation.
*/
@JvmStatic
public fun cxxNativeAnimatedEnabled(): Boolean = accessor.cxxNativeAnimatedEnabled()

/**
* Prevent FabricMountingManager from reordering mountItems, which may lead to invalid state on the UI thread
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a510210d8ca4af5b17ea54113ace27b4>>
* @generated SignedSource<<7196636e08059866a9324ab57609e492>>
*/

/**
Expand All @@ -22,6 +22,7 @@ package com.facebook.react.internal.featureflags
internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
private var commonTestFlagCache: Boolean? = null
private var animatedShouldSignalBatchCache: Boolean? = null
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
Expand Down Expand Up @@ -80,6 +81,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun cxxNativeAnimatedEnabled(): Boolean {
var cached = cxxNativeAnimatedEnabledCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.cxxNativeAnimatedEnabled()
cxxNativeAnimatedEnabledCache = cached
}
return cached
}

override fun disableMountItemReorderingAndroid(): Boolean {
var cached = disableMountItemReorderingAndroidCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<773a44eea2720802432ce2f0b8d19027>>
* @generated SignedSource<<463515a955baca809dd6463107ca325c>>
*/

/**
Expand Down Expand Up @@ -32,6 +32,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun animatedShouldSignalBatch(): Boolean

@DoNotStrip @JvmStatic public external fun cxxNativeAnimatedEnabled(): Boolean

@DoNotStrip @JvmStatic public external fun disableMountItemReorderingAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<6144e43dc39f259ac7f4de359da03d03>>
* @generated SignedSource<<0c111ea4ea86fce421aa4addb8ad0e4e>>
*/

/**
Expand All @@ -27,6 +27,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun animatedShouldSignalBatch(): Boolean = false

override fun cxxNativeAnimatedEnabled(): Boolean = false

override fun disableMountItemReorderingAndroid(): Boolean = false

override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<22c91abf446f63afd0c09b02536b13f0>>
* @generated SignedSource<<6171c6bc5492b1a0252746e928754f97>>
*/

/**
Expand All @@ -26,6 +26,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc

private var commonTestFlagCache: Boolean? = null
private var animatedShouldSignalBatchCache: Boolean? = null
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
Expand Down Expand Up @@ -86,6 +87,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun cxxNativeAnimatedEnabled(): Boolean {
var cached = cxxNativeAnimatedEnabledCache
if (cached == null) {
cached = currentProvider.cxxNativeAnimatedEnabled()
accessedFeatureFlags.add("cxxNativeAnimatedEnabled")
cxxNativeAnimatedEnabledCache = cached
}
return cached
}

override fun disableMountItemReorderingAndroid(): Boolean {
var cached = disableMountItemReorderingAndroidCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<3e4b1e03b718d5c2ea03b0a29382d849>>
* @generated SignedSource<<a4f3222340cd676eefdd3794d3f1d4da>>
*/

/**
Expand All @@ -27,6 +27,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun animatedShouldSignalBatch(): Boolean

@DoNotStrip public fun cxxNativeAnimatedEnabled(): Boolean

@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean

@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.facebook.react.bridge.ModuleSpec
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.common.ClassFinder
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.module.annotations.ReactModuleList
import com.facebook.react.module.model.ReactModuleInfo
Expand Down Expand Up @@ -115,7 +116,9 @@ constructor(private val config: MainPackageConfig? = null) :
ImageLoaderModule.NAME -> ImageLoaderModule(reactContext)
ImageStoreManager.NAME -> ImageStoreManager(reactContext)
IntentModule.NAME -> IntentModule(reactContext)
NativeAnimatedModule.NAME -> NativeAnimatedModule(reactContext)
NativeAnimatedModule.NAME ->
if (ReactNativeFeatureFlags.cxxNativeAnimatedEnabled()) null
else NativeAnimatedModule(reactContext)
NetworkingModule.NAME -> NetworkingModule(reactContext)
PermissionsModule.NAME -> PermissionsModule(reactContext)
ShareModule.NAME -> ShareModule(reactContext)
Expand Down Expand Up @@ -228,30 +231,33 @@ constructor(private val config: MainPackageConfig? = null) :
// We fall back to creating this by hand
val moduleList: Array<Class<*>> =
arrayOf(
AccessibilityInfoModule::class.java,
AppearanceModule::class.java,
AppStateModule::class.java,
BlobModule::class.java,
DevLoadingModule::class.java,
FileReaderModule::class.java,
ClipboardModule::class.java,
DialogModule::class.java,
FrescoModule::class.java,
I18nManagerModule::class.java,
ImageLoaderModule::class.java,
ImageStoreManager::class.java,
IntentModule::class.java,
NativeAnimatedModule::class.java,
NetworkingModule::class.java,
PermissionsModule::class.java,
ReactDevToolsSettingsManagerModule::class.java,
ReactDevToolsRuntimeSettingsModule::class.java,
ShareModule::class.java,
StatusBarModule::class.java,
SoundManagerModule::class.java,
ToastModule::class.java,
VibrationModule::class.java,
WebSocketModule::class.java)
AccessibilityInfoModule::class.java,
AppearanceModule::class.java,
AppStateModule::class.java,
BlobModule::class.java,
DevLoadingModule::class.java,
FileReaderModule::class.java,
ClipboardModule::class.java,
DialogModule::class.java,
FrescoModule::class.java,
I18nManagerModule::class.java,
ImageLoaderModule::class.java,
ImageStoreManager::class.java,
IntentModule::class.java,
if (ReactNativeFeatureFlags.cxxNativeAnimatedEnabled()) null
else NativeAnimatedModule::class.java,
NetworkingModule::class.java,
PermissionsModule::class.java,
ReactDevToolsSettingsManagerModule::class.java,
ReactDevToolsRuntimeSettingsModule::class.java,
ShareModule::class.java,
StatusBarModule::class.java,
SoundManagerModule::class.java,
ToastModule::class.java,
VibrationModule::class.java,
WebSocketModule::class.java)
.filterNotNull()
.toTypedArray()

val moduleMap =
moduleList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<86e118b823d49cb08bfb204788fa7f73>>
* @generated SignedSource<<2e1dacd320fd57c091996e3e8e2843a9>>
*/

/**
Expand Down Expand Up @@ -51,6 +51,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}

bool cxxNativeAnimatedEnabled() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("cxxNativeAnimatedEnabled");
return method(javaProvider_);
}

bool disableMountItemReorderingAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableMountItemReorderingAndroid");
Expand Down Expand Up @@ -299,6 +305,11 @@ bool JReactNativeFeatureFlagsCxxInterop::animatedShouldSignalBatch(
return ReactNativeFeatureFlags::animatedShouldSignalBatch();
}

bool JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::cxxNativeAnimatedEnabled();
}

bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
Expand Down Expand Up @@ -531,6 +542,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"animatedShouldSignalBatch",
JReactNativeFeatureFlagsCxxInterop::animatedShouldSignalBatch),
makeNativeMethod(
"cxxNativeAnimatedEnabled",
JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedEnabled),
makeNativeMethod(
"disableMountItemReorderingAndroid",
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d6d24b5374dd661de4917bcc6f4ec53b>>
* @generated SignedSource<<d0b8fdd82018fab8e5532123d5254cf4>>
*/

/**
Expand Down Expand Up @@ -36,6 +36,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool animatedShouldSignalBatch(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool cxxNativeAnimatedEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool disableMountItemReorderingAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<3a47a14617ae6faad151ecd64a4613ff>>
* @generated SignedSource<<ae8953b9c5b0efae6fe67b9b799426d7>>
*/

/**
Expand Down Expand Up @@ -34,6 +34,10 @@ bool ReactNativeFeatureFlags::animatedShouldSignalBatch() {
return getAccessor().animatedShouldSignalBatch();
}

bool ReactNativeFeatureFlags::cxxNativeAnimatedEnabled() {
return getAccessor().cxxNativeAnimatedEnabled();
}

bool ReactNativeFeatureFlags::disableMountItemReorderingAndroid() {
return getAccessor().disableMountItemReorderingAndroid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<eeb0afc2cc447a5ba26300a7ce5cee12>>
* @generated SignedSource<<cc7536e8280fdc7d3f2106486439676a>>
*/

/**
Expand Down Expand Up @@ -49,6 +49,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool animatedShouldSignalBatch();

/**
* Use a C++ implementation of Native Animated instead of the platform implementation.
*/
RN_EXPORT static bool cxxNativeAnimatedEnabled();

/**
* Prevent FabricMountingManager from reordering mountItems, which may lead to invalid state on the UI thread
*/
Expand Down
Loading
Loading