Browse Source

More indentation fixes

yogevbd 6 years ago
parent
commit
d971a894bf
4 changed files with 603 additions and 754 deletions
  1. 227
    274
      ios/RCCManager.m
  2. 57
    121
      ios/RCCManagerModule.m
  3. 316
    356
      ios/RCCTabBarController.m
  4. 3
    3
      ios/ReactNativeNavigation.xcodeproj/project.pbxproj

+ 227
- 274
ios/RCCManager.m View File

14
 
14
 
15
 @implementation RCCManager
15
 @implementation RCCManager
16
 
16
 
17
-+ (instancetype)sharedInstance
18
-{
19
-  static RCCManager *sharedInstance = nil;
20
-  static dispatch_once_t onceToken = 0;
21
-  
22
-  dispatch_once(&onceToken,^{
23
-    if (sharedInstance == nil)
24
-    {
25
-      sharedInstance = [[RCCManager alloc] init];
26
-    }
27
-  });
28
-  
29
-  return sharedInstance;
17
++ (instancetype)sharedInstance {
18
+    static RCCManager *sharedInstance = nil;
19
+    static dispatch_once_t onceToken = 0;
20
+    
21
+    dispatch_once(&onceToken,^{
22
+        if (sharedInstance == nil) {
23
+            sharedInstance = [[RCCManager alloc] init];
24
+        }
25
+    });
26
+    
27
+    return sharedInstance;
30
 }
28
 }
31
 
29
 
32
-+ (instancetype)sharedIntance
33
-{
34
-  return [RCCManager sharedInstance];
30
++ (instancetype)sharedIntance {
31
+    return [RCCManager sharedInstance];
35
 }
32
 }
36
 
33
 
37
-- (instancetype)init
38
-{
39
-  self = [super init];
40
-  if (self)
41
-  {
42
-    self.modulesRegistry = [@{} mutableCopy];
43
-    
44
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onRNReload) name:RCTBridgeWillReloadNotification object:nil];
45
-  }
46
-  return self;
34
+- (instancetype)init {
35
+    self = [super init];
36
+    if (self) {
37
+        self.modulesRegistry = [@{} mutableCopy];
38
+        
39
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onRNReload) name:RCTBridgeWillReloadNotification object:nil];
40
+    }
41
+    return self;
47
 }
42
 }
48
 
43
 
49
 - (NSDictionary *)getLaunchArgs {
44
 - (NSDictionary *)getLaunchArgs {
50
-  NSMutableDictionary* mutableArguments = [[NSMutableDictionary alloc] init];
51
-  NSArray* arguments = [[NSProcessInfo processInfo] arguments];
52
-  for (int i = 0; i < [arguments count]; i+=2) {
53
-    NSString* key = [arguments objectAtIndex:i];
54
-    NSString* value = [arguments objectAtIndex:i+1];
55
-    [mutableArguments setObject:value forKey:key];
56
-  }
57
-  
58
-  return mutableArguments;
45
+    NSMutableDictionary* mutableArguments = [[NSMutableDictionary alloc] init];
46
+    NSArray* arguments = [[NSProcessInfo processInfo] arguments];
47
+    for (int i = 0; i < [arguments count]; i+=2) {
48
+        NSString* key = [arguments objectAtIndex:i];
49
+        NSString* value = [arguments objectAtIndex:i+1];
50
+        [mutableArguments setObject:value forKey:key];
51
+    }
52
+    
53
+    return mutableArguments;
59
 }
54
 }
60
 
55
 
61
--(void)clearModuleRegistry
62
-{
63
-  [self.modulesRegistry removeAllObjects];
56
+-(void)clearModuleRegistry {
57
+    [self.modulesRegistry removeAllObjects];
64
 }
58
 }
65
 
59
 
66
--(void)onRNReload
67
-{
68
-  id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
69
-  appDelegate.window.rootViewController = nil;
70
-  [self setAppStyle:nil];
71
-  [self clearModuleRegistry];
60
+-(void)onRNReload {
61
+    id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
62
+    appDelegate.window.rootViewController = nil;
63
+    [self setAppStyle:nil];
64
+    [self clearModuleRegistry];
72
 }
65
 }
73
 
66
 
74
--(void)registerController:(UIViewController*)controller componentId:(NSString*)componentId componentType:(NSString*)componentType
75
-{
76
-  if (controller == nil || componentId == nil)
77
-  {
78
-    return;
79
-  }
80
-  
81
-  NSMutableDictionary *componentsDic = self.modulesRegistry[componentType];
82
-  if (componentsDic == nil)
83
-  {
84
-    componentsDic = [@{} mutableCopy];
85
-    self.modulesRegistry[componentType] = componentsDic;
86
-  }
87
-  
88
-  /*
89
-   TODO: we really want this error, but we need to unregister controllers when they dealloc
90
-   if (componentsDic[componentId])
91
-   {
92
-   [self.sharedBridge.redBox showErrorMessage:[NSString stringWithFormat:@"Controllers: controller with id %@ is already registered. Make sure all of the controller id's you use are unique.", componentId]];
93
-   }
94
-   */
95
-  
96
-  componentsDic[componentId] = controller;
67
+-(void)registerController:(UIViewController*)controller componentId:(NSString*)componentId componentType:(NSString*)componentType {
68
+    if (controller == nil || componentId == nil) {
69
+        return;
70
+    }
71
+    
72
+    NSMutableDictionary *componentsDic = self.modulesRegistry[componentType];
73
+    if (componentsDic == nil) {
74
+        componentsDic = [@{} mutableCopy];
75
+        self.modulesRegistry[componentType] = componentsDic;
76
+    }
77
+    
78
+    /*
79
+     TODO: we really want this error, but we need to unregister controllers when they dealloc
80
+     if (componentsDic[componentId])
81
+     {
82
+     [self.sharedBridge.redBox showErrorMessage:[NSString stringWithFormat:@"Controllers: controller with id %@ is already registered. Make sure all of the controller id's you use are unique.", componentId]];
83
+     }
84
+     */
85
+    
86
+    componentsDic[componentId] = controller;
97
 }
87
 }
98
 
88
 
99
--(void)unregisterController:(UIViewController*)vc
100
-{
101
-  if (vc == nil) return;
102
-  
103
-  for (NSString *key in [self.modulesRegistry allKeys])
104
-  {
105
-    NSMutableDictionary *componentsDic = self.modulesRegistry[key];
106
-    for (NSString *componentID in [componentsDic allKeys])
107
-    {
108
-      UIViewController *tmpVc = componentsDic[componentID];
109
-      if (tmpVc == vc)
110
-      {
111
-        [componentsDic removeObjectForKey:componentID];
112
-      }
89
+-(void)unregisterController:(UIViewController*)vc {
90
+    if (vc == nil) return;
91
+    
92
+    for (NSString *key in [self.modulesRegistry allKeys]) {
93
+        NSMutableDictionary *componentsDic = self.modulesRegistry[key];
94
+        for (NSString *componentID in [componentsDic allKeys]) {
95
+            UIViewController *tmpVc = componentsDic[componentID];
96
+            if (tmpVc == vc) {
97
+                [componentsDic removeObjectForKey:componentID];
98
+            }
99
+        }
113
     }
100
     }
114
-  }
115
 }
101
 }
116
 
102
 
117
--(id)getControllerWithId:(NSString*)componentId componentType:(NSString*)componentType
118
-{
119
-  if (componentId == nil)
120
-  {
121
-    return nil;
122
-  }
123
-  
124
-  id component = nil;
125
-  
126
-  NSMutableDictionary *componentsDic = self.modulesRegistry[componentType];
127
-  if (componentsDic != nil)
128
-  {
129
-    component = componentsDic[componentId];
130
-  }
131
-  
132
-  return component;
103
+-(id)getControllerWithId:(NSString*)componentId componentType:(NSString*)componentType {
104
+    if (componentId == nil) {
105
+        return nil;
106
+    }
107
+    
108
+    id component = nil;
109
+    
110
+    NSMutableDictionary *componentsDic = self.modulesRegistry[componentType];
111
+    if (componentsDic != nil) {
112
+        component = componentsDic[componentId];
113
+    }
114
+    
115
+    return component;
133
 }
116
 }
134
 
117
 
135
--(NSString*) getIdForController:(UIViewController*)vc
136
-{
137
-  if([vc isKindOfClass:[RCCViewController class]])
138
-  {
139
-    NSString *controllerId = ((RCCViewController*)vc).controllerId;
140
-    if(controllerId != nil)
141
-    {
142
-      return controllerId;
118
+-(NSString*) getIdForController:(UIViewController*)vc {
119
+    if([vc isKindOfClass:[RCCViewController class]]) {
120
+        NSString *controllerId = ((RCCViewController*)vc).controllerId;
121
+        if(controllerId != nil) {
122
+            return controllerId;
123
+        }
143
     }
124
     }
144
-  }
145
-  
146
-  for (NSString *key in [self.modulesRegistry allKeys])
147
-  {
148
-    NSMutableDictionary *componentsDic = self.modulesRegistry[key];
149
-    for (NSString *componentID in [componentsDic allKeys])
150
-    {
151
-      UIViewController *tmpVc = componentsDic[componentID];
152
-      if (tmpVc == vc)
153
-      {
154
-        return componentID;
155
-      }
125
+    
126
+    for (NSString *key in [self.modulesRegistry allKeys]) {
127
+        NSMutableDictionary *componentsDic = self.modulesRegistry[key];
128
+        for (NSString *componentID in [componentsDic allKeys]) {
129
+            UIViewController *tmpVc = componentsDic[componentID];
130
+            if (tmpVc == vc) {
131
+                return componentID;
132
+            }
133
+        }
156
     }
134
     }
157
-  }
158
-  return nil;
135
+    return nil;
159
 }
136
 }
160
 
137
 
161
--(void)initBridgeWithBundleURL:(NSURL *)bundleURL
162
-{
163
-  [self initBridgeWithBundleURL :bundleURL launchOptions:nil];
138
+-(void)initBridgeWithBundleURL:(NSURL *)bundleURL {
139
+    [self initBridgeWithBundleURL :bundleURL launchOptions:nil];
164
 }
140
 }
165
 
141
 
166
--(void)initBridgeWithBundleURL:(NSURL *)bundleURL launchOptions:(NSDictionary *)launchOptions
167
-{
168
-  if (self.sharedBridge) return;
169
-  
170
-  self.bundleURL = bundleURL;
171
-  self.sharedBridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
172
-  
173
-  [[self class] showSplashScreen];
142
+-(void)initBridgeWithBundleURL:(NSURL *)bundleURL launchOptions:(NSDictionary *)launchOptions {
143
+    if (self.sharedBridge) return;
144
+    
145
+    self.bundleURL = bundleURL;
146
+    self.sharedBridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
147
+    
148
+    [[self class] showSplashScreen];
174
 }
149
 }
175
 
150
 
176
--(RCTBridge*)getBridge
177
-{
178
-  return self.sharedBridge;
151
+-(RCTBridge*)getBridge {
152
+    return self.sharedBridge;
179
 }
153
 }
180
 
154
 
181
--(UIWindow*)getAppWindow
182
-{
183
-  UIApplication *app = [UIApplication sharedApplication];
184
-  UIWindow *window = (app.keyWindow != nil) ? app.keyWindow : app.windows[0];
185
-  return window;
155
+-(UIWindow*)getAppWindow {
156
+    UIApplication *app = [UIApplication sharedApplication];
157
+    UIWindow *window = (app.keyWindow != nil) ? app.keyWindow : app.windows[0];
158
+    return window;
186
 }
159
 }
187
 
160
 
188
 #pragma mark - Splash Screen
161
 #pragma mark - Splash Screen
189
 
162
 
190
-+ (void)showSplashScreen
191
-{
192
-  
193
-  UIViewController* viewControllerFromLaunchStoryboard;
194
-  viewControllerFromLaunchStoryboard = [self viewControllerFromLaunchStoryboard];
195
-  if (viewControllerFromLaunchStoryboard)
196
-  {
197
-    [self showSplashScreenViewController:viewControllerFromLaunchStoryboard];
198
-    return;
199
-  }
200
-  
201
-  CGRect screenBounds = [UIScreen mainScreen].bounds;
202
-  UIViewController* viewControllerFromLaunchNib = [self viewControllerFromLaunchNibForScreenBounds:screenBounds];
203
-  if (viewControllerFromLaunchNib)
204
-  {
205
-    [self showSplashScreenViewController:viewControllerFromLaunchNib];
206
-    return;
207
-  }
208
-  
209
-  UIViewController* viewControllerFromLaunchImage = [self viewControllerFromLaunchImageForScreenBounds:screenBounds];
210
-  if (viewControllerFromLaunchImage)
211
-  {
212
-    [self showSplashScreenViewController:viewControllerFromLaunchImage];
213
-    return;
214
-  }
215
-  
216
-  UIViewController* viewController = [[UIViewController alloc] init];
217
-  viewController.view.frame = screenBounds;
218
-  viewController.view.backgroundColor = [UIColor whiteColor];
219
-  
220
-  [self showSplashScreenViewController:viewController];
163
++ (void)showSplashScreen {
164
+    UIViewController* viewControllerFromLaunchStoryboard;
165
+    viewControllerFromLaunchStoryboard = [self viewControllerFromLaunchStoryboard];
166
+    if (viewControllerFromLaunchStoryboard) {
167
+        [self showSplashScreenViewController:viewControllerFromLaunchStoryboard];
168
+        return;
169
+    }
170
+    
171
+    CGRect screenBounds = [UIScreen mainScreen].bounds;
172
+    UIViewController* viewControllerFromLaunchNib = [self viewControllerFromLaunchNibForScreenBounds:screenBounds];
173
+    if (viewControllerFromLaunchNib) {
174
+        [self showSplashScreenViewController:viewControllerFromLaunchNib];
175
+        return;
176
+    }
177
+    
178
+    UIViewController* viewControllerFromLaunchImage = [self viewControllerFromLaunchImageForScreenBounds:screenBounds];
179
+    if (viewControllerFromLaunchImage) {
180
+        [self showSplashScreenViewController:viewControllerFromLaunchImage];
181
+        return;
182
+    }
183
+    
184
+    UIViewController* viewController = [[UIViewController alloc] init];
185
+    viewController.view.frame = screenBounds;
186
+    viewController.view.backgroundColor = [UIColor whiteColor];
187
+    
188
+    [self showSplashScreenViewController:viewController];
221
 }
189
 }
222
 
190
 
223
-+ (UIViewController *)viewControllerFromLaunchStoryboard
224
-{
225
-  NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
226
-  if (launchStoryboardName == nil)
227
-  {
228
-    return nil;
229
-  }
230
-  
231
-  @try {
232
-    UIStoryboard* storyboard = [UIStoryboard storyboardWithName:launchStoryboardName bundle:nil];
233
-    return storyboard.instantiateInitialViewController;
234
-  }
235
-  @catch(NSException *exception) {
236
-    return nil;
237
-  }
191
++ (UIViewController *)viewControllerFromLaunchStoryboard {
192
+    NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
193
+    if (launchStoryboardName == nil) {
194
+        return nil;
195
+    }
196
+    
197
+    @try {
198
+        UIStoryboard* storyboard = [UIStoryboard storyboardWithName:launchStoryboardName bundle:nil];
199
+        return storyboard.instantiateInitialViewController;
200
+    } @catch(NSException *exception) {
201
+        return nil;
202
+    }
238
 }
203
 }
239
 
204
 
240
-+ (UIViewController *)viewControllerFromLaunchNibForScreenBounds:(CGRect)screenBounds
241
-{
242
-  NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
243
-  if (launchStoryboardName == nil)
244
-  {
245
-    return nil;
246
-  }
247
-  
248
-  @try {
249
-    id nibContents = [[NSBundle mainBundle] loadNibNamed:launchStoryboardName owner:self options:nil];
250
-    if (!nibContents || [nibContents count] == 0)
251
-    {
252
-      return nil;
205
++ (UIViewController *)viewControllerFromLaunchNibForScreenBounds:(CGRect)screenBounds {
206
+    NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
207
+    if (launchStoryboardName == nil) {
208
+        return nil;
253
     }
209
     }
254
     
210
     
255
-    id firstObject = [nibContents firstObject];
256
-    if (![firstObject isKindOfClass:[UIView class]])
257
-    {
258
-      return nil;
211
+    @try {
212
+        id nibContents = [[NSBundle mainBundle] loadNibNamed:launchStoryboardName owner:self options:nil];
213
+        if (!nibContents || [nibContents count] == 0) {
214
+            return nil;
215
+        }
216
+        
217
+        id firstObject = [nibContents firstObject];
218
+        if (![firstObject isKindOfClass:[UIView class]]) {
219
+            return nil;
220
+        }
221
+        
222
+        UIViewController* viewController = [[UIViewController alloc] init];
223
+        viewController.view = (UIView *)firstObject;
224
+        viewController.view.frame = screenBounds;
225
+        return viewController;
226
+    } @catch(NSException *exception) {
227
+        return nil;
259
     }
228
     }
260
-    
261
-    UIViewController* viewController = [[UIViewController alloc] init];
262
-    viewController.view = (UIView *)firstObject;
263
-    viewController.view.frame = screenBounds;
264
-    return viewController;
265
-  }
266
-  @catch(NSException *exception) {
267
-    return nil;
268
-  }
269
 }
229
 }
270
 
230
 
271
-+ (UIViewController *)viewControllerFromLaunchImageForScreenBounds:(CGRect)screenBounds
272
-{
273
-  //load the splash from the default image or from LaunchImage in the xcassets
274
-  
275
-  CGFloat screenHeight = screenBounds.size.height;
276
-  
277
-  NSString* imageName = @"Default";
278
-  if (screenHeight == 568)
279
-    imageName = [imageName stringByAppendingString:@"-568h"];
280
-  else if (screenHeight == 667)
281
-    imageName = [imageName stringByAppendingString:@"-667h"];
282
-  else if (screenHeight == 736)
283
-    imageName = [imageName stringByAppendingString:@"-736h"];
284
-  
285
-  //xcassets LaunchImage files
286
-  UIImage *image = [UIImage imageNamed:imageName];
287
-  if (image == nil)
288
-  {
289
-    imageName = @"LaunchImage";
231
++ (UIViewController *)viewControllerFromLaunchImageForScreenBounds:(CGRect)screenBounds {
232
+    //load the splash from the default image or from LaunchImage in the xcassets
233
+    
234
+    CGFloat screenHeight = screenBounds.size.height;
290
     
235
     
291
-    if (screenHeight == 480)
292
-      imageName = [imageName stringByAppendingString:@"-700"];
236
+    NSString* imageName = @"Default";
293
     if (screenHeight == 568)
237
     if (screenHeight == 568)
294
-      imageName = [imageName stringByAppendingString:@"-700-568h"];
238
+        imageName = [imageName stringByAppendingString:@"-568h"];
295
     else if (screenHeight == 667)
239
     else if (screenHeight == 667)
296
-      imageName = [imageName stringByAppendingString:@"-800-667h"];
240
+        imageName = [imageName stringByAppendingString:@"-667h"];
297
     else if (screenHeight == 736)
241
     else if (screenHeight == 736)
298
-      imageName = [imageName stringByAppendingString:@"-800-Portrait-736h"];
299
-    else if (screenHeight == 812)
300
-      imageName = [imageName stringByAppendingString:@"-1100-Portrait-2436h"];
301
-    else if (screenHeight == 1024)
302
-      imageName = [imageName stringByAppendingString:@"-Portrait"];
242
+        imageName = [imageName stringByAppendingString:@"-736h"];
303
     
243
     
304
-    image = [UIImage imageNamed:imageName];
305
-  }
306
-  
307
-  if (image == nil)
308
-  {
309
-    return nil;
310
-  }
311
-  
312
-  UIViewController* viewController = [[UIViewController alloc] init];
313
-  
314
-  UIImageView* imageView = [[UIImageView alloc] initWithImage:image];
315
-  viewController.view = imageView;
316
-  viewController.view.frame = screenBounds;
317
-  
318
-  return viewController;
244
+    //xcassets LaunchImage files
245
+    UIImage *image = [UIImage imageNamed:imageName];
246
+    if (image == nil) {
247
+        imageName = @"LaunchImage";
248
+        
249
+        if (screenHeight == 480)
250
+            imageName = [imageName stringByAppendingString:@"-700"];
251
+        if (screenHeight == 568)
252
+            imageName = [imageName stringByAppendingString:@"-700-568h"];
253
+        else if (screenHeight == 667)
254
+            imageName = [imageName stringByAppendingString:@"-800-667h"];
255
+        else if (screenHeight == 736)
256
+            imageName = [imageName stringByAppendingString:@"-800-Portrait-736h"];
257
+        else if (screenHeight == 812)
258
+            imageName = [imageName stringByAppendingString:@"-1100-Portrait-2436h"];
259
+        else if (screenHeight == 1024)
260
+            imageName = [imageName stringByAppendingString:@"-Portrait"];
261
+        
262
+        image = [UIImage imageNamed:imageName];
263
+    }
264
+    
265
+    if (image == nil) {
266
+        return nil;
267
+    }
268
+    
269
+    UIViewController* viewController = [[UIViewController alloc] init];
270
+    
271
+    UIImageView* imageView = [[UIImageView alloc] initWithImage:image];
272
+    viewController.view = imageView;
273
+    viewController.view.frame = screenBounds;
274
+    
275
+    return viewController;
319
 }
276
 }
320
 
277
 
321
-+ (void)showSplashScreenViewController:(UIViewController *)viewController
322
-{
323
-  id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
324
-  appDelegate.window.rootViewController = viewController;
325
-  [appDelegate.window makeKeyAndVisible];
278
++ (void)showSplashScreenViewController:(UIViewController *)viewController {
279
+    id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
280
+    appDelegate.window.rootViewController = viewController;
281
+    [appDelegate.window makeKeyAndVisible];
326
 }
282
 }
327
 
283
 
328
--(NSDictionary*)getAppStyle
329
-{
330
-  return [NSDictionary dictionaryWithDictionary:self.globalAppStyle];
284
+-(NSDictionary*)getAppStyle {
285
+    return [NSDictionary dictionaryWithDictionary:self.globalAppStyle];
331
 }
286
 }
332
 
287
 
333
--(void)setAppStyle:(NSDictionary*)appStyle
334
-{
335
-  self.globalAppStyle = [NSDictionary dictionaryWithDictionary:appStyle];
336
-  [self applyAppStyle];
337
-  
288
+-(void)setAppStyle:(NSDictionary*)appStyle {
289
+    self.globalAppStyle = [NSDictionary dictionaryWithDictionary:appStyle];
290
+    [self applyAppStyle];
291
+    
338
 }
292
 }
339
 
293
 
340
 -(void)applyAppStyle {
294
 -(void)applyAppStyle {
341
-  id backButtonImage = self.globalAppStyle[@"backButtonImage"];
342
-  UIImage *image = backButtonImage ? [RCTConvert UIImage:backButtonImage] : nil;
343
-  [[UINavigationBar appearance] setBackIndicatorImage:image];
344
-  [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:image];
295
+    id backButtonImage = self.globalAppStyle[@"backButtonImage"];
296
+    UIImage *image = backButtonImage ? [RCTConvert UIImage:backButtonImage] : nil;
297
+    [[UINavigationBar appearance] setBackIndicatorImage:image];
298
+    [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:image];
345
 }
299
 }
346
 
300
 
347
 
301
 
348
 #pragma mark - RCTBridgeDelegate methods
302
 #pragma mark - RCTBridgeDelegate methods
349
 
303
 
350
-- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
351
-{
352
-  return self.bundleURL;
304
+- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
305
+    return self.bundleURL;
353
 }
306
 }
354
 
307
 
355
 @end
308
 @end

+ 57
- 121
ios/RCCManagerModule.m View File

51
 
51
 
52
 #pragma mark - constatnts export
52
 #pragma mark - constatnts export
53
 
53
 
54
-- (NSDictionary *)constantsToExport
55
-{
54
+- (NSDictionary *)constantsToExport {
56
     return @{
55
     return @{
57
              //Error codes
56
              //Error codes
58
              @"RCCManagerModuleCantCreateControllerErrorCode" : @(RCCManagerModuleCantCreateControllerErrorCode),
57
              @"RCCManagerModuleCantCreateControllerErrorCode" : @(RCCManagerModuleCantCreateControllerErrorCode),
69
              };
68
              };
70
 }
69
 }
71
 
70
 
72
-- (dispatch_queue_t)methodQueue
73
-{
71
+- (dispatch_queue_t)methodQueue {
74
     return dispatch_get_main_queue();
72
     return dispatch_get_main_queue();
75
 }
73
 }
76
 
74
 
77
-+ (BOOL)requiresMainQueueSetup
78
-{
75
++ (BOOL)requiresMainQueueSetup {
79
     return YES;
76
     return YES;
80
 }
77
 }
81
 
78
 
82
 #pragma mark - helper methods
79
 #pragma mark - helper methods
83
 
80
 
84
-+(UIViewController*)modalPresenterViewControllers:(NSMutableArray*)returnAllPresenters
85
-{
81
++(UIViewController*)modalPresenterViewControllers:(NSMutableArray*)returnAllPresenters {
86
     UIViewController *modalPresenterViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
82
     UIViewController *modalPresenterViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
87
-    if ((returnAllPresenters != nil) && (modalPresenterViewController != nil))
88
-    {
83
+    if ((returnAllPresenters != nil) && (modalPresenterViewController != nil)) {
89
         [returnAllPresenters addObject:modalPresenterViewController];
84
         [returnAllPresenters addObject:modalPresenterViewController];
90
     }
85
     }
91
     
86
     
92
-    while (modalPresenterViewController.presentedViewController != nil)
93
-    {
87
+    while (modalPresenterViewController.presentedViewController != nil) {
94
         modalPresenterViewController = modalPresenterViewController.presentedViewController;
88
         modalPresenterViewController = modalPresenterViewController.presentedViewController;
95
         
89
         
96
-        if (returnAllPresenters != nil)
97
-        {
90
+        if (returnAllPresenters != nil) {
98
             [returnAllPresenters addObject:modalPresenterViewController];
91
             [returnAllPresenters addObject:modalPresenterViewController];
99
         }
92
         }
100
     }
93
     }
101
     return modalPresenterViewController;
94
     return modalPresenterViewController;
102
 }
95
 }
103
 
96
 
104
-+(UIViewController*)lastModalPresenterViewController
105
-{
97
++(UIViewController*)lastModalPresenterViewController {
106
     return [self modalPresenterViewControllers:nil];
98
     return [self modalPresenterViewControllers:nil];
107
 }
99
 }
108
 
100
 
109
-+(NSError*)rccErrorWithCode:(NSInteger)code description:(NSString*)description
110
-{
101
++(NSError*)rccErrorWithCode:(NSInteger)code description:(NSString*)description {
111
     NSString *safeDescription = (description == nil) ? @"" : description;
102
     NSString *safeDescription = (description == nil) ? @"" : description;
112
     return [NSError errorWithDomain:@"RCCControllers" code:code userInfo:@{NSLocalizedDescriptionKey: safeDescription}];
103
     return [NSError errorWithDomain:@"RCCControllers" code:code userInfo:@{NSLocalizedDescriptionKey: safeDescription}];
113
 }
104
 }
114
 
105
 
115
-+(void)handleRCTPromiseRejectBlock:(RCTPromiseRejectBlock)reject error:(NSError*)error
116
-{
106
++(void)handleRCTPromiseRejectBlock:(RCTPromiseRejectBlock)reject error:(NSError*)error {
117
     reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
107
     reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
118
 }
108
 }
119
 
109
 
120
-+(void)cancelAllRCCViewControllerReactTouches
121
-{
110
++(void)cancelAllRCCViewControllerReactTouches {
122
     [[NSNotificationCenter defaultCenter] postNotificationName:RCCViewControllerCancelReactTouchesNotification object:nil];
111
     [[NSNotificationCenter defaultCenter] postNotificationName:RCCViewControllerCancelReactTouchesNotification object:nil];
123
 }
112
 }
124
 
113
 
125
--(void)animateSnapshot:(UIView*)snapshot animationType:(NSString*)animationType resolver:(RCTPromiseResolveBlock)resolve
126
-{
114
+-(void)animateSnapshot:(UIView*)snapshot animationType:(NSString*)animationType resolver:(RCTPromiseResolveBlock)resolve {
127
     [UIView animateWithDuration:kSlideDownAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^()
115
     [UIView animateWithDuration:kSlideDownAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^()
128
      {
116
      {
129
          if (animationType == nil || [animationType isEqualToString:@"slide-down"])
117
          if (animationType == nil || [animationType isEqualToString:@"slide-down"])
146
      }];
134
      }];
147
 }
135
 }
148
 
136
 
149
--(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers resolver:(RCTPromiseResolveBlock)resolve
150
-{
137
+-(void)dismissAllModalPresenters:(NSMutableArray*)allPresentedViewControllers resolver:(RCTPromiseResolveBlock)resolve {
151
     UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
138
     UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
152
     
139
     
153
     if (allPresentedViewControllers.count > 0)
140
     if (allPresentedViewControllers.count > 0)
160
                                counter++;
147
                                counter++;
161
                                
148
                                
162
                                
149
                                
163
-                               if (viewController.presentedViewController != nil)
164
-                               {
150
+                               if (viewController.presentedViewController != nil) {
165
                                    dispatch_semaphore_t dismiss_sema = dispatch_semaphore_create(0);
151
                                    dispatch_semaphore_t dismiss_sema = dispatch_semaphore_create(0);
166
                                    
152
                                    
167
                                    dispatch_async(dispatch_get_main_queue(), ^
153
                                    dispatch_async(dispatch_get_main_queue(), ^
172
                                                                [[RCCManager sharedIntance] unregisterController:viewController];
158
                                                                [[RCCManager sharedIntance] unregisterController:viewController];
173
                                                            }
159
                                                            }
174
                                                            
160
                                                            
175
-                                                           if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0)
176
-                                                           {
161
+                                                           if (counter == allPresentedViewControllers.count && allPresentedViewControllers.count > 0) {
177
                                                                [allPresentedViewControllers removeAllObjects];
162
                                                                [allPresentedViewControllers removeAllObjects];
178
                                                                
163
                                                                
179
-                                                               if (resolve != nil)
180
-                                                               {
164
+                                                               if (resolve != nil) {
181
                                                                    resolve(nil);
165
                                                                    resolve(nil);
182
                                                                }
166
                                                                }
183
                                                            }
167
                                                            }
191
                                {
175
                                {
192
                                    [allPresentedViewControllers removeAllObjects];
176
                                    [allPresentedViewControllers removeAllObjects];
193
                                    
177
                                    
194
-                                   if (resolve != nil)
195
-                                   {
178
+                                   if (resolve != nil) {
196
                                        dispatch_async(dispatch_get_main_queue(), ^
179
                                        dispatch_async(dispatch_get_main_queue(), ^
197
                                                       {
180
                                                       {
198
                                                           resolve(nil);
181
                                                           resolve(nil);
201
                                }
184
                                }
202
                            }
185
                            }
203
                        });
186
                        });
204
-    }
205
-    else if (resolve != nil)
206
-    {
187
+    } else if (resolve != nil) {
207
         resolve(nil);
188
         resolve(nil);
208
     }
189
     }
209
 }
190
 }
211
 #pragma mark - RCT exported methods
192
 #pragma mark - RCT exported methods
212
 
193
 
213
 RCT_EXPORT_METHOD(
194
 RCT_EXPORT_METHOD(
214
-                  setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
215
-{
195
+                  setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
216
     if ([[RCCManager sharedInstance] getBridge].loading) {
196
     if ([[RCCManager sharedInstance] getBridge].loading) {
217
         [self deferSetRootControllerWhileBridgeLoading:layout animationType:animationType globalProps:globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject];
197
         [self deferSetRootControllerWhileBridgeLoading:layout animationType:animationType globalProps:globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject];
218
         return;
198
         return;
227
 /**
207
 /**
228
  * on RN31 there's a timing issue, we must wait for the bridge to finish loading
208
  * on RN31 there's a timing issue, we must wait for the bridge to finish loading
229
  */
209
  */
230
--(void)deferSetRootControllerWhileBridgeLoading:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
231
-{
210
+-(void)deferSetRootControllerWhileBridgeLoading:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject {
232
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0001 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
211
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0001 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
233
         [self setRootController:layout animationType:animationType globalProps:globalProps resolver:resolve rejecter:reject];
212
         [self setRootController:layout animationType:animationType globalProps:globalProps resolver:resolve rejecter:reject];
234
     });
213
     });
235
 }
214
 }
236
 
215
 
237
--(void)performSetRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps
238
-{
216
+-(void)performSetRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps {
239
     
217
     
240
     NSMutableDictionary *modifiedGloablProps = [globalProps mutableCopy];
218
     NSMutableDictionary *modifiedGloablProps = [globalProps mutableCopy];
241
     modifiedGloablProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_INITIAL_SCREEN;
219
     modifiedGloablProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_INITIAL_SCREEN;
247
     NSDictionary *appStyle = layout[@"props"][@"appStyle"];
225
     NSDictionary *appStyle = layout[@"props"][@"appStyle"];
248
     if (appStyle) {
226
     if (appStyle) {
249
         [[RCCManager sharedIntance] setAppStyle:appStyle];
227
         [[RCCManager sharedIntance] setAppStyle:appStyle];
250
-		
251
-		if([appStyle[@"autoAdjustScrollViewInsets"] boolValue] == YES)
252
-		{
253
-			[RNNSwizzles applySwizzles];
254
-		}
228
+        
229
+        if([appStyle[@"autoAdjustScrollViewInsets"] boolValue] == YES) {
230
+            [RNNSwizzles applySwizzles];
231
+        }
255
     }
232
     }
256
     
233
     
257
     // create the new controller
234
     // create the new controller
264
     // if we're animating - add a snapshot now
241
     // if we're animating - add a snapshot now
265
     UIViewController *presentedViewController = nil;
242
     UIViewController *presentedViewController = nil;
266
     UIView *snapshot = nil;
243
     UIView *snapshot = nil;
267
-    if (animated)
268
-    {
244
+    if (animated) {
269
         if(appDelegate.window.rootViewController.presentedViewController != nil)
245
         if(appDelegate.window.rootViewController.presentedViewController != nil)
270
             presentedViewController = appDelegate.window.rootViewController.presentedViewController;
246
             presentedViewController = appDelegate.window.rootViewController.presentedViewController;
271
         else
247
         else
283
          [appDelegate.window makeKeyAndVisible];
259
          [appDelegate.window makeKeyAndVisible];
284
          [presentedViewController dismissViewControllerAnimated:NO completion:nil];
260
          [presentedViewController dismissViewControllerAnimated:NO completion:nil];
285
          
261
          
286
-         if (animated)
287
-         {
262
+         if (animated) {
288
              // move the snaphot to the new root and animate it
263
              // move the snaphot to the new root and animate it
289
              [appDelegate.window.rootViewController.view addSubview:snapshot];
264
              [appDelegate.window.rootViewController.view addSubview:snapshot];
290
              [self animateSnapshot:snapshot animationType:animationType resolver:nil];
265
              [self animateSnapshot:snapshot animationType:animationType resolver:nil];
293
 }
268
 }
294
 
269
 
295
 RCT_EXPORT_METHOD(
270
 RCT_EXPORT_METHOD(
296
-                  NavigationControllerIOS:(NSString*)controllerId performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams)
297
-{
271
+                  NavigationControllerIOS:(NSString*)controllerId performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams) {
298
     if (!controllerId || !performAction) return;
272
     if (!controllerId || !performAction) return;
299
     RCCNavigationController* controller = [[RCCManager sharedInstance] getControllerWithId:controllerId componentType:@"NavigationControllerIOS"];
273
     RCCNavigationController* controller = [[RCCManager sharedInstance] getControllerWithId:controllerId componentType:@"NavigationControllerIOS"];
300
     if (!controller || ![controller isKindOfClass:[RCCNavigationController class]]) return;
274
     if (!controller || ![controller isKindOfClass:[RCCNavigationController class]]) return;
302
 }
276
 }
303
 
277
 
304
 RCT_EXPORT_METHOD(
278
 RCT_EXPORT_METHOD(
305
-                  DrawerControllerIOS:(NSString*)controllerId performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams)
306
-{
279
+                  DrawerControllerIOS:(NSString*)controllerId performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams) {
307
     if (!controllerId || !performAction) return;
280
     if (!controllerId || !performAction) return;
308
     
281
     
309
     id<RCCDrawerDelegate> controller = [[RCCManager sharedIntance] getControllerWithId:controllerId componentType:@"DrawerControllerIOS"];
282
     id<RCCDrawerDelegate> controller = [[RCCManager sharedIntance] getControllerWithId:controllerId componentType:@"DrawerControllerIOS"];
313
 }
286
 }
314
 
287
 
315
 RCT_EXPORT_METHOD(
288
 RCT_EXPORT_METHOD(
316
-                  TabBarControllerIOS:(NSString*)controllerId performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
317
-{
318
-    if (!controllerId || !performAction)
319
-    {
289
+                  TabBarControllerIOS:(NSString*)controllerId performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
290
+    if (!controllerId || !performAction) {
320
         [RCCManagerModule handleRCTPromiseRejectBlock:reject
291
         [RCCManagerModule handleRCTPromiseRejectBlock:reject
321
                                                 error:[RCCManagerModule rccErrorWithCode:RCCManagerModuleMissingParamsErrorCode description:@"missing params"]];
292
                                                 error:[RCCManagerModule rccErrorWithCode:RCCManagerModuleMissingParamsErrorCode description:@"missing params"]];
322
         return;
293
         return;
323
     }
294
     }
324
     
295
     
325
     RCCTabBarController* controller = [[RCCManager sharedInstance] getControllerWithId:controllerId componentType:@"TabBarControllerIOS"];
296
     RCCTabBarController* controller = [[RCCManager sharedInstance] getControllerWithId:controllerId componentType:@"TabBarControllerIOS"];
326
-    if (!controller || ![controller isKindOfClass:[RCCTabBarController class]])
327
-    {
297
+    if (!controller || ![controller isKindOfClass:[RCCTabBarController class]]) {
328
         [RCCManagerModule handleRCTPromiseRejectBlock:reject
298
         [RCCManagerModule handleRCTPromiseRejectBlock:reject
329
                                                 error:[RCCManagerModule rccErrorWithCode:RCCManagerModuleCantFindTabControllerErrorCode description:@"could not find UITabBarController"]];
299
                                                 error:[RCCManagerModule rccErrorWithCode:RCCManagerModuleCantFindTabControllerErrorCode description:@"could not find UITabBarController"]];
330
         return;
300
         return;
333
 }
303
 }
334
 
304
 
335
 RCT_EXPORT_METHOD(
305
 RCT_EXPORT_METHOD(
336
-                  modalShowLightBox:(NSDictionary*)params)
337
-{
306
+                  modalShowLightBox:(NSDictionary*)params) {
338
     [RCCLightBox showWithParams:params];
307
     [RCCLightBox showWithParams:params];
339
 }
308
 }
340
 
309
 
341
 RCT_EXPORT_METHOD(
310
 RCT_EXPORT_METHOD(
342
-                  modalDismissLightBox)
343
-{
311
+                  modalDismissLightBox) {
344
     [RCCLightBox dismiss];
312
     [RCCLightBox dismiss];
345
 }
313
 }
346
 
314
 
347
 RCT_EXPORT_METHOD(
315
 RCT_EXPORT_METHOD(
348
-                  showController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
349
-{
350
-
316
+                  showController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
317
+    
351
     NSMutableDictionary *modifiedGlobalProps = [globalProps mutableCopy];
318
     NSMutableDictionary *modifiedGlobalProps = [globalProps mutableCopy];
352
     modifiedGlobalProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_SHOW_MODAL;
319
     modifiedGlobalProps[GLOBAL_SCREEN_ACTION_COMMAND_TYPE] = COMMAND_TYPE_SHOW_MODAL;
353
     
320
     
354
     UIViewController *controller = [RCCViewController controllerWithLayout:layout globalProps:modifiedGlobalProps bridge:[[RCCManager sharedInstance] getBridge]];
321
     UIViewController *controller = [RCCViewController controllerWithLayout:layout globalProps:modifiedGlobalProps bridge:[[RCCManager sharedInstance] getBridge]];
355
-    if (controller == nil)
356
-    {
322
+    if (controller == nil) {
357
         [RCCManagerModule handleRCTPromiseRejectBlock:reject
323
         [RCCManagerModule handleRCTPromiseRejectBlock:reject
358
                                                 error:[RCCManagerModule rccErrorWithCode:RCCManagerModuleCantCreateControllerErrorCode description:@"could not create controller"]];
324
                                                 error:[RCCManagerModule rccErrorWithCode:RCCManagerModuleCantCreateControllerErrorCode description:@"could not create controller"]];
359
         return;
325
         return;
375
                                                                     completion:^(){ resolve(nil); }];
341
                                                                     completion:^(){ resolve(nil); }];
376
 }
342
 }
377
 
343
 
378
-- (UIViewController *) getVisibleViewControllerFor:(UIViewController *)vc
379
-{
380
-    if ([vc isKindOfClass:[UINavigationController class]])
381
-    {
344
+- (UIViewController *) getVisibleViewControllerFor:(UIViewController *)vc {
345
+    if ([vc isKindOfClass:[UINavigationController class]]) {
382
         return [self getVisibleViewControllerFor:[((UINavigationController*)vc) visibleViewController]];
346
         return [self getVisibleViewControllerFor:[((UINavigationController*)vc) visibleViewController]];
383
-    }
384
-    else if ([vc isKindOfClass:[UITabBarController class]])
385
-    {
347
+    } else if ([vc isKindOfClass:[UITabBarController class]]) {
386
         return [self getVisibleViewControllerFor:[((UITabBarController*)vc) selectedViewController]];
348
         return [self getVisibleViewControllerFor:[((UITabBarController*)vc) selectedViewController]];
387
-    }
388
-    else if (vc.presentedViewController)
389
-    {
349
+    } else if (vc.presentedViewController) {
390
         return [self getVisibleViewControllerFor:vc.presentedViewController];
350
         return [self getVisibleViewControllerFor:vc.presentedViewController];
391
-    }
392
-    else if ([vc isKindOfClass:[TheSidebarController class]]) {
351
+    } else if ([vc isKindOfClass:[TheSidebarController class]]) {
393
         TheSidebarController *drawerController = (TheSidebarController*) vc;
352
         TheSidebarController *drawerController = (TheSidebarController*) vc;
394
         return [self getVisibleViewControllerFor:drawerController.contentViewController];
353
         return [self getVisibleViewControllerFor:drawerController.contentViewController];
395
-    }
396
-    else if ([vc isKindOfClass:[MMDrawerController class]]) {
354
+    } else if ([vc isKindOfClass:[MMDrawerController class]]) {
397
         MMDrawerController *drawerController = (MMDrawerController*) vc;
355
         MMDrawerController *drawerController = (MMDrawerController*) vc;
398
         return [self getVisibleViewControllerFor:drawerController.centerViewController];
356
         return [self getVisibleViewControllerFor:drawerController.centerViewController];
399
-    }
400
-    else
401
-    {
357
+    } else {
402
         return vc;
358
         return vc;
403
     }
359
     }
404
 }
360
 }
405
 
361
 
406
-RCT_EXPORT_METHOD(getCurrentlyVisibleScreenId:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
407
-{
362
+RCT_EXPORT_METHOD(getCurrentlyVisibleScreenId:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
408
     UIViewController *rootVC = [UIApplication sharedApplication].delegate.window.rootViewController;
363
     UIViewController *rootVC = [UIApplication sharedApplication].delegate.window.rootViewController;
409
     UIViewController *visibleVC = [self getVisibleViewControllerFor:rootVC];
364
     UIViewController *visibleVC = [self getVisibleViewControllerFor:rootVC];
410
     NSString *controllerId = [[RCCManager sharedIntance] getIdForController:visibleVC];
365
     NSString *controllerId = [[RCCManager sharedIntance] getIdForController:visibleVC];
412
     resolve(result);
367
     resolve(result);
413
 }
368
 }
414
 
369
 
415
--(BOOL)viewControllerIsModal:(UIViewController*)viewController
416
-{
370
+-(BOOL)viewControllerIsModal:(UIViewController*)viewController {
417
     BOOL viewControllerIsModal = (viewController.presentingViewController.presentedViewController == viewController)
371
     BOOL viewControllerIsModal = (viewController.presentingViewController.presentedViewController == viewController)
418
     || ((viewController.navigationController != nil) && (viewController.navigationController.presentingViewController.presentedViewController == viewController.navigationController) && (viewController == viewController.navigationController.viewControllers[0]))
372
     || ((viewController.navigationController != nil) && (viewController.navigationController.presentingViewController.presentedViewController == viewController.navigationController) && (viewController == viewController.navigationController.viewControllers[0]))
419
     || ([viewController.tabBarController.presentingViewController isKindOfClass:[UITabBarController class]]);
373
     || ([viewController.tabBarController.presentingViewController isKindOfClass:[UITabBarController class]]);
420
     return viewControllerIsModal;
374
     return viewControllerIsModal;
421
 }
375
 }
422
 
376
 
423
-RCT_EXPORT_METHOD(
424
-                  dismissController:(NSString*)animationType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
425
-{
377
+RCT_EXPORT_METHOD(dismissController:(NSString*)animationType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
426
     UIViewController* vc = [RCCManagerModule lastModalPresenterViewController];
378
     UIViewController* vc = [RCCManagerModule lastModalPresenterViewController];
427
-    if ([self viewControllerIsModal:vc])
428
-    {
379
+    if ([self viewControllerIsModal:vc]) {
429
         [[RCCManager sharedIntance] unregisterController:vc];
380
         [[RCCManager sharedIntance] unregisterController:vc];
430
         
381
         
431
         [vc dismissViewControllerAnimated:![animationType isEqualToString:@"none"]
382
         [vc dismissViewControllerAnimated:![animationType isEqualToString:@"none"]
432
                                completion:^(){ resolve(nil); }];
383
                                completion:^(){ resolve(nil); }];
433
-    }
434
-    else
435
-    {
384
+    } else {
436
         resolve(nil);
385
         resolve(nil);
437
     }
386
     }
438
 }
387
 }
439
 
388
 
440
-RCT_EXPORT_METHOD(
441
-                  dismissAllControllers:(NSString*)animationType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
442
-{
443
-    if([UIApplication sharedApplication].delegate.window.rootViewController.presentedViewController == nil)
444
-    {//if there are no modal - do nothing
389
+RCT_EXPORT_METHOD(dismissAllControllers:(NSString*)animationType resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
390
+    if([UIApplication sharedApplication].delegate.window.rootViewController.presentedViewController == nil) {//if there are no modal - do nothing
445
         resolve(nil);
391
         resolve(nil);
446
         return;
392
         return;
447
     }
393
     }
450
     [RCCManagerModule modalPresenterViewControllers:allPresentedViewControllers];
396
     [RCCManagerModule modalPresenterViewControllers:allPresentedViewControllers];
451
     
397
     
452
     BOOL animated = ![animationType isEqualToString:@"none"];
398
     BOOL animated = ![animationType isEqualToString:@"none"];
453
-    if (animated)
454
-    {
399
+    if (animated) {
455
         id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
400
         id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
456
         UIView *snapshot = [appDelegate.window snapshotViewAfterScreenUpdates:NO];
401
         UIView *snapshot = [appDelegate.window snapshotViewAfterScreenUpdates:NO];
457
         [appDelegate.window addSubview:snapshot];
402
         [appDelegate.window addSubview:snapshot];
460
          {
405
          {
461
              [self animateSnapshot:snapshot animationType:animationType resolver:resolve];
406
              [self animateSnapshot:snapshot animationType:animationType resolver:resolve];
462
          }];
407
          }];
463
-    }
464
-    else
465
-    {
408
+    } else {
466
         [self dismissAllModalPresenters:allPresentedViewControllers resolver:resolve];
409
         [self dismissAllModalPresenters:allPresentedViewControllers resolver:resolve];
467
     }
410
     }
468
 }
411
 }
469
 
412
 
470
-RCT_EXPORT_METHOD(
471
-                  showNotification:(NSDictionary*)params resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
472
-{
413
+RCT_EXPORT_METHOD(showNotification:(NSDictionary*)params resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
473
     [RCCNotification showWithParams:params resolver:resolve rejecter:reject];
414
     [RCCNotification showWithParams:params resolver:resolve rejecter:reject];
474
 }
415
 }
475
 
416
 
476
-RCT_EXPORT_METHOD(
477
-                  dismissNotification:(NSDictionary*)params resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
478
-{
417
+RCT_EXPORT_METHOD(dismissNotification:(NSDictionary*)params resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
479
     [RCCNotification dismissWithParams:params resolver:resolve rejecter:reject];
418
     [RCCNotification dismissWithParams:params resolver:resolve rejecter:reject];
480
 }
419
 }
481
 
420
 
482
-RCT_EXPORT_METHOD(
483
-                  cancelAllReactTouches)
484
-{
421
+RCT_EXPORT_METHOD(cancelAllReactTouches) {
485
     [RCCManagerModule cancelAllRCCViewControllerReactTouches];
422
     [RCCManagerModule cancelAllRCCViewControllerReactTouches];
486
 }
423
 }
487
 
424
 
488
-RCT_EXPORT_METHOD(getLaunchArgs:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
489
-{
425
+RCT_EXPORT_METHOD(getLaunchArgs:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
490
     resolve([[RCCManager sharedInstance] getLaunchArgs]);
426
     resolve([[RCCManager sharedInstance] getLaunchArgs]);
491
 }
427
 }
492
 
428
 

+ 316
- 356
ios/RCCTabBarController.m View File

18
 
18
 
19
 
19
 
20
 -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
20
 -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
21
-  return [self supportedControllerOrientations];
21
+    return [self supportedControllerOrientations];
22
 }
22
 }
23
 
23
 
24
 - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
24
 - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
25
-  id queue = [[RCCManager sharedInstance].getBridge uiManager].methodQueue;
26
-  dispatch_async(queue, ^{
27
-    [[[RCCManager sharedInstance].getBridge uiManager] configureNextLayoutAnimation:nil withCallback:^(NSArray* arr){} errorCallback:^(NSArray* arr){}];
28
-  });
29
-  
30
-  if (tabBarController.selectedIndex != [tabBarController.viewControllers indexOfObject:viewController]) {
31
-    NSDictionary *body = @{
32
-                           @"selectedTabIndex": @([tabBarController.viewControllers indexOfObject:viewController]),
33
-                           @"unselectedTabIndex": @(tabBarController.selectedIndex)
34
-                           };
35
-    [RCCTabBarController sendScreenTabChangedEvent:viewController body:body];
25
+    id queue = [[RCCManager sharedInstance].getBridge uiManager].methodQueue;
26
+    dispatch_async(queue, ^{
27
+        [[[RCCManager sharedInstance].getBridge uiManager] configureNextLayoutAnimation:nil withCallback:^(NSArray* arr){} errorCallback:^(NSArray* arr){}];
28
+    });
36
     
29
     
37
-    [[[RCCManager sharedInstance] getBridge].eventDispatcher sendAppEventWithName:@"bottomTabSelected" body:body];
38
-    if ([viewController isKindOfClass:[UINavigationController class]]) {
39
-      UINavigationController *navigationController = (UINavigationController*)viewController;
40
-      UIViewController *topViewController = navigationController.topViewController;
41
-      
42
-      if ([topViewController isKindOfClass:[RCCViewController class]]) {
43
-        RCCViewController *topRCCViewController = (RCCViewController*)topViewController;
44
-        topRCCViewController.commandType = COMMAND_TYPE_BOTTOME_TAB_SELECTED;
45
-        topRCCViewController.timestamp = [RCTHelpers getTimestampString];
46
-      }
30
+    if (tabBarController.selectedIndex != [tabBarController.viewControllers indexOfObject:viewController]) {
31
+        NSDictionary *body = @{
32
+                               @"selectedTabIndex": @([tabBarController.viewControllers indexOfObject:viewController]),
33
+                               @"unselectedTabIndex": @(tabBarController.selectedIndex)
34
+                               };
35
+        [RCCTabBarController sendScreenTabChangedEvent:viewController body:body];
36
+        
37
+        [[[RCCManager sharedInstance] getBridge].eventDispatcher sendAppEventWithName:@"bottomTabSelected" body:body];
38
+        if ([viewController isKindOfClass:[UINavigationController class]]) {
39
+            UINavigationController *navigationController = (UINavigationController*)viewController;
40
+            UIViewController *topViewController = navigationController.topViewController;
41
+            
42
+            if ([topViewController isKindOfClass:[RCCViewController class]]) {
43
+                RCCViewController *topRCCViewController = (RCCViewController*)topViewController;
44
+                topRCCViewController.commandType = COMMAND_TYPE_BOTTOME_TAB_SELECTED;
45
+                topRCCViewController.timestamp = [RCTHelpers getTimestampString];
46
+            }
47
+        }
48
+        
49
+    } else {
50
+        [RCCTabBarController sendScreenTabPressedEvent:viewController body:nil];
47
     }
51
     }
48
     
52
     
49
-  } else {
50
-    [RCCTabBarController sendScreenTabPressedEvent:viewController body:nil];
51
-  }
52
-  
53
-  
54
-  
55
-  return YES;
53
+    
54
+    
55
+    return YES;
56
 }
56
 }
57
 
57
 
58
-- (UIImage *)image:(UIImage*)image withColor:(UIColor *)color1
59
-{
60
-  UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
61
-  CGContextRef context = UIGraphicsGetCurrentContext();
62
-  CGContextTranslateCTM(context, 0, image.size.height);
63
-  CGContextScaleCTM(context, 1.0, -1.0);
64
-  CGContextSetBlendMode(context, kCGBlendModeNormal);
65
-  CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
66
-  CGContextClipToMask(context, rect, image.CGImage);
67
-  [color1 setFill];
68
-  CGContextFillRect(context, rect);
69
-  UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
70
-  UIGraphicsEndImageContext();
71
-  return newImage;
58
+- (UIImage *)image:(UIImage*)image withColor:(UIColor *)color1 {
59
+    UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
60
+    CGContextRef context = UIGraphicsGetCurrentContext();
61
+    CGContextTranslateCTM(context, 0, image.size.height);
62
+    CGContextScaleCTM(context, 1.0, -1.0);
63
+    CGContextSetBlendMode(context, kCGBlendModeNormal);
64
+    CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
65
+    CGContextClipToMask(context, rect, image.CGImage);
66
+    [color1 setFill];
67
+    CGContextFillRect(context, rect);
68
+    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
69
+    UIGraphicsEndImageContext();
70
+    return newImage;
72
 }
71
 }
73
 
72
 
74
-- (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children globalProps:(NSDictionary*)globalProps bridge:(RCTBridge *)bridge
75
-{
76
-  self = [super init];
77
-  if (!self) return nil;
78
-  
79
-  self.delegate = self;
80
-  
81
-  self.tabBar.translucent = YES; // default
82
-  
83
-  UIColor *buttonColor = nil;
84
-  UIColor *selectedButtonColor = nil;
85
-  UIColor *labelColor = nil;
86
-  UIColor *selectedLabelColor = nil;
87
-  NSDictionary *tabsStyle = props[@"style"];
88
-  if (tabsStyle)
89
-  {
90
-    NSString *tabBarButtonColor = tabsStyle[@"tabBarButtonColor"];
91
-    if (tabBarButtonColor)
92
-    {
93
-      UIColor *color = tabBarButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarButtonColor] : nil;
94
-      self.tabBar.tintColor = color;
95
-      buttonColor = color;
96
-      selectedButtonColor = color;
97
-    }
98
-    NSString *tabBarSelectedButtonColor = tabsStyle[@"tabBarSelectedButtonColor"];
99
-    if (tabBarSelectedButtonColor)
100
-    {
101
-      UIColor *color = tabBarSelectedButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarSelectedButtonColor] : nil;
102
-      self.tabBar.tintColor = color;
103
-      selectedButtonColor = color;
104
-    }
105
-    NSString *tabBarLabelColor = tabsStyle[@"tabBarLabelColor"];
106
-    if(tabBarLabelColor) {
107
-      UIColor *color = tabBarLabelColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarLabelColor] : nil;
108
-      labelColor = color;
109
-    }
110
-    NSString *tabBarSelectedLabelColor = tabsStyle[@"tabBarSelectedLabelColor"];
111
-    if(tabBarLabelColor) {
112
-      UIColor *color = tabBarSelectedLabelColor != (id)[NSNull null] ? [RCTConvert UIColor:
113
-                                                                        tabBarSelectedLabelColor] : nil;
114
-      selectedLabelColor = color;
115
-    }
116
-    NSString *tabBarBackgroundColor = tabsStyle[@"tabBarBackgroundColor"];
117
-    if (tabBarBackgroundColor)
118
-    {
119
-      UIColor *color = tabBarBackgroundColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarBackgroundColor] : nil;
120
-      self.tabBar.barTintColor = color;
121
-    }
122
-
123
-    NSString *tabBarTranslucent = tabsStyle[@"tabBarTranslucent"];
124
-    if (tabBarTranslucent)
125
-    {
126
-      self.tabBar.translucent = [tabBarTranslucent boolValue] ? YES : NO;
127
-    }
128
-
129
-    NSString *tabBarHideShadow = tabsStyle[@"tabBarHideShadow"];
130
-    if (tabBarHideShadow)
131
-    {
132
-      self.tabBar.clipsToBounds = [tabBarHideShadow boolValue] ? YES : NO;
133
-    }
134
-  }
135
-  
136
-  NSMutableArray *viewControllers = [NSMutableArray array];
137
-  
138
-  // go over all the tab bar items
139
-  for (NSDictionary *tabItemLayout in children)
140
-  {
141
-    // make sure the layout is valid
142
-    if (![tabItemLayout[@"type"] isEqualToString:@"TabBarControllerIOS.Item"]) continue;
143
-    if (!tabItemLayout[@"props"]) continue;
73
+- (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children globalProps:(NSDictionary*)globalProps bridge:(RCTBridge *)bridge {
74
+    self = [super init];
75
+    if (!self) return nil;
144
     
76
     
145
-    // get the view controller inside
146
-    if (!tabItemLayout[@"children"]) continue;
147
-    if (![tabItemLayout[@"children"] isKindOfClass:[NSArray class]]) continue;
148
-    if ([tabItemLayout[@"children"] count] < 1) continue;
149
-    NSDictionary *childLayout = tabItemLayout[@"children"][0];
150
-    UIViewController *viewController = [RCCViewController controllerWithLayout:childLayout globalProps:globalProps bridge:bridge];
151
-    if (!viewController) continue;
77
+    self.delegate = self;
152
     
78
     
153
-    // create the tab icon and title
154
-    NSString *title = tabItemLayout[@"props"][@"title"];
155
-    UIImage *iconImage = nil;
156
-    id icon = tabItemLayout[@"props"][@"icon"];
157
-    if (icon)
158
-    {
159
-      iconImage = [RCTConvert UIImage:icon];
160
-      if (buttonColor)
161
-      {
162
-        iconImage = [[self image:iconImage withColor:buttonColor] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
163
-      }
164
-    }
165
-    UIImage *iconImageSelected = nil;
166
-    id selectedIcon = tabItemLayout[@"props"][@"selectedIcon"];
167
-    if (selectedIcon) {
168
-      iconImageSelected = [RCTConvert UIImage:selectedIcon];
169
-    } else {
170
-      iconImageSelected = [RCTConvert UIImage:icon];
79
+    self.tabBar.translucent = YES; // default
80
+    
81
+    UIColor *buttonColor = nil;
82
+    UIColor *selectedButtonColor = nil;
83
+    UIColor *labelColor = nil;
84
+    UIColor *selectedLabelColor = nil;
85
+    NSDictionary *tabsStyle = props[@"style"];
86
+    if (tabsStyle) {
87
+        NSString *tabBarButtonColor = tabsStyle[@"tabBarButtonColor"];
88
+        if (tabBarButtonColor) {
89
+            UIColor *color = tabBarButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarButtonColor] : nil;
90
+            self.tabBar.tintColor = color;
91
+            buttonColor = color;
92
+            selectedButtonColor = color;
93
+        }
94
+        NSString *tabBarSelectedButtonColor = tabsStyle[@"tabBarSelectedButtonColor"];
95
+        if (tabBarSelectedButtonColor) {
96
+            UIColor *color = tabBarSelectedButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarSelectedButtonColor] : nil;
97
+            self.tabBar.tintColor = color;
98
+            selectedButtonColor = color;
99
+        }
100
+        NSString *tabBarLabelColor = tabsStyle[@"tabBarLabelColor"];
101
+        if (tabBarLabelColor) {
102
+            UIColor *color = tabBarLabelColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarLabelColor] : nil;
103
+            labelColor = color;
104
+        }
105
+        NSString *tabBarSelectedLabelColor = tabsStyle[@"tabBarSelectedLabelColor"];
106
+        if (tabBarLabelColor) {
107
+            UIColor *color = tabBarSelectedLabelColor != (id)[NSNull null] ? [RCTConvert UIColor:
108
+                                                                              tabBarSelectedLabelColor] : nil;
109
+            selectedLabelColor = color;
110
+        }
111
+        NSString *tabBarBackgroundColor = tabsStyle[@"tabBarBackgroundColor"];
112
+        if (tabBarBackgroundColor) {
113
+            UIColor *color = tabBarBackgroundColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarBackgroundColor] : nil;
114
+            self.tabBar.barTintColor = color;
115
+        }
116
+        
117
+        NSString *tabBarTranslucent = tabsStyle[@"tabBarTranslucent"];
118
+        if (tabBarTranslucent) {
119
+            self.tabBar.translucent = [tabBarTranslucent boolValue] ? YES : NO;
120
+        }
121
+        
122
+        NSString *tabBarHideShadow = tabsStyle[@"tabBarHideShadow"];
123
+        if (tabBarHideShadow) {
124
+            self.tabBar.clipsToBounds = [tabBarHideShadow boolValue] ? YES : NO;
125
+        }
171
     }
126
     }
172
     
127
     
173
-    viewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:title image:iconImage tag:0];
174
-    viewController.tabBarItem.accessibilityIdentifier = tabItemLayout[@"props"][@"testID"];
175
-    viewController.tabBarItem.selectedImage = iconImageSelected;
128
+    NSMutableArray *viewControllers = [NSMutableArray array];
176
     
129
     
177
-    id imageInsets = tabItemLayout[@"props"][@"iconInsets"];
178
-    if (imageInsets && imageInsets != (id)[NSNull null])
179
-    {
180
-      id topInset = imageInsets[@"top"];
181
-      id leftInset = imageInsets[@"left"];
182
-      id bottomInset = imageInsets[@"bottom"];
183
-      id rightInset = imageInsets[@"right"];
184
-      
185
-      CGFloat top = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:topInset] : 0;
186
-      CGFloat left = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:leftInset] : 0;
187
-      CGFloat bottom = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:bottomInset] : 0;
188
-      CGFloat right = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:rightInset] : 0;
189
-      
190
-      viewController.tabBarItem.imageInsets = UIEdgeInsetsMake(top, left, bottom, right);
191
-    }
192
-    NSMutableDictionary *unselectedAttributes = [RCTHelpers textAttributesFromDictionary:tabsStyle withPrefix:@"tabBarText" baseFont:[UIFont systemFontOfSize:10]];
193
-    if (!unselectedAttributes[NSForegroundColorAttributeName] && labelColor) {
194
-      unselectedAttributes[NSForegroundColorAttributeName] = labelColor;
130
+    // go over all the tab bar items
131
+    for (NSDictionary *tabItemLayout in children) {
132
+        // make sure the layout is valid
133
+        if (![tabItemLayout[@"type"] isEqualToString:@"TabBarControllerIOS.Item"]) continue;
134
+        if (!tabItemLayout[@"props"]) continue;
135
+        
136
+        // get the view controller inside
137
+        if (!tabItemLayout[@"children"]) continue;
138
+        if (![tabItemLayout[@"children"] isKindOfClass:[NSArray class]]) continue;
139
+        if ([tabItemLayout[@"children"] count] < 1) continue;
140
+        NSDictionary *childLayout = tabItemLayout[@"children"][0];
141
+        UIViewController *viewController = [RCCViewController controllerWithLayout:childLayout globalProps:globalProps bridge:bridge];
142
+        if (!viewController) continue;
143
+        
144
+        // create the tab icon and title
145
+        NSString *title = tabItemLayout[@"props"][@"title"];
146
+        UIImage *iconImage = nil;
147
+        id icon = tabItemLayout[@"props"][@"icon"];
148
+        if (icon) {
149
+            iconImage = [RCTConvert UIImage:icon];
150
+            if (buttonColor) {
151
+                iconImage = [[self image:iconImage withColor:buttonColor] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
152
+            }
153
+        }
154
+        UIImage *iconImageSelected = nil;
155
+        id selectedIcon = tabItemLayout[@"props"][@"selectedIcon"];
156
+        if (selectedIcon) {
157
+            iconImageSelected = [RCTConvert UIImage:selectedIcon];
158
+        } else {
159
+            iconImageSelected = [RCTConvert UIImage:icon];
160
+        }
161
+        
162
+        viewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:title image:iconImage tag:0];
163
+        viewController.tabBarItem.accessibilityIdentifier = tabItemLayout[@"props"][@"testID"];
164
+        viewController.tabBarItem.selectedImage = iconImageSelected;
165
+        
166
+        id imageInsets = tabItemLayout[@"props"][@"iconInsets"];
167
+        if (imageInsets && imageInsets != (id)[NSNull null]) {
168
+            id topInset = imageInsets[@"top"];
169
+            id leftInset = imageInsets[@"left"];
170
+            id bottomInset = imageInsets[@"bottom"];
171
+            id rightInset = imageInsets[@"right"];
172
+            
173
+            CGFloat top = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:topInset] : 0;
174
+            CGFloat left = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:leftInset] : 0;
175
+            CGFloat bottom = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:bottomInset] : 0;
176
+            CGFloat right = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:rightInset] : 0;
177
+            
178
+            viewController.tabBarItem.imageInsets = UIEdgeInsetsMake(top, left, bottom, right);
179
+        }
180
+        NSMutableDictionary *unselectedAttributes = [RCTHelpers textAttributesFromDictionary:tabsStyle withPrefix:@"tabBarText" baseFont:[UIFont systemFontOfSize:10]];
181
+        if (!unselectedAttributes[NSForegroundColorAttributeName] && labelColor) {
182
+            unselectedAttributes[NSForegroundColorAttributeName] = labelColor;
183
+        }
184
+        
185
+        [viewController.tabBarItem setTitleTextAttributes:unselectedAttributes forState:UIControlStateNormal];
186
+        
187
+        NSMutableDictionary *selectedAttributes = [RCTHelpers textAttributesFromDictionary:tabsStyle withPrefix:@"tabBarSelectedText" baseFont:[UIFont systemFontOfSize:10]];
188
+        if (!selectedAttributes[NSForegroundColorAttributeName] && selectedLabelColor) {
189
+            selectedAttributes[NSForegroundColorAttributeName] = selectedLabelColor;
190
+        }
191
+        
192
+        [viewController.tabBarItem setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
193
+        // create badge
194
+        NSObject *badge = tabItemLayout[@"props"][@"badge"];
195
+        if (badge == nil || [badge isEqual:[NSNull null]]) {
196
+            viewController.tabBarItem.badgeValue = nil;
197
+        } else {
198
+            viewController.tabBarItem.badgeValue = [NSString stringWithFormat:@"%@", badge];
199
+        }
200
+        
201
+        [viewControllers addObject:viewController];
195
     }
202
     }
196
     
203
     
197
-    [viewController.tabBarItem setTitleTextAttributes:unselectedAttributes forState:UIControlStateNormal];
204
+    // replace the tabs
205
+    self.viewControllers = viewControllers;
198
     
206
     
199
-    NSMutableDictionary *selectedAttributes = [RCTHelpers textAttributesFromDictionary:tabsStyle withPrefix:@"tabBarSelectedText" baseFont:[UIFont systemFontOfSize:10]];
200
-    if (!selectedAttributes[NSForegroundColorAttributeName] && selectedLabelColor) {
201
-      selectedAttributes[NSForegroundColorAttributeName] = selectedLabelColor;
207
+    NSNumber *initialTab = tabsStyle[@"initialTabIndex"];
208
+    if (initialTab) {
209
+        NSInteger initialTabIndex = initialTab.integerValue;
210
+        [self setSelectedIndex:initialTabIndex];
202
     }
211
     }
203
     
212
     
204
-    [viewController.tabBarItem setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
205
-    // create badge
206
-    NSObject *badge = tabItemLayout[@"props"][@"badge"];
207
-    if (badge == nil || [badge isEqual:[NSNull null]])
208
-    {
209
-      viewController.tabBarItem.badgeValue = nil;
210
-    }
211
-    else
212
-    {
213
-      viewController.tabBarItem.badgeValue = [NSString stringWithFormat:@"%@", badge];
214
-    }
213
+    [self setRotation:props];
215
     
214
     
216
-    [viewControllers addObject:viewController];
217
-  }
218
-  
219
-  // replace the tabs
220
-  self.viewControllers = viewControllers;
221
-
222
-  NSNumber *initialTab = tabsStyle[@"initialTabIndex"];
223
-  if (initialTab)
224
-  {
225
-    NSInteger initialTabIndex = initialTab.integerValue;
226
-    [self setSelectedIndex:initialTabIndex];
227
-  }
228
-  
229
-  [self setRotation:props];
230
-  
231
-  return self;
215
+    return self;
232
 }
216
 }
233
 
217
 
234
-- (void)performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams bridge:(RCTBridge *)bridge completion:(void (^)(void))completion
235
-{
236
-  if ([performAction isEqualToString:@"setBadge"])
237
-  {
238
-    UIViewController *viewController = nil;
239
-    NSNumber *tabIndex = actionParams[@"tabIndex"];
240
-    if (tabIndex)
241
-    {
242
-      int i = (int)[tabIndex integerValue];
243
-      
244
-      if ([self.viewControllers count] > i)
245
-      {
246
-        viewController = [self.viewControllers objectAtIndex:i];
247
-      }
248
-    }
249
-    NSString *contentId = actionParams[@"contentId"];
250
-    NSString *contentType = actionParams[@"contentType"];
251
-    if (contentId && contentType)
252
-    {
253
-      viewController = [[RCCManager sharedInstance] getControllerWithId:contentId componentType:contentType];
218
+- (void)performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams bridge:(RCTBridge *)bridge completion:(void (^)(void))completion {
219
+    if ([performAction isEqualToString:@"setBadge"]) {
220
+        UIViewController *viewController = nil;
221
+        NSNumber *tabIndex = actionParams[@"tabIndex"];
222
+        if (tabIndex) {
223
+            int i = (int)[tabIndex integerValue];
224
+            
225
+            if ([self.viewControllers count] > i) {
226
+                viewController = [self.viewControllers objectAtIndex:i];
227
+            }
228
+        }
229
+        NSString *contentId = actionParams[@"contentId"];
230
+        NSString *contentType = actionParams[@"contentType"];
231
+        if (contentId && contentType) {
232
+            viewController = [[RCCManager sharedInstance] getControllerWithId:contentId componentType:contentType];
233
+        }
234
+        
235
+        if (viewController) {
236
+            NSObject *badge = actionParams[@"badge"];
237
+            
238
+            if (badge == nil || [badge isEqual:[NSNull null]]) {
239
+                viewController.tabBarItem.badgeValue = nil;
240
+            }
241
+            else
242
+            {
243
+                NSString *badgeColor = actionParams[@"badgeColor"];
244
+                UIColor *color = badgeColor != (id)[NSNull null] ? [RCTConvert UIColor:badgeColor] : nil;
245
+                
246
+                if ([viewController.tabBarItem respondsToSelector:@selector(badgeColor)]) {
247
+                    viewController.tabBarItem.badgeColor = color;
248
+                }
249
+                viewController.tabBarItem.badgeValue = [NSString stringWithFormat:@"%@", badge];
250
+            }
251
+        }
254
     }
252
     }
255
     
253
     
256
-    if (viewController)
257
-    {
258
-      NSObject *badge = actionParams[@"badge"];
259
-      
260
-      if (badge == nil || [badge isEqual:[NSNull null]])
261
-      {
262
-        viewController.tabBarItem.badgeValue = nil;
263
-      }
264
-      else
265
-      {
266
-        NSString *badgeColor = actionParams[@"badgeColor"];
267
-        UIColor *color = badgeColor != (id)[NSNull null] ? [RCTConvert UIColor:badgeColor] : nil;
254
+    if ([performAction isEqualToString:@"switchTo"]) {
255
+        UIViewController *viewController = nil;
256
+        NSNumber *tabIndex = actionParams[@"tabIndex"];
257
+        if (tabIndex) {
258
+            int i = (int)[tabIndex integerValue];
259
+            
260
+            if ([self.viewControllers count] > i) {
261
+                viewController = [self.viewControllers objectAtIndex:i];
262
+            }
263
+        }
264
+        NSString *contentId = actionParams[@"contentId"];
265
+        NSString *contentType = actionParams[@"contentType"];
266
+        if (contentId && contentType) {
267
+            viewController = [[RCCManager sharedInstance] getControllerWithId:contentId componentType:contentType];
268
+        }
268
         
269
         
269
-        if ([viewController.tabBarItem respondsToSelector:@selector(badgeColor)]) {
270
-          viewController.tabBarItem.badgeColor = color;
270
+        if (viewController) {
271
+            [self setSelectedViewController:viewController];
271
         }
272
         }
272
-        viewController.tabBarItem.badgeValue = [NSString stringWithFormat:@"%@", badge];
273
-      }
274
-    }
275
-  }
276
-  
277
-  if ([performAction isEqualToString:@"switchTo"])
278
-  {
279
-    UIViewController *viewController = nil;
280
-    NSNumber *tabIndex = actionParams[@"tabIndex"];
281
-    if (tabIndex)
282
-    {
283
-      int i = (int)[tabIndex integerValue];
284
-      
285
-      if ([self.viewControllers count] > i)
286
-      {
287
-        viewController = [self.viewControllers objectAtIndex:i];
288
-      }
289
-    }
290
-    NSString *contentId = actionParams[@"contentId"];
291
-    NSString *contentType = actionParams[@"contentType"];
292
-    if (contentId && contentType)
293
-    {
294
-      viewController = [[RCCManager sharedInstance] getControllerWithId:contentId componentType:contentType];
295
     }
273
     }
296
     
274
     
297
-    if (viewController)
298
-    {
299
-      [self setSelectedViewController:viewController];
300
-    }
301
-  }
302
-  
303
-  if ([performAction isEqualToString:@"setTabButton"])
304
-  {
305
-    UIViewController *viewController = nil;
306
-    NSNumber *tabIndex = actionParams[@"tabIndex"];
307
-    if (tabIndex)
308
-    {
309
-      int i = (int)[tabIndex integerValue];
310
-      
311
-      if ([self.viewControllers count] > i)
312
-      {
313
-        viewController = [self.viewControllers objectAtIndex:i];
314
-      }
315
-    }
316
-    NSString *contentId = actionParams[@"contentId"];
317
-    NSString *contentType = actionParams[@"contentType"];
318
-    if (contentId && contentType)
319
-    {
320
-      viewController = [[RCCManager sharedInstance] getControllerWithId:contentId componentType:contentType];
275
+    if ([performAction isEqualToString:@"setTabButton"]) {
276
+        UIViewController *viewController = nil;
277
+        NSNumber *tabIndex = actionParams[@"tabIndex"];
278
+        if (tabIndex) {
279
+            int i = (int)[tabIndex integerValue];
280
+            
281
+            if ([self.viewControllers count] > i) {
282
+                viewController = [self.viewControllers objectAtIndex:i];
283
+            }
284
+        }
285
+        NSString *contentId = actionParams[@"contentId"];
286
+        NSString *contentType = actionParams[@"contentType"];
287
+        if (contentId && contentType) {
288
+            viewController = [[RCCManager sharedInstance] getControllerWithId:contentId componentType:contentType];
289
+        }
290
+        
291
+        if (viewController) {
292
+            UIImage *iconImage = nil;
293
+            id icon = actionParams[@"icon"];
294
+            if (icon && icon != (id)[NSNull null]) {
295
+                iconImage = [RCTConvert UIImage:icon];
296
+                iconImage = [[self image:iconImage withColor:self.tabBar.tintColor] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
297
+                viewController.tabBarItem.image = iconImage;
298
+            }
299
+            
300
+            UIImage *iconImageSelected = nil;
301
+            id selectedIcon = actionParams[@"selectedIcon"];
302
+            if (selectedIcon && selectedIcon != (id)[NSNull null]) {
303
+                iconImageSelected = [RCTConvert UIImage:selectedIcon];
304
+                viewController.tabBarItem.selectedImage = iconImageSelected;
305
+            }
306
+            
307
+            id label = actionParams[@"label"];
308
+            if (label && label != (id)[NSNull null]) {
309
+                viewController.tabBarItem.title = label;
310
+            }
311
+        }
321
     }
312
     }
322
     
313
     
323
-    if (viewController)
324
-    {
325
-      UIImage *iconImage = nil;
326
-      id icon = actionParams[@"icon"];
327
-      if (icon && icon != (id)[NSNull null])
328
-      {
329
-        iconImage = [RCTConvert UIImage:icon];
330
-        iconImage = [[self image:iconImage withColor:self.tabBar.tintColor] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
331
-        viewController.tabBarItem.image = iconImage;
332
-      }
333
-      
334
-      UIImage *iconImageSelected = nil;
335
-      id selectedIcon = actionParams[@"selectedIcon"];
336
-      if (selectedIcon && selectedIcon != (id)[NSNull null])
337
-      {
338
-        iconImageSelected = [RCTConvert UIImage:selectedIcon];
339
-        viewController.tabBarItem.selectedImage = iconImageSelected;
340
-      }
341
-      
342
-      id label = actionParams[@"label"];
343
-      if (label && label != (id)[NSNull null])
344
-      {
345
-        viewController.tabBarItem.title = label;
346
-      }
314
+    if ([performAction isEqualToString:@"setTabBarHidden"]) {
315
+        BOOL hidden = [actionParams[@"hidden"] boolValue];
316
+        self.tabBarHidden = hidden;
317
+        
318
+        CGRect nextFrame = self.tabBar.frame;
319
+        nextFrame.origin.y = UIScreen.mainScreen.bounds.size.height - (hidden ? 0 : self.tabBar.frame.size.height);
320
+        
321
+        [UIView animateWithDuration: ([actionParams[@"animated"] boolValue] ? 0.45 : 0)
322
+                              delay: 0
323
+             usingSpringWithDamping: 0.75
324
+              initialSpringVelocity: 0
325
+                            options: (hidden ? UIViewAnimationOptionCurveEaseIn : UIViewAnimationOptionCurveEaseOut)
326
+                         animations:^()
327
+         {
328
+             [self.tabBar setFrame:nextFrame];
329
+         }
330
+                         completion:^(BOOL finished)
331
+         {
332
+             if (completion != nil) {
333
+                 completion();
334
+             }
335
+         }];
336
+        return;
337
+    } else if (completion != nil) {
338
+        completion();
347
     }
339
     }
348
-  }
349
-  
350
-  if ([performAction isEqualToString:@"setTabBarHidden"])
351
-  {
352
-    BOOL hidden = [actionParams[@"hidden"] boolValue];
353
-    self.tabBarHidden = hidden;
354
-    
355
-    CGRect nextFrame = self.tabBar.frame;
356
-    nextFrame.origin.y = UIScreen.mainScreen.bounds.size.height - (hidden ? 0 : self.tabBar.frame.size.height);
357
-    
358
-    [UIView animateWithDuration: ([actionParams[@"animated"] boolValue] ? 0.45 : 0)
359
-                          delay: 0
360
-         usingSpringWithDamping: 0.75
361
-          initialSpringVelocity: 0
362
-                        options: (hidden ? UIViewAnimationOptionCurveEaseIn : UIViewAnimationOptionCurveEaseOut)
363
-                     animations:^()
364
-     {
365
-         [self.tabBar setFrame:nextFrame];
366
-     }
367
-                     completion:^(BOOL finished)
368
-     {
369
-       if (completion != nil)
370
-       {
371
-         completion();
372
-       }
373
-     }];
374
-    return;
375
-  }
376
-  else if (completion != nil)
377
-  {
378
-    completion();
379
-  }
380
 }
340
 }
381
 
341
 
382
 +(void)sendScreenTabChangedEvent:(UIViewController*)viewController body:(NSDictionary*)body{
342
 +(void)sendScreenTabChangedEvent:(UIViewController*)viewController body:(NSDictionary*)body{
383
-  [RCCTabBarController sendTabEvent:@"bottomTabSelected" controller:viewController body:body];
343
+    [RCCTabBarController sendTabEvent:@"bottomTabSelected" controller:viewController body:body];
384
 }
344
 }
385
 
345
 
386
 +(void)sendScreenTabPressedEvent:(UIViewController*)viewController body:(NSDictionary*)body{
346
 +(void)sendScreenTabPressedEvent:(UIViewController*)viewController body:(NSDictionary*)body{
387
-  [RCCTabBarController sendTabEvent:@"bottomTabReselected" controller:viewController body:body];
347
+    [RCCTabBarController sendTabEvent:@"bottomTabReselected" controller:viewController body:body];
388
 }
348
 }
389
 
349
 
390
 +(void)sendTabEvent:(NSString *)event controller:(UIViewController*)viewController body:(NSDictionary*)body{
350
 +(void)sendTabEvent:(NSString *)event controller:(UIViewController*)viewController body:(NSDictionary*)body{
391
-  if ([viewController.view isKindOfClass:[RCTRootView class]]){
392
-    RCTRootView *rootView = (RCTRootView *)viewController.view;
351
+    if ([viewController.view isKindOfClass:[RCTRootView class]]){
352
+        RCTRootView *rootView = (RCTRootView *)viewController.view;
353
+        
354
+        if (rootView.appProperties && rootView.appProperties[@"navigatorEventID"]) {
355
+            NSString *navigatorID = rootView.appProperties[@"navigatorID"];
356
+            NSString *screenInstanceID = rootView.appProperties[@"screenInstanceID"];
357
+            
358
+            
359
+            NSMutableDictionary *screenDict = [NSMutableDictionary dictionaryWithDictionary:@
360
+                                               {
361
+                                                   @"id": event,
362
+                                                   @"navigatorID": navigatorID,
363
+                                                   @"screenInstanceID": screenInstanceID
364
+                                               }];
365
+            
366
+            
367
+            if (body) {
368
+                [screenDict addEntriesFromDictionary:body];
369
+            }
370
+            
371
+            [[[RCCManager sharedInstance] getBridge].eventDispatcher sendAppEventWithName:rootView.appProperties[@"navigatorEventID"] body:screenDict];
372
+        }
373
+    }
393
     
374
     
394
-    if (rootView.appProperties && rootView.appProperties[@"navigatorEventID"]) {
395
-      NSString *navigatorID = rootView.appProperties[@"navigatorID"];
396
-      NSString *screenInstanceID = rootView.appProperties[@"screenInstanceID"];
397
-      
398
-      
399
-      NSMutableDictionary *screenDict = [NSMutableDictionary dictionaryWithDictionary:@
400
-                                         {
401
-                                           @"id": event,
402
-                                           @"navigatorID": navigatorID,
403
-                                           @"screenInstanceID": screenInstanceID
404
-                                         }];
405
-      
406
-      
407
-      if (body) {
408
-        [screenDict addEntriesFromDictionary:body];
409
-      }
410
-      
411
-      [[[RCCManager sharedInstance] getBridge].eventDispatcher sendAppEventWithName:rootView.appProperties[@"navigatorEventID"] body:screenDict];
375
+    if ([viewController isKindOfClass:[UINavigationController class]]) {
376
+        UINavigationController *navigationController = (UINavigationController*)viewController;
377
+        UIViewController *topViewController = [navigationController topViewController];
378
+        [RCCTabBarController sendTabEvent:event controller:topViewController body:body];
412
     }
379
     }
413
-  }
414
-  
415
-  if ([viewController isKindOfClass:[UINavigationController class]]) {
416
-    UINavigationController *navigationController = (UINavigationController*)viewController;
417
-    UIViewController *topViewController = [navigationController topViewController];
418
-    [RCCTabBarController sendTabEvent:event controller:topViewController body:body];
419
-  }
420
 }
380
 }
421
 
381
 
422
 
382
 

+ 3
- 3
ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

68
 		390AD485200F566100A8250D /* RNNSwizzles.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSwizzles.h; sourceTree = "<group>"; };
68
 		390AD485200F566100A8250D /* RNNSwizzles.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSwizzles.h; sourceTree = "<group>"; };
69
 		390AD486200F566100A8250D /* RNNSwizzles.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSwizzles.m; sourceTree = "<group>"; };
69
 		390AD486200F566100A8250D /* RNNSwizzles.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSwizzles.m; sourceTree = "<group>"; };
70
 		CC84A1931C1A0C4E00B3A6A2 /* RCCManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCManager.h; sourceTree = "<group>"; };
70
 		CC84A1931C1A0C4E00B3A6A2 /* RCCManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCManager.h; sourceTree = "<group>"; };
71
-		CC84A1941C1A0C4E00B3A6A2 /* RCCManager.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCCManager.m; sourceTree = "<group>"; tabWidth = 2; };
71
+		CC84A1941C1A0C4E00B3A6A2 /* RCCManager.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = RCCManager.m; sourceTree = "<group>"; tabWidth = 4; };
72
 		CC84A1951C1A0C4E00B3A6A2 /* RCCManagerModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCManagerModule.h; sourceTree = "<group>"; };
72
 		CC84A1951C1A0C4E00B3A6A2 /* RCCManagerModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCManagerModule.h; sourceTree = "<group>"; };
73
 		CC84A1961C1A0C4E00B3A6A2 /* RCCManagerModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCCManagerModule.m; sourceTree = "<group>"; };
73
 		CC84A1961C1A0C4E00B3A6A2 /* RCCManagerModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCCManagerModule.m; sourceTree = "<group>"; };
74
 		CC84A1971C1A0C4E00B3A6A2 /* RCCNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCNavigationController.h; sourceTree = "<group>"; };
74
 		CC84A1971C1A0C4E00B3A6A2 /* RCCNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCNavigationController.h; sourceTree = "<group>"; };
75
-		CC84A1981C1A0C4E00B3A6A2 /* RCCNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCCNavigationController.m; sourceTree = "<group>"; tabWidth = 2; };
75
+		CC84A1981C1A0C4E00B3A6A2 /* RCCNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = RCCNavigationController.m; sourceTree = "<group>"; tabWidth = 4; };
76
 		CC84A1991C1A0C4E00B3A6A2 /* RCCTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCTabBarController.h; sourceTree = "<group>"; };
76
 		CC84A1991C1A0C4E00B3A6A2 /* RCCTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCTabBarController.h; sourceTree = "<group>"; };
77
-		CC84A19A1C1A0C4E00B3A6A2 /* RCCTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCCTabBarController.m; sourceTree = "<group>"; tabWidth = 2; };
77
+		CC84A19A1C1A0C4E00B3A6A2 /* RCCTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = RCCTabBarController.m; sourceTree = "<group>"; tabWidth = 4; };
78
 		CC84A19B1C1A0C4E00B3A6A2 /* RCCViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCViewController.h; sourceTree = "<group>"; };
78
 		CC84A19B1C1A0C4E00B3A6A2 /* RCCViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCViewController.h; sourceTree = "<group>"; };
79
 		CC84A19C1C1A0C4E00B3A6A2 /* RCCViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = RCCViewController.m; sourceTree = "<group>"; tabWidth = 4; };
79
 		CC84A19C1C1A0C4E00B3A6A2 /* RCCViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = RCCViewController.m; sourceTree = "<group>"; tabWidth = 4; };
80
 		D800E8171CFED1DB004A187F /* RCCExternalViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCExternalViewControllerProtocol.h; sourceTree = "<group>"; };
80
 		D800E8171CFED1DB004A187F /* RCCExternalViewControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCCExternalViewControllerProtocol.h; sourceTree = "<group>"; };