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,21 +16,21 @@
using namespace facebook;
using namespace facebook::react;

#if RCT_DEBUG
#define ENABLE_DEBUG_LOGGING 0 && RCT_DEBUG

#if ENABLE_DEBUG_LOGGING
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
}

#define DEBUG_LOG(...) debugLog(__VA_ARGS__)
#else
#define DEBUG_LOG(...) ((void)0)
#endif

/**
Expand Down Expand Up @@ -87,18 +87,14 @@ - (instancetype)initWithScrollView:(RCTScrollViewComponentView *)scrollView
_prerenderRatio = ReactNativeFeatureFlags::virtualViewPrerenderRatio();
[_scrollViewComponentView addScrollListener:self];

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

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

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

[_virtualViews removeObject:virtualView];

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

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

#if RCT_DEBUG
debugLog(
DEBUG_LOG(
@"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<<3e8cc4e23730f3171824faaf2053bbd9>>
* @generated SignedSource<<fa3264c2fe6c35ed8e6c89cc86c60274>>
*/

/**
Expand Down Expand Up @@ -234,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 @@ -336,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<<1b877147588a851daaee1a2b4494312a>>
* @generated SignedSource<<63416dd5bd11d85a09a9360075a780d8>>
*/

/**
Expand Down Expand Up @@ -54,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 @@ -71,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 @@ -415,15 +413,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 @@ -568,15 +557,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<<a09de0b0d4b342796ff3fcc1b52fc53a>>
* @generated SignedSource<<fe1e2957834c2f0a2856c130310e33ac>>
*/

/**
Expand Down Expand Up @@ -96,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 @@ -130,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<<b08dd880f47d31353cd29e4bcc63090d>>
* @generated SignedSource<<4da1a512f0a1a0e603ec5b8f432742d4>>
*/

/**
Expand Down Expand Up @@ -91,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 @@ -125,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
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<<c3cb6a890e22fe2ac279c3a9aa65b096>>
* @generated SignedSource<<d9e75ef1609d0c41efd061f477277c32>>
*/

/**
Expand Down Expand Up @@ -58,7 +58,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
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 @@ -75,7 +74,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
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 @@ -453,16 +451,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

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

override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
var cached = enableModuleArgumentNSNullConversionIOSCache
if (cached == null) {
Expand Down Expand Up @@ -623,16 +611,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun enableVirtualViewDebugFeatures(): Boolean {
var cached = enableVirtualViewDebugFeaturesCache
if (cached == null) {
cached = currentProvider.enableVirtualViewDebugFeatures()
accessedFeatureFlags.add("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<<1348346948cf4212dd312c48b5bfe917>>
* @generated SignedSource<<6f91d50e4ddb6751b1132f01fcfe147a>>
*/

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

@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean

@DoNotStrip public fun enableMainQueueCoordinatorOnIOS(): Boolean

@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean

@DoNotStrip public fun enableMutationObserverByDefault(): Boolean
Expand Down Expand Up @@ -125,8 +123,6 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableVirtualViewContainerStateExperimental(): Boolean

@DoNotStrip public fun enableVirtualViewDebugFeatures(): Boolean

@DoNotStrip public fun fixDifferentiatorParentTagForUnflattenCase(): Boolean

@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
Expand Down
Loading
Loading