35
35
BOOL RCTIsHomeAssetURL (NSURL *__nullable imageURL);
36
36
37
37
// Whether the New Architecture is enabled or not
38
+ static BOOL _newArchEnabled = false ;
38
39
BOOL RCTIsNewArchEnabled (void )
39
40
{
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;
41
47
}
42
48
void RCTSetNewArchEnabled (BOOL enabled)
43
49
{
@@ -46,9 +52,16 @@ void RCTSetNewArchEnabled(BOOL enabled)
46
52
// whether the New Arch is enabled or not.
47
53
}
48
54
55
+ static BOOL _legacyWarningEnabled = true ;
49
56
BOOL RCTAreLegacyLogsEnabled (void )
50
57
{
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;
52
65
}
53
66
54
67
static NSString *__nullable _RCTJSONStringifyNoRetry (id __nullable jsonObject, NSError **error)
0 commit comments