Skip to content

Commit

Permalink
Do not opt-out fbsource/xplat/js/react-native-github/template from CL…
Browse files Browse the repository at this point in the history
…ANGFORMAT

Summary:
As we're adding C++ code, I'm enabling CLANGFORMAT inside the React
Native template folder.

Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D33238197

fbshipit-source-id: e60c849bc776e8ec130c3baba01490d431d39a67
  • Loading branch information
cortinico authored and facebook-github-bot committed Dec 20, 2021
1 parent 0a3ddce commit b352aa3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
9 changes: 5 additions & 4 deletions template/ios/HelloWorld/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>

#import <react/config/ReactNativeConfig.h>

Expand Down Expand Up @@ -44,9 +44,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"HelloWorld", nil);

if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
rootView.backgroundColor = [UIColor whiteColor];
}

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
Expand Down Expand Up @@ -92,7 +92,8 @@ - (Class)getModuleClassFromName:(const char *)name
}

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
initParams:(const facebook::react::ObjCTurboModule::InitParams &)params
initParams:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion template/ios/HelloWorld/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#import "AppDelegate.h"

int main(int argc, char * argv[]) {
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
Expand Down
27 changes: 14 additions & 13 deletions template/ios/HelloWorldTests/HelloWorldTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ @interface HelloWorldTests : XCTestCase

@implementation HelloWorldTests

- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
{
if (test(view)) {
return YES;
Expand All @@ -34,23 +34,25 @@ - (void)testRendersWelcomeScreen

__block NSString *redboxError = nil;
#ifdef DEBUG
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
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]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];

foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
foundElement = [self findSubviewInView:vc.view
matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
}

#ifdef DEBUG
Expand All @@ -61,5 +63,4 @@ - (void)testRendersWelcomeScreen
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
}


@end

0 comments on commit b352aa3

Please sign in to comment.