mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fixes template build failed in release mode (#25751)
Summary: Fixes https://github.com/facebook/react-native/issues/25745, Xcode stripped dead code in Release mode, and in template test code, it should only run in Debug mode, so we can use a macro to fix this issue. ## Changelog [iOS] [Fixed] - Fixes template build failed in release mode Pull Request resolved: https://github.com/facebook/react-native/pull/25751 Test Plan: 1. Create a new project using `react-native init AwesomProject`. 2. Change project target scheme to `Release`. 3. Build and it should success. Differential Revision: D16442643 Pulled By: TheSavior fbshipit-source-id: f08ed70523aa1aa418064465f8df367a06e8974f
This commit is contained in:
committed by
Facebook Github Bot
parent
cf77067f0c
commit
0fcaca8e26
@@ -40,11 +40,13 @@
|
||||
BOOL foundElement = NO;
|
||||
|
||||
__block NSString *redboxError = nil;
|
||||
#ifdef DEBUG
|
||||
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
|
||||
if (level >= RCTLogLevelError) {
|
||||
redboxError = message;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
|
||||
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
|
||||
@@ -57,8 +59,10 @@
|
||||
return NO;
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
RCTSetLogFunction(RCTDefaultLogFunction);
|
||||
#endif
|
||||
|
||||
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
|
||||
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
|
||||
|
||||
Reference in New Issue
Block a user