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
19 changes: 6 additions & 13 deletions packages/react-native/React/Base/RCTUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#import <mach/mach_time.h>
#import <objc/message.h>
#import <objc/runtime.h>
#import <react/featureflags/ReactNativeFeatureFlags.h>
#import <zlib.h>

#import <UIKit/UIKit.h>
Expand Down Expand Up @@ -312,15 +311,12 @@ void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block)
}

#if !TARGET_OS_TV
if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS()) {
unsafeExecuteOnMainThreadSync(block);
return;
}
#endif

unsafeExecuteOnMainThreadSync(block);
#else
dispatch_sync(dispatch_get_main_queue(), ^{
block();
});
#endif
}

static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, dispatch_block_t block)
Expand All @@ -342,13 +338,10 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp
}

#if !TARGET_OS_TV
if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS()) {
unsafeExecuteOnMainThreadSync(block);
return;
}
#endif

unsafeExecuteOnMainThreadSync(block);
#else
dispatch_sync(dispatch_get_main_queue(), executeOnce);
#endif
}

CGFloat RCTScreenScale(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@
using namespace facebook;
using namespace facebook::react;

#if RCT_DEBUG
static void debugLog(NSString *msg, ...)
{
auto debugEnabled = ReactNativeFeatureFlags::enableVirtualViewDebugFeatures();
if (!debugEnabled) {
return;
}

va_list args;
va_start(args, msg);
NSString *msgString = [[NSString alloc] initWithFormat:msg arguments:args];
RCTLogInfo(@"%@", msgString);
va_end(args); // Don't forget to call va_end to clean up
}

#endif

/**
* Checks whether one CGRect overlaps with another CGRect.
*
Expand Down Expand Up @@ -86,19 +69,12 @@ - (instancetype)initWithScrollView:(RCTScrollViewComponentView *)scrollView
_scrollViewComponentView = scrollView;
_prerenderRatio = ReactNativeFeatureFlags::virtualViewPrerenderRatio();
[_scrollViewComponentView addScrollListener:self];

#if RCT_DEBUG
debugLog(@"initWithScrollView");
#endif
}
return self;
}

- (void)dealloc
{
#if RCT_DEBUG
debugLog(@"dealloc");
#endif
if (_scrollViewComponentView != nil) {
[_scrollViewComponentView removeScrollListener:self];
_scrollViewComponentView = nil;
Expand All @@ -112,14 +88,6 @@ - (void)onChange:(id<RCTVirtualViewProtocol>)virtualView
{
if (![_virtualViews containsObject:virtualView]) {
[_virtualViews addObject:virtualView];
#if RCT_DEBUG
debugLog(@"Add virtualViewID=%@", virtualView.virtualViewID);
#endif

} else {
#if RCT_DEBUG
debugLog(@"Update virtualViewID=%@", virtualView.virtualViewID);
#endif
}
[self _updateModes:virtualView];
}
Expand All @@ -131,10 +99,6 @@ - (void)remove:(id<RCTVirtualViewProtocol>)virtualView
}

[_virtualViews removeObject:virtualView];

#if RCT_DEBUG
debugLog(@"Remove virtualViewID=%@", virtualView.virtualViewID);
#endif
}

#pragma mark - Private Helpers
Expand Down Expand Up @@ -169,14 +133,6 @@ - (void)_updateModes:(id<RCTVirtualViewProtocol>)virtualView
thresholdRect = _prerenderRect;
}

#if RCT_DEBUG
debugLog(
@"UpdateModes virtualView=%@ mode=%ld rect=%@ thresholdRect=%@",
vv.virtualViewID,
(long)mode,
NSStringFromCGRect(rect),
NSStringFromCGRect(thresholdRect));
#endif
[vv onModeChange:mode targetRect:rect thresholdRect:thresholdRect];
}
}
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<<8b35aa70eea734a8bfcbb7bd651ba8e2>>
* @generated SignedSource<<1daf42834a0bcc06caae571c6541fecd>>
*/

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

/**
* This infra allows native modules to initialize on the main thread, during React Native init.
*/
@JvmStatic
public fun enableEagerMainQueueModulesOnIOS(): Boolean = accessor.enableEagerMainQueueModulesOnIOS()

/**
* Feature flag to configure eager attachment of the root view/initialisation of the JS code.
*/
Expand Down Expand Up @@ -240,12 +234,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS()

/**
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
*/
@JvmStatic
public fun enableMainQueueCoordinatorOnIOS(): Boolean = accessor.enableMainQueueCoordinatorOnIOS()

/**
* Enable NSNull conversion when handling module arguments on iOS
*/
Expand Down Expand Up @@ -342,12 +330,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableVirtualViewContainerStateExperimental(): Boolean = accessor.enableVirtualViewContainerStateExperimental()

/**
* Enables VirtualView debug features such as logging and overlays.
*/
@JvmStatic
public fun enableVirtualViewDebugFeatures(): Boolean = accessor.enableVirtualViewDebugFeatures()

/**
* Fix incorrect parentTag passed as parentTagForUpdate in the unflatten-unflatten branch of calculateShadowViewMutationsFlattener, which causes UPDATE mutations to reference a parent being created in the same batch.
*/
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<<494ed85c58f80b4feb6fb9b83fe7a27e>>
* @generated SignedSource<<6b189752d6dedc9d814179ddd6d605f4>>
*/

/**
Expand Down Expand Up @@ -39,7 +39,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null
private var enableDifferentiatorMutationVectorPreallocationCache: Boolean? = null
private var enableDoubleMeasurementFixAndroidCache: Boolean? = null
private var enableEagerMainQueueModulesOnIOSCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableExclusivePropsUpdateAndroidCache: Boolean? = null
private var enableFabricCommitBranchingCache: Boolean? = null
Expand All @@ -55,7 +54,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableKeyEventsCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
private var enableMutationObserverByDefaultCache: Boolean? = null
private var enableNativeCSSParsingCache: Boolean? = null
Expand All @@ -72,7 +70,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableViewRecyclingForTextCache: Boolean? = null
private var enableViewRecyclingForViewCache: Boolean? = null
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
Expand Down Expand Up @@ -282,15 +279,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun enableEagerRootViewAttachment(): Boolean {
var cached = enableEagerRootViewAttachmentCache
if (cached == null) {
Expand Down Expand Up @@ -426,15 +414,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
var cached = enableModuleArgumentNSNullConversionIOSCache
if (cached == null) {
Expand Down Expand Up @@ -579,15 +558,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun fixDifferentiatorParentTagForUnflattenCase(): Boolean {
var cached = fixDifferentiatorParentTagForUnflattenCaseCache
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<<16ca9a4b47da90ea71300eb37287e28b>>
* @generated SignedSource<<34dc75d00f7dad4922361c5661a5c527>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun enableExclusivePropsUpdateAndroid(): Boolean
Expand Down Expand Up @@ -98,8 +96,6 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

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

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

@DoNotStrip @JvmStatic public external fun enableMutationObserverByDefault(): Boolean
Expand Down Expand Up @@ -132,8 +128,6 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

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

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

@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): 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<<10e6516b3c9cf53ae2e48c8b8cd51033>>
* @generated SignedSource<<e57e4a1d8593cc3574430e4ab4845894>>
*/

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

override fun enableDoubleMeasurementFixAndroid(): Boolean = false

override fun enableEagerMainQueueModulesOnIOS(): Boolean = false

override fun enableEagerRootViewAttachment(): Boolean = false

override fun enableExclusivePropsUpdateAndroid(): Boolean = false
Expand Down Expand Up @@ -93,8 +91,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableLayoutAnimationsOnIOS(): Boolean = true

override fun enableMainQueueCoordinatorOnIOS(): Boolean = false

override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false

override fun enableMutationObserverByDefault(): Boolean = false
Expand Down Expand Up @@ -127,8 +123,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableVirtualViewContainerStateExperimental(): Boolean = false

override fun enableVirtualViewDebugFeatures(): Boolean = false

override fun fixDifferentiatorParentTagForUnflattenCase(): Boolean = false

override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
Expand Down
Loading
Loading