react-native 0.74.0 → 0.74.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/AppDelegate/RCTAppDelegate+Protected.h +16 -0
- package/Libraries/AppDelegate/RCTAppDelegate.mm +32 -1
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -0
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/React/Base/RCTVersion.m +2 -2
- package/React/Fabric/RCTScheduler.h +2 -0
- package/React/Fabric/RCTScheduler.mm +6 -0
- package/React/Fabric/RCTSurfacePresenter.mm +5 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +15 -0
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +19 -7
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +31 -11
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +7 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +7 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +34 -12
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +7 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
- package/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +38 -3
- package/ReactAndroid/src/main/jni/react/fabric/Binding.h +8 -0
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +43 -15
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +10 -4
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +13 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +16 -6
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +62 -26
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +8 -4
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +13 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +4 -2
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +16 -6
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +7 -3
- package/ReactCommon/react/renderer/mounting/MountingTransaction.cpp +13 -0
- package/ReactCommon/react/renderer/mounting/MountingTransaction.h +9 -0
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +7 -2
- package/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +11 -0
- package/package.json +8 -8
- package/sdks/.hermesversion +1 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/src/private/featureflags/NativeReactNativeFeatureFlags.js +4 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -6
- package/template/package.json +5 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#if defined(__cplusplus)
|
|
9
|
+
|
|
10
|
+
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
11
|
+
#import "RCTAppDelegate.h"
|
|
12
|
+
|
|
13
|
+
@interface RCTAppDelegate () <RCTTurboModuleManagerDelegate>
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
#endif
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
#import <React/RCTRootView.h>
|
|
12
12
|
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
|
13
13
|
#import <React/RCTUtils.h>
|
|
14
|
-
#import <
|
|
14
|
+
#import <objc/runtime.h>
|
|
15
|
+
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
|
16
|
+
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
|
17
|
+
#import <react/renderer/graphics/ColorComponents.h>
|
|
18
|
+
#import "RCTAppDelegate+Protected.h"
|
|
15
19
|
#import "RCTAppSetupUtils.h"
|
|
16
20
|
|
|
17
21
|
#if RN_DISABLE_OSS_PLUGIN_HEADER
|
|
@@ -46,6 +50,8 @@
|
|
|
46
50
|
|
|
47
51
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
48
52
|
{
|
|
53
|
+
[self _setUpFeatureFlags];
|
|
54
|
+
|
|
49
55
|
RCTSetNewArchEnabled([self newArchEnabled]);
|
|
50
56
|
RCTAppSetupPrepareApp(application, self.turboModuleEnabled);
|
|
51
57
|
|
|
@@ -258,4 +264,29 @@
|
|
|
258
264
|
return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
|
|
259
265
|
}
|
|
260
266
|
|
|
267
|
+
#pragma mark - Feature Flags
|
|
268
|
+
|
|
269
|
+
class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
|
|
270
|
+
public:
|
|
271
|
+
bool useModernRuntimeScheduler() override
|
|
272
|
+
{
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
bool enableMicrotasks() override
|
|
276
|
+
{
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
bool batchRenderingUpdatesInEventLoop() override
|
|
280
|
+
{
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
- (void)_setUpFeatureFlags
|
|
286
|
+
{
|
|
287
|
+
if ([self bridgelessEnabled]) {
|
|
288
|
+
facebook::react::ReactNativeFeatureFlags::override(std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
261
292
|
@end
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -23,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
|
|
23
23
|
__rnVersion = @{
|
|
24
24
|
RCTVersionMajor: @(0),
|
|
25
25
|
RCTVersionMinor: @(74),
|
|
26
|
-
RCTVersionPatch: @(
|
|
27
|
-
RCTVersionPrerelease:
|
|
26
|
+
RCTVersionPatch: @(1),
|
|
27
|
+
RCTVersionPrerelease: @"rc.0",
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
return __rnVersion;
|
|
@@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
30
30
|
|
|
31
31
|
- (void)schedulerDidFinishTransaction:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
|
|
32
32
|
|
|
33
|
+
- (void)schedulerShouldRenderTransactions:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
|
|
34
|
+
|
|
33
35
|
- (void)schedulerDidDispatchCommand:(const facebook::react::ShadowView &)shadowView
|
|
34
36
|
commandName:(const std::string &)commandName
|
|
35
37
|
args:(const folly::dynamic &)args;
|
|
@@ -30,6 +30,12 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
|
|
|
30
30
|
[scheduler.delegate schedulerDidFinishTransaction:mountingCoordinator];
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
void schedulerShouldRenderTransactions(const MountingCoordinator::Shared &mountingCoordinator) override
|
|
34
|
+
{
|
|
35
|
+
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
|
|
36
|
+
[scheduler.delegate schedulerShouldRenderTransactions:mountingCoordinator];
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, const ShadowNode &shadowNode) override
|
|
34
40
|
{
|
|
35
41
|
// Does nothing.
|
|
@@ -354,6 +354,11 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
354
354
|
#pragma mark - RCTSchedulerDelegate
|
|
355
355
|
|
|
356
356
|
- (void)schedulerDidFinishTransaction:(MountingCoordinator::Shared)mountingCoordinator
|
|
357
|
+
{
|
|
358
|
+
// no-op, we will flush the transaction from schedulerShouldRenderTransactions
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
- (void)schedulerShouldRenderTransactions:(MountingCoordinator::Shared)mountingCoordinator
|
|
357
362
|
{
|
|
358
363
|
[_mountingManager scheduleTransaction:mountingCoordinator];
|
|
359
364
|
}
|
package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt
CHANGED
|
@@ -11,6 +11,8 @@ package com.facebook.react.defaults
|
|
|
11
11
|
|
|
12
12
|
import com.facebook.react.common.annotations.VisibleForTesting
|
|
13
13
|
import com.facebook.react.config.ReactFeatureFlags
|
|
14
|
+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
|
15
|
+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsDefaults
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* A utility class that serves as an entry point for users setup the New Architecture.
|
|
@@ -45,6 +47,19 @@ public object DefaultNewArchitectureEntryPoint {
|
|
|
45
47
|
ReactFeatureFlags.unstable_useTurboModuleInterop = bridgelessEnabled
|
|
46
48
|
ReactFeatureFlags.enableFabricPendingEventQueue = fabricEnabled
|
|
47
49
|
|
|
50
|
+
if (bridgelessEnabled) {
|
|
51
|
+
ReactNativeFeatureFlags.override(
|
|
52
|
+
object : ReactNativeFeatureFlagsDefaults() {
|
|
53
|
+
override fun useModernRuntimeScheduler(): Boolean = true
|
|
54
|
+
|
|
55
|
+
override fun enableMicrotasks(): Boolean = true
|
|
56
|
+
|
|
57
|
+
override fun batchRenderingUpdatesInEventLoop(): Boolean = true
|
|
58
|
+
|
|
59
|
+
override fun androidEnablePendingFabricTransactions(): Boolean = true
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
privateFabricEnabled = fabricEnabled
|
|
49
64
|
privateTurboModulesEnabled = turboModulesEnabled
|
|
50
65
|
privateConcurrentReactEnabled = fabricEnabled
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<b86e9fd5499308ce65b389342eb436a2>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -34,6 +34,24 @@ public object ReactNativeFeatureFlags {
|
|
|
34
34
|
@JvmStatic
|
|
35
35
|
public fun commonTestFlag(): Boolean = accessor.commonTestFlag()
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* To be used with batchRenderingUpdatesInEventLoop. When enbled, the Android mounting layer will concatenate pending transactions to ensure they're applied atomatically
|
|
39
|
+
*/
|
|
40
|
+
@JvmStatic
|
|
41
|
+
public fun androidEnablePendingFabricTransactions(): Boolean = accessor.androidEnablePendingFabricTransactions()
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
|
|
45
|
+
*/
|
|
46
|
+
@JvmStatic
|
|
47
|
+
public fun batchRenderingUpdatesInEventLoop(): Boolean = accessor.batchRenderingUpdatesInEventLoop()
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
|
|
51
|
+
*/
|
|
52
|
+
@JvmStatic
|
|
53
|
+
public fun destroyFabricSurfacesInReactInstanceManager(): Boolean = accessor.destroyFabricSurfacesInReactInstanceManager()
|
|
54
|
+
|
|
37
55
|
/**
|
|
38
56
|
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
|
|
39
57
|
*/
|
|
@@ -52,12 +70,6 @@ public object ReactNativeFeatureFlags {
|
|
|
52
70
|
@JvmStatic
|
|
53
71
|
public fun enableMicrotasks(): Boolean = accessor.enableMicrotasks()
|
|
54
72
|
|
|
55
|
-
/**
|
|
56
|
-
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
|
|
57
|
-
*/
|
|
58
|
-
@JvmStatic
|
|
59
|
-
public fun batchRenderingUpdatesInEventLoop(): Boolean = accessor.batchRenderingUpdatesInEventLoop()
|
|
60
|
-
|
|
61
73
|
/**
|
|
62
74
|
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
|
|
63
75
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<c0a85b92bca9bb03f28af67224239c09>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -21,10 +21,12 @@ package com.facebook.react.internal.featureflags
|
|
|
21
21
|
|
|
22
22
|
public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
|
|
23
23
|
private var commonTestFlagCache: Boolean? = null
|
|
24
|
+
private var androidEnablePendingFabricTransactionsCache: Boolean? = null
|
|
25
|
+
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
|
|
26
|
+
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
|
|
24
27
|
private var enableBackgroundExecutorCache: Boolean? = null
|
|
25
28
|
private var useModernRuntimeSchedulerCache: Boolean? = null
|
|
26
29
|
private var enableMicrotasksCache: Boolean? = null
|
|
27
|
-
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
|
|
28
30
|
private var enableSpannableBuildingUnificationCache: Boolean? = null
|
|
29
31
|
private var enableCustomDrawOrderFabricCache: Boolean? = null
|
|
30
32
|
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
|
|
@@ -40,6 +42,33 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
|
|
40
42
|
return cached
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
override fun androidEnablePendingFabricTransactions(): Boolean {
|
|
46
|
+
var cached = androidEnablePendingFabricTransactionsCache
|
|
47
|
+
if (cached == null) {
|
|
48
|
+
cached = ReactNativeFeatureFlagsCxxInterop.androidEnablePendingFabricTransactions()
|
|
49
|
+
androidEnablePendingFabricTransactionsCache = cached
|
|
50
|
+
}
|
|
51
|
+
return cached
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override fun batchRenderingUpdatesInEventLoop(): Boolean {
|
|
55
|
+
var cached = batchRenderingUpdatesInEventLoopCache
|
|
56
|
+
if (cached == null) {
|
|
57
|
+
cached = ReactNativeFeatureFlagsCxxInterop.batchRenderingUpdatesInEventLoop()
|
|
58
|
+
batchRenderingUpdatesInEventLoopCache = cached
|
|
59
|
+
}
|
|
60
|
+
return cached
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun destroyFabricSurfacesInReactInstanceManager(): Boolean {
|
|
64
|
+
var cached = destroyFabricSurfacesInReactInstanceManagerCache
|
|
65
|
+
if (cached == null) {
|
|
66
|
+
cached = ReactNativeFeatureFlagsCxxInterop.destroyFabricSurfacesInReactInstanceManager()
|
|
67
|
+
destroyFabricSurfacesInReactInstanceManagerCache = cached
|
|
68
|
+
}
|
|
69
|
+
return cached
|
|
70
|
+
}
|
|
71
|
+
|
|
43
72
|
override fun enableBackgroundExecutor(): Boolean {
|
|
44
73
|
var cached = enableBackgroundExecutorCache
|
|
45
74
|
if (cached == null) {
|
|
@@ -67,15 +96,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
|
|
67
96
|
return cached
|
|
68
97
|
}
|
|
69
98
|
|
|
70
|
-
override fun batchRenderingUpdatesInEventLoop(): Boolean {
|
|
71
|
-
var cached = batchRenderingUpdatesInEventLoopCache
|
|
72
|
-
if (cached == null) {
|
|
73
|
-
cached = ReactNativeFeatureFlagsCxxInterop.batchRenderingUpdatesInEventLoop()
|
|
74
|
-
batchRenderingUpdatesInEventLoopCache = cached
|
|
75
|
-
}
|
|
76
|
-
return cached
|
|
77
|
-
}
|
|
78
|
-
|
|
79
99
|
override fun enableSpannableBuildingUnification(): Boolean {
|
|
80
100
|
var cached = enableSpannableBuildingUnificationCache
|
|
81
101
|
if (cached == null) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<5fece1bcbbd750b82b8e4b125c57101e>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -30,14 +30,18 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
|
|
30
30
|
|
|
31
31
|
@DoNotStrip @JvmStatic public external fun commonTestFlag(): Boolean
|
|
32
32
|
|
|
33
|
+
@DoNotStrip @JvmStatic public external fun androidEnablePendingFabricTransactions(): Boolean
|
|
34
|
+
|
|
35
|
+
@DoNotStrip @JvmStatic public external fun batchRenderingUpdatesInEventLoop(): Boolean
|
|
36
|
+
|
|
37
|
+
@DoNotStrip @JvmStatic public external fun destroyFabricSurfacesInReactInstanceManager(): Boolean
|
|
38
|
+
|
|
33
39
|
@DoNotStrip @JvmStatic public external fun enableBackgroundExecutor(): Boolean
|
|
34
40
|
|
|
35
41
|
@DoNotStrip @JvmStatic public external fun useModernRuntimeScheduler(): Boolean
|
|
36
42
|
|
|
37
43
|
@DoNotStrip @JvmStatic public external fun enableMicrotasks(): Boolean
|
|
38
44
|
|
|
39
|
-
@DoNotStrip @JvmStatic public external fun batchRenderingUpdatesInEventLoop(): Boolean
|
|
40
|
-
|
|
41
45
|
@DoNotStrip @JvmStatic public external fun enableSpannableBuildingUnification(): Boolean
|
|
42
46
|
|
|
43
47
|
@DoNotStrip @JvmStatic public external fun enableCustomDrawOrderFabric(): Boolean
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<4462edcf10a85654be7c71a7438a2288>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -25,14 +25,18 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
|
|
25
25
|
|
|
26
26
|
override fun commonTestFlag(): Boolean = false
|
|
27
27
|
|
|
28
|
+
override fun androidEnablePendingFabricTransactions(): Boolean = false
|
|
29
|
+
|
|
30
|
+
override fun batchRenderingUpdatesInEventLoop(): Boolean = false
|
|
31
|
+
|
|
32
|
+
override fun destroyFabricSurfacesInReactInstanceManager(): Boolean = false
|
|
33
|
+
|
|
28
34
|
override fun enableBackgroundExecutor(): Boolean = false
|
|
29
35
|
|
|
30
36
|
override fun useModernRuntimeScheduler(): Boolean = false
|
|
31
37
|
|
|
32
38
|
override fun enableMicrotasks(): Boolean = false
|
|
33
39
|
|
|
34
|
-
override fun batchRenderingUpdatesInEventLoop(): Boolean = false
|
|
35
|
-
|
|
36
40
|
override fun enableSpannableBuildingUnification(): Boolean = false
|
|
37
41
|
|
|
38
42
|
override fun enableCustomDrawOrderFabric(): Boolean = false
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<e02f6a9473a98f27ee44ff303db9e0b7>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -25,10 +25,12 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
|
|
25
25
|
private val accessedFeatureFlags = mutableSetOf<String>()
|
|
26
26
|
|
|
27
27
|
private var commonTestFlagCache: Boolean? = null
|
|
28
|
+
private var androidEnablePendingFabricTransactionsCache: Boolean? = null
|
|
29
|
+
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
|
|
30
|
+
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
|
|
28
31
|
private var enableBackgroundExecutorCache: Boolean? = null
|
|
29
32
|
private var useModernRuntimeSchedulerCache: Boolean? = null
|
|
30
33
|
private var enableMicrotasksCache: Boolean? = null
|
|
31
|
-
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
|
|
32
34
|
private var enableSpannableBuildingUnificationCache: Boolean? = null
|
|
33
35
|
private var enableCustomDrawOrderFabricCache: Boolean? = null
|
|
34
36
|
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
|
|
@@ -45,6 +47,36 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
|
|
45
47
|
return cached
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
override fun androidEnablePendingFabricTransactions(): Boolean {
|
|
51
|
+
var cached = androidEnablePendingFabricTransactionsCache
|
|
52
|
+
if (cached == null) {
|
|
53
|
+
cached = currentProvider.androidEnablePendingFabricTransactions()
|
|
54
|
+
accessedFeatureFlags.add("androidEnablePendingFabricTransactions")
|
|
55
|
+
androidEnablePendingFabricTransactionsCache = cached
|
|
56
|
+
}
|
|
57
|
+
return cached
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
override fun batchRenderingUpdatesInEventLoop(): Boolean {
|
|
61
|
+
var cached = batchRenderingUpdatesInEventLoopCache
|
|
62
|
+
if (cached == null) {
|
|
63
|
+
cached = currentProvider.batchRenderingUpdatesInEventLoop()
|
|
64
|
+
accessedFeatureFlags.add("batchRenderingUpdatesInEventLoop")
|
|
65
|
+
batchRenderingUpdatesInEventLoopCache = cached
|
|
66
|
+
}
|
|
67
|
+
return cached
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override fun destroyFabricSurfacesInReactInstanceManager(): Boolean {
|
|
71
|
+
var cached = destroyFabricSurfacesInReactInstanceManagerCache
|
|
72
|
+
if (cached == null) {
|
|
73
|
+
cached = currentProvider.destroyFabricSurfacesInReactInstanceManager()
|
|
74
|
+
accessedFeatureFlags.add("destroyFabricSurfacesInReactInstanceManager")
|
|
75
|
+
destroyFabricSurfacesInReactInstanceManagerCache = cached
|
|
76
|
+
}
|
|
77
|
+
return cached
|
|
78
|
+
}
|
|
79
|
+
|
|
48
80
|
override fun enableBackgroundExecutor(): Boolean {
|
|
49
81
|
var cached = enableBackgroundExecutorCache
|
|
50
82
|
if (cached == null) {
|
|
@@ -75,16 +107,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
|
|
75
107
|
return cached
|
|
76
108
|
}
|
|
77
109
|
|
|
78
|
-
override fun batchRenderingUpdatesInEventLoop(): Boolean {
|
|
79
|
-
var cached = batchRenderingUpdatesInEventLoopCache
|
|
80
|
-
if (cached == null) {
|
|
81
|
-
cached = currentProvider.batchRenderingUpdatesInEventLoop()
|
|
82
|
-
accessedFeatureFlags.add("batchRenderingUpdatesInEventLoop")
|
|
83
|
-
batchRenderingUpdatesInEventLoopCache = cached
|
|
84
|
-
}
|
|
85
|
-
return cached
|
|
86
|
-
}
|
|
87
|
-
|
|
88
110
|
override fun enableSpannableBuildingUnification(): Boolean {
|
|
89
111
|
var cached = enableSpannableBuildingUnificationCache
|
|
90
112
|
if (cached == null) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<9190129a45a19b25dd23126f05b03356>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -25,14 +25,18 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
|
25
25
|
public interface ReactNativeFeatureFlagsProvider {
|
|
26
26
|
@DoNotStrip public fun commonTestFlag(): Boolean
|
|
27
27
|
|
|
28
|
+
@DoNotStrip public fun androidEnablePendingFabricTransactions(): Boolean
|
|
29
|
+
|
|
30
|
+
@DoNotStrip public fun batchRenderingUpdatesInEventLoop(): Boolean
|
|
31
|
+
|
|
32
|
+
@DoNotStrip public fun destroyFabricSurfacesInReactInstanceManager(): Boolean
|
|
33
|
+
|
|
28
34
|
@DoNotStrip public fun enableBackgroundExecutor(): Boolean
|
|
29
35
|
|
|
30
36
|
@DoNotStrip public fun useModernRuntimeScheduler(): Boolean
|
|
31
37
|
|
|
32
38
|
@DoNotStrip public fun enableMicrotasks(): Boolean
|
|
33
39
|
|
|
34
|
-
@DoNotStrip public fun batchRenderingUpdatesInEventLoop(): Boolean
|
|
35
|
-
|
|
36
40
|
@DoNotStrip public fun enableSpannableBuildingUnification(): Boolean
|
|
37
41
|
|
|
38
42
|
@DoNotStrip public fun enableCustomDrawOrderFabric(): Boolean
|
|
@@ -474,8 +474,7 @@ std::shared_ptr<FabricMountingManager> Binding::getMountingManager(
|
|
|
474
474
|
|
|
475
475
|
void Binding::schedulerDidFinishTransaction(
|
|
476
476
|
const MountingCoordinator::Shared& mountingCoordinator) {
|
|
477
|
-
|
|
478
|
-
if (!mountingManager) {
|
|
477
|
+
if (!ReactNativeFeatureFlags::androidEnablePendingFabricTransactions()) {
|
|
479
478
|
return;
|
|
480
479
|
}
|
|
481
480
|
|
|
@@ -483,7 +482,43 @@ void Binding::schedulerDidFinishTransaction(
|
|
|
483
482
|
if (!mountingTransaction.has_value()) {
|
|
484
483
|
return;
|
|
485
484
|
}
|
|
486
|
-
|
|
485
|
+
|
|
486
|
+
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
|
|
487
|
+
auto pendingTransaction = std::find_if(
|
|
488
|
+
pendingTransactions_.begin(),
|
|
489
|
+
pendingTransactions_.end(),
|
|
490
|
+
[&](const auto& transaction) {
|
|
491
|
+
return transaction.getSurfaceId() ==
|
|
492
|
+
mountingTransaction->getSurfaceId();
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
if (pendingTransaction != pendingTransactions_.end()) {
|
|
496
|
+
pendingTransaction->mergeWith(std::move(*mountingTransaction));
|
|
497
|
+
} else {
|
|
498
|
+
pendingTransactions_.push_back(std::move(*mountingTransaction));
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
void Binding::schedulerShouldRenderTransactions(
|
|
503
|
+
const MountingCoordinator::Shared& mountingCoordinator) {
|
|
504
|
+
auto mountingManager =
|
|
505
|
+
getMountingManager("schedulerShouldRenderTransactions");
|
|
506
|
+
if (!mountingManager) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (ReactNativeFeatureFlags::androidEnablePendingFabricTransactions()) {
|
|
511
|
+
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
|
|
512
|
+
for (auto& transaction : pendingTransactions_) {
|
|
513
|
+
mountingManager->executeMount(transaction);
|
|
514
|
+
}
|
|
515
|
+
pendingTransactions_.clear();
|
|
516
|
+
} else {
|
|
517
|
+
auto mountingTransaction = mountingCoordinator->pullTransaction();
|
|
518
|
+
if (mountingTransaction.has_value()) {
|
|
519
|
+
mountingManager->executeMount(*mountingTransaction);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
487
522
|
}
|
|
488
523
|
|
|
489
524
|
void Binding::schedulerDidRequestPreliminaryViewAllocation(
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include <memory>
|
|
11
|
+
#include <mutex>
|
|
11
12
|
#include <shared_mutex>
|
|
12
13
|
#include <unordered_map>
|
|
13
14
|
|
|
@@ -101,6 +102,9 @@ class Binding : public jni::HybridClass<Binding, JBinding>,
|
|
|
101
102
|
void schedulerDidFinishTransaction(
|
|
102
103
|
const MountingCoordinator::Shared& mountingCoordinator) override;
|
|
103
104
|
|
|
105
|
+
void schedulerShouldRenderTransactions(
|
|
106
|
+
const MountingCoordinator::Shared& mountingCoordinator) override;
|
|
107
|
+
|
|
104
108
|
void schedulerDidRequestPreliminaryViewAllocation(
|
|
105
109
|
const SurfaceId surfaceId,
|
|
106
110
|
const ShadowNode& shadowNode) override;
|
|
@@ -146,6 +150,10 @@ class Binding : public jni::HybridClass<Binding, JBinding>,
|
|
|
146
150
|
std::shared_mutex
|
|
147
151
|
surfaceHandlerRegistryMutex_; // Protects `surfaceHandlerRegistry_`.
|
|
148
152
|
|
|
153
|
+
// Track pending transactions, one per surfaceId
|
|
154
|
+
std::mutex pendingTransactionsMutex_;
|
|
155
|
+
std::vector<MountingTransaction> pendingTransactions_;
|
|
156
|
+
|
|
149
157
|
float pointScaleFactor_ = 1;
|
|
150
158
|
|
|
151
159
|
std::shared_ptr<const ReactNativeConfig> reactNativeConfig_{nullptr};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<7ab741aec808bc3a138470fe18ef8b8a>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -45,6 +45,24 @@ class ReactNativeFeatureFlagsProviderHolder
|
|
|
45
45
|
return method(javaProvider_);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
bool androidEnablePendingFabricTransactions() override {
|
|
49
|
+
static const auto method =
|
|
50
|
+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("androidEnablePendingFabricTransactions");
|
|
51
|
+
return method(javaProvider_);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
bool batchRenderingUpdatesInEventLoop() override {
|
|
55
|
+
static const auto method =
|
|
56
|
+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("batchRenderingUpdatesInEventLoop");
|
|
57
|
+
return method(javaProvider_);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
bool destroyFabricSurfacesInReactInstanceManager() override {
|
|
61
|
+
static const auto method =
|
|
62
|
+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("destroyFabricSurfacesInReactInstanceManager");
|
|
63
|
+
return method(javaProvider_);
|
|
64
|
+
}
|
|
65
|
+
|
|
48
66
|
bool enableBackgroundExecutor() override {
|
|
49
67
|
static const auto method =
|
|
50
68
|
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableBackgroundExecutor");
|
|
@@ -63,12 +81,6 @@ class ReactNativeFeatureFlagsProviderHolder
|
|
|
63
81
|
return method(javaProvider_);
|
|
64
82
|
}
|
|
65
83
|
|
|
66
|
-
bool batchRenderingUpdatesInEventLoop() override {
|
|
67
|
-
static const auto method =
|
|
68
|
-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("batchRenderingUpdatesInEventLoop");
|
|
69
|
-
return method(javaProvider_);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
84
|
bool enableSpannableBuildingUnification() override {
|
|
73
85
|
static const auto method =
|
|
74
86
|
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableSpannableBuildingUnification");
|
|
@@ -108,6 +120,21 @@ bool JReactNativeFeatureFlagsCxxInterop::commonTestFlag(
|
|
|
108
120
|
return ReactNativeFeatureFlags::commonTestFlag();
|
|
109
121
|
}
|
|
110
122
|
|
|
123
|
+
bool JReactNativeFeatureFlagsCxxInterop::androidEnablePendingFabricTransactions(
|
|
124
|
+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
125
|
+
return ReactNativeFeatureFlags::androidEnablePendingFabricTransactions();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
bool JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop(
|
|
129
|
+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
130
|
+
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
bool JReactNativeFeatureFlagsCxxInterop::destroyFabricSurfacesInReactInstanceManager(
|
|
134
|
+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
135
|
+
return ReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager();
|
|
136
|
+
}
|
|
137
|
+
|
|
111
138
|
bool JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor(
|
|
112
139
|
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
113
140
|
return ReactNativeFeatureFlags::enableBackgroundExecutor();
|
|
@@ -123,11 +150,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableMicrotasks(
|
|
|
123
150
|
return ReactNativeFeatureFlags::enableMicrotasks();
|
|
124
151
|
}
|
|
125
152
|
|
|
126
|
-
bool JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop(
|
|
127
|
-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
128
|
-
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
153
|
bool JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification(
|
|
132
154
|
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
133
155
|
return ReactNativeFeatureFlags::enableSpannableBuildingUnification();
|
|
@@ -173,6 +195,15 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
|
|
173
195
|
makeNativeMethod(
|
|
174
196
|
"commonTestFlag",
|
|
175
197
|
JReactNativeFeatureFlagsCxxInterop::commonTestFlag),
|
|
198
|
+
makeNativeMethod(
|
|
199
|
+
"androidEnablePendingFabricTransactions",
|
|
200
|
+
JReactNativeFeatureFlagsCxxInterop::androidEnablePendingFabricTransactions),
|
|
201
|
+
makeNativeMethod(
|
|
202
|
+
"batchRenderingUpdatesInEventLoop",
|
|
203
|
+
JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop),
|
|
204
|
+
makeNativeMethod(
|
|
205
|
+
"destroyFabricSurfacesInReactInstanceManager",
|
|
206
|
+
JReactNativeFeatureFlagsCxxInterop::destroyFabricSurfacesInReactInstanceManager),
|
|
176
207
|
makeNativeMethod(
|
|
177
208
|
"enableBackgroundExecutor",
|
|
178
209
|
JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor),
|
|
@@ -182,9 +213,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
|
|
182
213
|
makeNativeMethod(
|
|
183
214
|
"enableMicrotasks",
|
|
184
215
|
JReactNativeFeatureFlagsCxxInterop::enableMicrotasks),
|
|
185
|
-
makeNativeMethod(
|
|
186
|
-
"batchRenderingUpdatesInEventLoop",
|
|
187
|
-
JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop),
|
|
188
216
|
makeNativeMethod(
|
|
189
217
|
"enableSpannableBuildingUnification",
|
|
190
218
|
JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification),
|