react-native 0.74.0 → 0.74.1
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/Components/Touchable/TouchableBounce.js +1 -0
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTUtils.m +28 -8
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +0 -3
- package/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +22 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +5 -1
- package/React/Fabric/RCTScheduler.h +2 -0
- package/React/Fabric/RCTScheduler.mm +6 -0
- package/React/Fabric/RCTSurfacePresenter.mm +5 -0
- package/React/Modules/RCTUIManager.m +8 -9
- package/React/Views/RCTComponentData.m +14 -1
- package/ReactAndroid/api/ReactAndroid.api +1 -2
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +24 -9
- 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 +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +11 -18
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +10 -0
- 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/ReactCommon.podspec +1 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/jsc/JSCRuntime.cpp +2 -0
- package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +2 -1
- 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 +11 -11
- package/scripts/cocoapods/privacy_manifest_utils.rb +172 -0
- package/scripts/cocoapods/utils.rb +1 -38
- package/scripts/react_native_pods.rb +12 -3
- 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
- package/third-party-podspecs/RCT-Folly.podspec +1 -0
|
@@ -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/RCTUtils.m
CHANGED
|
@@ -562,17 +562,37 @@ UIWindow *__nullable RCTKeyWindow(void)
|
|
|
562
562
|
return nil;
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
565
|
+
NSSet<UIScene *> *connectedScenes = RCTSharedApplication().connectedScenes;
|
|
566
|
+
|
|
567
|
+
UIScene *foregroundActiveScene;
|
|
568
|
+
UIScene *foregroundInactiveScene;
|
|
569
|
+
|
|
570
|
+
for (UIScene *scene in connectedScenes) {
|
|
571
|
+
if (![scene isKindOfClass:[UIWindowScene class]]) {
|
|
568
572
|
continue;
|
|
569
573
|
}
|
|
570
|
-
UIWindowScene *windowScene = (UIWindowScene *)scene;
|
|
571
574
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
575
|
+
if (scene.activationState == UISceneActivationStateForegroundActive) {
|
|
576
|
+
foregroundActiveScene = scene;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (!foregroundInactiveScene && scene.activationState == UISceneActivationStateForegroundInactive) {
|
|
581
|
+
foregroundInactiveScene = scene;
|
|
582
|
+
// no break, we can have the active scene later in the set.
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
UIScene *sceneToUse = foregroundActiveScene ? foregroundActiveScene : foregroundInactiveScene;
|
|
587
|
+
UIWindowScene *windowScene = (UIWindowScene *)sceneToUse;
|
|
588
|
+
|
|
589
|
+
if (@available(iOS 15.0, *)) {
|
|
590
|
+
return windowScene.keyWindow;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
for (UIWindow *window in windowScene.windows) {
|
|
594
|
+
if (window.isKeyWindow) {
|
|
595
|
+
return window;
|
|
576
596
|
}
|
|
577
597
|
}
|
|
578
598
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -125,9 +125,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
125
125
|
[super surface:surface didChangeStage:stage];
|
|
126
126
|
if (RCTSurfaceStageIsRunning(stage)) {
|
|
127
127
|
[_bridge.performanceLogger markStopForTag:RCTPLTTI];
|
|
128
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
129
|
-
[[NSNotificationCenter defaultCenter] postNotificationName:RCTContentDidAppearNotification object:self];
|
|
130
|
-
});
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
130
|
|
|
@@ -7,18 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
#import "RCTRootComponentView.h"
|
|
9
9
|
|
|
10
|
+
#import <React/RCTRootView.h>
|
|
10
11
|
#import <react/renderer/components/root/RootComponentDescriptor.h>
|
|
11
12
|
#import <react/renderer/components/root/RootProps.h>
|
|
12
13
|
#import "RCTConversions.h"
|
|
13
14
|
|
|
14
15
|
using namespace facebook::react;
|
|
15
16
|
|
|
16
|
-
@implementation RCTRootComponentView
|
|
17
|
+
@implementation RCTRootComponentView {
|
|
18
|
+
BOOL _contentHasAppeared;
|
|
19
|
+
}
|
|
17
20
|
|
|
18
21
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
19
22
|
{
|
|
20
23
|
if (self = [super initWithFrame:frame]) {
|
|
21
24
|
_props = RootShadowNode::defaultSharedProps();
|
|
25
|
+
_contentHasAppeared = NO;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
return self;
|
|
@@ -26,6 +30,23 @@ using namespace facebook::react;
|
|
|
26
30
|
|
|
27
31
|
#pragma mark - RCTComponentViewProtocol
|
|
28
32
|
|
|
33
|
+
- (void)prepareForRecycle
|
|
34
|
+
{
|
|
35
|
+
[super prepareForRecycle];
|
|
36
|
+
_contentHasAppeared = NO;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
40
|
+
{
|
|
41
|
+
[super mountChildComponentView:childComponentView index:index];
|
|
42
|
+
if (!self->_contentHasAppeared) {
|
|
43
|
+
self->_contentHasAppeared = YES;
|
|
44
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
45
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:RCTContentDidAppearNotification object:self];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
29
50
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
30
51
|
{
|
|
31
52
|
return concreteComponentDescriptorProvider<RootComponentDescriptor>();
|
|
@@ -420,6 +420,11 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
|
|
|
420
420
|
|
|
421
421
|
- (void)prepareForRecycle
|
|
422
422
|
{
|
|
423
|
+
[super prepareForRecycle];
|
|
424
|
+
// Must invalidate state before setting contentOffset on ScrollView.
|
|
425
|
+
// Otherwise the state will be propagated to shadow tree.
|
|
426
|
+
_state.reset();
|
|
427
|
+
|
|
423
428
|
const auto &props = static_cast<const ScrollViewProps &>(*_props);
|
|
424
429
|
_scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset);
|
|
425
430
|
// We set the default behavior to "never" so that iOS
|
|
@@ -427,7 +432,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
|
|
|
427
432
|
// and keeps it as an opt-in behavior.
|
|
428
433
|
_scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
429
434
|
_shouldUpdateContentInsetAdjustmentBehavior = YES;
|
|
430
|
-
_state.reset();
|
|
431
435
|
_isUserTriggeredScrolling = NO;
|
|
432
436
|
CGRect oldFrame = self.frame;
|
|
433
437
|
self.frame = CGRectZero;
|
|
@@ -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
|
}
|
|
@@ -1674,8 +1674,8 @@ static UIView *_jsResponder;
|
|
|
1674
1674
|
{
|
|
1675
1675
|
self = [super init];
|
|
1676
1676
|
if (self) {
|
|
1677
|
-
|
|
1678
|
-
|
|
1677
|
+
_uiManager = uiManager;
|
|
1678
|
+
_registry = registry;
|
|
1679
1679
|
}
|
|
1680
1680
|
return self;
|
|
1681
1681
|
}
|
|
@@ -1693,26 +1693,27 @@ static UIView *_jsResponder;
|
|
|
1693
1693
|
- (id)objectForKey:(id)key
|
|
1694
1694
|
{
|
|
1695
1695
|
if (![key isKindOfClass:[NSNumber class]]) {
|
|
1696
|
-
return
|
|
1696
|
+
return NULL;
|
|
1697
1697
|
}
|
|
1698
1698
|
|
|
1699
1699
|
NSNumber *index = (NSNumber *)key;
|
|
1700
|
-
UIView *view = [
|
|
1700
|
+
UIView *view = _registry[index];
|
|
1701
1701
|
if (view) {
|
|
1702
1702
|
return [RCTUIManager paperViewOrCurrentView:view];
|
|
1703
1703
|
}
|
|
1704
|
-
view =
|
|
1704
|
+
view = [_uiManager viewForReactTag:index];
|
|
1705
1705
|
if (view) {
|
|
1706
1706
|
return [RCTUIManager paperViewOrCurrentView:view];
|
|
1707
1707
|
}
|
|
1708
|
-
return
|
|
1708
|
+
return NULL;
|
|
1709
1709
|
}
|
|
1710
1710
|
|
|
1711
1711
|
- (void)removeObjectForKey:(id)key
|
|
1712
1712
|
{
|
|
1713
1713
|
if (![key isKindOfClass:[NSNumber class]]) {
|
|
1714
|
-
return
|
|
1714
|
+
return;
|
|
1715
1715
|
}
|
|
1716
|
+
|
|
1716
1717
|
NSNumber *tag = (NSNumber *)key;
|
|
1717
1718
|
|
|
1718
1719
|
if (_registry[key]) {
|
|
@@ -1720,8 +1721,6 @@ static UIView *_jsResponder;
|
|
|
1720
1721
|
[mutableRegistry removeObjectForKey:tag];
|
|
1721
1722
|
} else if ([_uiManager viewForReactTag:tag]) {
|
|
1722
1723
|
[_uiManager removeViewFromRegistry:tag];
|
|
1723
|
-
} else {
|
|
1724
|
-
[super removeObjectForKey:key];
|
|
1725
1724
|
}
|
|
1726
1725
|
}
|
|
1727
1726
|
|
|
@@ -416,7 +416,20 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
|
|
416
416
|
+ (NSDictionary<NSString *, id> *)constantsForViewMangerClass:(Class)managerClass
|
|
417
417
|
{
|
|
418
418
|
if ([managerClass instancesRespondToSelector:@selector(constantsToExport)]) {
|
|
419
|
-
|
|
419
|
+
BOOL shouldRunOnMainThread = NO;
|
|
420
|
+
|
|
421
|
+
if ([managerClass respondsToSelector:@selector(requiresMainQueueSetup)]) {
|
|
422
|
+
shouldRunOnMainThread = [managerClass requiresMainQueueSetup];
|
|
423
|
+
}
|
|
424
|
+
if (shouldRunOnMainThread) {
|
|
425
|
+
__block NSDictionary<NSString *, id> *constants;
|
|
426
|
+
RCTUnsafeExecuteOnMainQueueSync(^{
|
|
427
|
+
constants = [[managerClass new] constantsToExport];
|
|
428
|
+
});
|
|
429
|
+
return constants;
|
|
430
|
+
} else {
|
|
431
|
+
return [[managerClass new] constantsToExport];
|
|
432
|
+
}
|
|
420
433
|
}
|
|
421
434
|
return @{};
|
|
422
435
|
}
|
|
@@ -92,7 +92,7 @@ public abstract class com/facebook/react/ReactActivity : androidx/appcompat/app/
|
|
|
92
92
|
protected fun <init> ()V
|
|
93
93
|
protected fun createReactActivityDelegate ()Lcom/facebook/react/ReactActivityDelegate;
|
|
94
94
|
protected fun getMainComponentName ()Ljava/lang/String;
|
|
95
|
-
public fun getReactDelegate ()
|
|
95
|
+
public fun getReactDelegate ()Lcom/facebook/react/ReactDelegate;
|
|
96
96
|
protected final fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
|
97
97
|
protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
|
|
98
98
|
public fun invokeDefaultOnBackPressed ()V
|
|
@@ -7697,4 +7697,3 @@ public class com/facebook/react/views/view/ViewGroupClickEvent : com/facebook/re
|
|
|
7697
7697
|
protected fun getEventData ()Lcom/facebook/react/bridge/WritableMap;
|
|
7698
7698
|
public fun getEventName ()Ljava/lang/String;
|
|
7699
7699
|
}
|
|
7700
|
-
|
|
@@ -65,8 +65,8 @@ public abstract class ReactActivity extends AppCompatActivity
|
|
|
65
65
|
mDelegate.onDestroy();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
public
|
|
69
|
-
mDelegate.getReactDelegate();
|
|
68
|
+
public @Nullable ReactDelegate getReactDelegate() {
|
|
69
|
+
return mDelegate.getReactDelegate();
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
@Override
|
|
@@ -15,6 +15,7 @@ import android.view.KeyEvent;
|
|
|
15
15
|
import androidx.annotation.NonNull;
|
|
16
16
|
import androidx.annotation.Nullable;
|
|
17
17
|
import com.facebook.infer.annotation.Assertions;
|
|
18
|
+
import com.facebook.react.bridge.UiThreadUtil;
|
|
18
19
|
import com.facebook.react.config.ReactFeatureFlags;
|
|
19
20
|
import com.facebook.react.devsupport.DisabledDevSupportManager;
|
|
20
21
|
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
|
|
@@ -99,7 +100,7 @@ public class ReactDelegate {
|
|
|
99
100
|
&& mReactHost.getDevSupportManager() != null) {
|
|
100
101
|
return mReactHost.getDevSupportManager();
|
|
101
102
|
} else if (getReactNativeHost().hasInstance()
|
|
102
|
-
&& getReactNativeHost().
|
|
103
|
+
&& getReactNativeHost().getReactInstanceManager() != null) {
|
|
103
104
|
return getReactNativeHost().getReactInstanceManager().getDevSupportManager();
|
|
104
105
|
} else {
|
|
105
106
|
return null;
|
|
@@ -241,17 +242,31 @@ public class ReactDelegate {
|
|
|
241
242
|
|
|
242
243
|
public void reload() {
|
|
243
244
|
DevSupportManager devSupportManager = getDevSupportManager();
|
|
244
|
-
if (devSupportManager
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
if (devSupportManager == null) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Reload in RELEASE mode
|
|
250
|
+
if (devSupportManager instanceof DisabledDevSupportManager) {
|
|
251
|
+
// Do not reload the bundle from JS as there is no bundler running in release mode.
|
|
252
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
253
|
+
if (mReactHost != null) {
|
|
254
|
+
mReactHost.reload("ReactDelegate.reload()");
|
|
255
|
+
}
|
|
251
256
|
} else {
|
|
252
|
-
|
|
257
|
+
UiThreadUtil.runOnUiThread(
|
|
258
|
+
() -> {
|
|
259
|
+
if (mReactNativeHost.hasInstance()
|
|
260
|
+
&& mReactNativeHost.getReactInstanceManager() != null) {
|
|
261
|
+
mReactNativeHost.getReactInstanceManager().recreateReactContextInBackground();
|
|
262
|
+
}
|
|
263
|
+
});
|
|
253
264
|
}
|
|
265
|
+
return;
|
|
254
266
|
}
|
|
267
|
+
|
|
268
|
+
// Reload in DEBUG mode
|
|
269
|
+
devSupportManager.handleReloadJS();
|
|
255
270
|
}
|
|
256
271
|
|
|
257
272
|
public void loadApp() {
|
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
|