8
8
9
9
#import " ReactNativeSupport.h"
10
10
11
+ @interface ReactNativeSupport ()
12
+
13
+ @property (nonatomic , assign ) BOOL javascriptJustLoaded;
14
+
15
+ @end
16
+
17
+
11
18
@implementation ReactNativeSupport
12
19
13
20
NSString *const RCTReloadNotification = @" RCTReloadNotification" ;
14
21
NSString *const RCTJavaScriptDidLoadNotification = @" RCTJavaScriptDidLoadNotification" ;
22
+ NSString *const RCTContentDidAppearNotification = @" RCTContentDidAppearNotification" ;
23
+
15
24
16
25
- (instancetype )init
17
26
{
18
27
self = [super init ];
19
28
if (self == nil ) return nil ;
29
+ self.javascriptJustLoaded = NO ;
20
30
21
31
[[NSNotificationCenter defaultCenter ] addObserver: self
22
- selector: @selector (appDidLoad )
32
+ selector: @selector (javascriptDidLoad )
23
33
name: RCTJavaScriptDidLoadNotification
24
34
object: nil ];
25
35
36
+ [[NSNotificationCenter defaultCenter ] addObserver: self
37
+ selector: @selector (contentDidAppear )
38
+ name: RCTContentDidAppearNotification
39
+ object: nil ];
40
+
26
41
return self;
27
42
}
28
43
@@ -41,9 +56,18 @@ - (void) reloadApp
41
56
userInfo: nil ];
42
57
}
43
58
44
- - (void ) appDidLoad
59
+ - (void ) javascriptDidLoad
60
+ {
61
+ self.javascriptJustLoaded = YES ;
62
+ }
63
+
64
+ - (void ) contentDidAppear
45
65
{
46
- if (self.delegate ) [self .delegate reactNativeAppDidLoad ];
66
+ if (self.javascriptJustLoaded )
67
+ {
68
+ self.javascriptJustLoaded = NO ;
69
+ if (self.delegate ) [self .delegate reactNativeAppDidLoad ];
70
+ }
47
71
}
48
72
49
73
0 commit comments