Skip to content

Commit 3e5c609

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Back out "Mitigate deadlock hazard in RCTUtils.m" (facebook#50795)
Summary: Pull Request resolved: facebook#50795 This diff causes `rntester-ios` to launch into legacy architecture by default. Changelog: [Internal] Reviewed By: joevilches Differential Revision: D73225574 fbshipit-source-id: 9a4f1967bbabd23936cf2faf9a2bf48a850a4d11
1 parent 1b45dc8 commit 3e5c609

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/react-native/React/Base/RCTUtils.mm

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@
3535
BOOL RCTIsHomeAssetURL(NSURL *__nullable imageURL);
3636

3737
// Whether the New Architecture is enabled or not
38+
static BOOL _newArchEnabled = false;
3839
BOOL RCTIsNewArchEnabled(void)
3940
{
40-
return ((NSNumber *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTNewArchEnabled"]).boolValue;
41+
static dispatch_once_t onceToken;
42+
dispatch_once(&onceToken, ^{
43+
NSNumber *rctNewArchEnabled = (NSNumber *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTNewArchEnabled"];
44+
_newArchEnabled = rctNewArchEnabled == nil || rctNewArchEnabled.boolValue;
45+
});
46+
return _newArchEnabled;
4147
}
4248
void RCTSetNewArchEnabled(BOOL enabled)
4349
{
@@ -46,9 +52,16 @@ void RCTSetNewArchEnabled(BOOL enabled)
4652
// whether the New Arch is enabled or not.
4753
}
4854

55+
static BOOL _legacyWarningEnabled = true;
4956
BOOL RCTAreLegacyLogsEnabled(void)
5057
{
51-
return ((NSNumber *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTLegacyWarningsEnabled"]).boolValue;
58+
static dispatch_once_t onceToken;
59+
dispatch_once(&onceToken, ^{
60+
NSNumber *rctNewArchEnabled =
61+
(NSNumber *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTLegacyWarningsEnabled"];
62+
_legacyWarningEnabled = rctNewArchEnabled.boolValue;
63+
});
64+
return _legacyWarningEnabled;
5265
}
5366

5467
static NSString *__nullable _RCTJSONStringifyNoRetry(id __nullable jsonObject, NSError **error)

0 commit comments

Comments
 (0)