Skip to content
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<<a89ede36c4631b7a7709899858a7f9c9>>
* @generated SignedSource<<251ba53185bdf10220816b4c239ef6d5>>
*/

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

/**
* Skip native prop metadata generation on Android for view managers with custom delegates. Requires their components to use static view configs.
*/
@JvmStatic
public fun skipNativePropsForViewManagerWithDelegateAndroid(): Boolean = accessor.skipNativePropsForViewManagerWithDelegateAndroid()

/**
* When a node changes, the differ leaves out its children that are unchanged in both trees instead of describing and comparing them.
*/
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<<cd3b4f6a7fb4e616d3f56ab8c9eb9658>>
* @generated SignedSource<<1bb0fee5a17f70b91f33850d97479cc1>>
*/

/**
Expand Down Expand Up @@ -100,6 +100,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var skipNativePropsForViewManagerWithDelegateAndroidCache: Boolean? = null
private var skipUnchangedChildrenInDifferentiatorCache: Boolean? = null
private var syncAndroidClipBoundsWithOverflowCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
Expand Down Expand Up @@ -838,6 +839,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun skipUnchangedChildrenInDifferentiator(): Boolean {
var cached = skipUnchangedChildrenInDifferentiatorCache
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<<6d86d4adbc261c9271b5bed72bd12dcf>>
* @generated SignedSource<<8686d1f71576023f0cd22aca37b2e8ba>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun syncAndroidClipBoundsWithOverflow(): 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<<a1368426dd823245c54b4312ae7b14e6>>
* @generated SignedSource<<09945e5bc899957424ce20441022830c>>
*/

/**
Expand Down Expand Up @@ -183,6 +183,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false

override fun skipNativePropsForViewManagerWithDelegateAndroid(): Boolean = false

override fun skipUnchangedChildrenInDifferentiator(): Boolean = false

override fun syncAndroidClipBoundsWithOverflow(): 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<<c305274be2fc6720b6c0eb75e78bd6b0>>
* @generated SignedSource<<12dd3ead4fa496af154f770cabc252f1>>
*/

/**
Expand Down Expand Up @@ -104,6 +104,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var skipNativePropsForViewManagerWithDelegateAndroidCache: Boolean? = null
private var skipUnchangedChildrenInDifferentiatorCache: Boolean? = null
private var syncAndroidClipBoundsWithOverflowCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
Expand Down Expand Up @@ -922,6 +923,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun skipUnchangedChildrenInDifferentiator(): Boolean {
var cached = skipUnchangedChildrenInDifferentiatorCache
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<<da45e41e9a58711ee3b68a38965938fb>>
* @generated SignedSource<<8227961bd327cc2851437304b21dee6a>>
*/

/**
Expand Down Expand Up @@ -183,6 +183,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean

@DoNotStrip public fun skipNativePropsForViewManagerWithDelegateAndroid(): Boolean

@DoNotStrip public fun skipUnchangedChildrenInDifferentiator(): Boolean

@DoNotStrip public fun syncAndroidClipBoundsWithOverflow(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode<?>>

private static final String TAG = "ViewManager";

private @Nullable ViewManagerDelegate<T> mDelegate = null;
private volatile @Nullable ViewManagerDelegate<T> mDelegate = null;

/**
* For View recycling: we store a Stack of unused, dead Views. This is null by default, and when
Expand Down Expand Up @@ -113,6 +113,11 @@ public void updateProperties(@NonNull T viewToUpdate, ReactStylesDiffMap props)
* <p>By default, this methods returns a generic {@link ViewManagerDelegate} which uses {@link
* ViewManagerSetter} to apply property updates.
*
* <p>When {@code skipNativePropsForViewManagerWithDelegateAndroid} is enabled, lazy delegate
* initialisation may also occur during native prop metadata generation on the JavaScript thread.
* The returned delegate is cached and shared with subsequent prop updates and commands. Overrides
* must be safe to initialise on either thread.
*
* @return an instance of {@link ViewManagerDelegate} if the props of the view managed by this
* view manager should be set via this delegate
*/
Expand All @@ -131,8 +136,13 @@ protected ViewManagerDelegate<T> getDelegate() {
private ViewManagerDelegate<T> getOrCreateViewManagerDelegate() {
ViewManagerDelegate<T> delegate = mDelegate;
if (delegate == null) {
delegate = getDelegate();
mDelegate = delegate;
synchronized (this) {
delegate = mDelegate;
if (delegate == null) {
delegate = getDelegate();
mDelegate = delegate;
}
}
}
return delegate;
}
Expand Down Expand Up @@ -402,10 +412,21 @@ public void receiveCommand(@NonNull T view, String commandId, ReadableArray args
}

/**
* Returns a {@link Map<String, String>} representing the native props of the view manager. The
* Map contains the names (key) and types (value) of the ViewManager's props.
* Returns a mutable {@link Map<String, String>} representing the native props of the view
* manager. The Map contains the names (key) and types (value) of the ViewManager's props.
*
* <p>When {@code skipNativePropsForViewManagerWithDelegateAndroid} is enabled, managers with a
* non-generic delegate return an empty map. Enable this only when those components use static
* view configs rather than deriving their valid attributes from native prop metadata.
*/
public Map<String, String> getNativeProps() {
if (ReactNativeFeatureFlags.skipNativePropsForViewManagerWithDelegateAndroid()) {
ViewManagerDelegate<T> delegate = getOrCreateViewManagerDelegate();
if (delegate != null
&& !(delegate instanceof ViewManagerPropertyUpdater.GenericViewManagerDelegate)) {
return new HashMap<>();
}
}
if (ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE
&& ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) {
// TODO: review if we need to check fabricInterop here
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<<944781e7a547e601f0637869a3a3ec5e>>
* @generated SignedSource<<223e38a173e3762fa0034ed47f96a84d>>
*/

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

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

bool skipUnchangedChildrenInDifferentiator() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("skipUnchangedChildrenInDifferentiator");
Expand Down Expand Up @@ -1025,6 +1031,11 @@ bool JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPaus
return ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause();
}

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

bool JReactNativeFeatureFlagsCxxInterop::skipUnchangedChildrenInDifferentiator(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::skipUnchangedChildrenInDifferentiator();
Expand Down Expand Up @@ -1381,6 +1392,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"skipActivityIdentityAssertionOnHostPause",
JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPause),
makeNativeMethod(
"skipNativePropsForViewManagerWithDelegateAndroid",
JReactNativeFeatureFlagsCxxInterop::skipNativePropsForViewManagerWithDelegateAndroid),
makeNativeMethod(
"skipUnchangedChildrenInDifferentiator",
JReactNativeFeatureFlagsCxxInterop::skipUnchangedChildrenInDifferentiator),
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<<ad9275a6afb74520bec7d446faafd1bc>>
* @generated SignedSource<<fbe2d936391c1d25f9741753c952dfdb>>
*/

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

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

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

Expand Down
Loading
Loading