Skip to content

Commit b308937

Browse files
author
talkol
committed
fixes #8, RN release build fails in e2e due to sync problems
1 parent e38fb1a commit b308937

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

detox/ios/Detox/ReactNativeSupport.m

+27-3
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,36 @@
88

99
#import "ReactNativeSupport.h"
1010

11+
@interface ReactNativeSupport()
12+
13+
@property (nonatomic, assign) BOOL javascriptJustLoaded;
14+
15+
@end
16+
17+
1118
@implementation ReactNativeSupport
1219

1320
NSString *const RCTReloadNotification = @"RCTReloadNotification";
1421
NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
22+
NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification";
23+
1524

1625
- (instancetype)init
1726
{
1827
self = [super init];
1928
if (self == nil) return nil;
29+
self.javascriptJustLoaded = NO;
2030

2131
[[NSNotificationCenter defaultCenter] addObserver:self
22-
selector:@selector(appDidLoad)
32+
selector:@selector(javascriptDidLoad)
2333
name:RCTJavaScriptDidLoadNotification
2434
object:nil];
2535

36+
[[NSNotificationCenter defaultCenter] addObserver:self
37+
selector:@selector(contentDidAppear)
38+
name:RCTContentDidAppearNotification
39+
object:nil];
40+
2641
return self;
2742
}
2843

@@ -41,9 +56,18 @@ - (void) reloadApp
4156
userInfo:nil];
4257
}
4358

44-
- (void) appDidLoad
59+
- (void) javascriptDidLoad
60+
{
61+
self.javascriptJustLoaded = YES;
62+
}
63+
64+
- (void) contentDidAppear
4565
{
46-
if (self.delegate) [self.delegate reactNativeAppDidLoad];
66+
if (self.javascriptJustLoaded)
67+
{
68+
self.javascriptJustLoaded = NO;
69+
if (self.delegate) [self.delegate reactNativeAppDidLoad];
70+
}
4771
}
4872

4973

detox/ios/Detox/TestRunner.m

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ @interface TestRunner()
1515
@property (nonatomic, retain) TestFailureHandler *failureHandler;
1616
@property (nonatomic, retain) NSString *currentInvocationId;
1717

18-
1918
@end
2019

2120

0 commit comments

Comments
 (0)