Browse Source

add the ability to choose is relevant styles properties will remember across push or not (#1773)

Ran Greenberg 7 years ago
parent
commit
ec71b3c2be
1 changed files with 28 additions and 23 deletions
  1. 28
    23
      ios/RCCNavigationController.m

+ 28
- 23
ios/RCCNavigationController.m View File

82
     passProps[GLOBAL_SCREEN_ACTION_TIMESTAMP] = actionParams[GLOBAL_SCREEN_ACTION_TIMESTAMP];
82
     passProps[GLOBAL_SCREEN_ACTION_TIMESTAMP] = actionParams[GLOBAL_SCREEN_ACTION_TIMESTAMP];
83
     NSDictionary *navigatorStyle = actionParams[@"style"];
83
     NSDictionary *navigatorStyle = actionParams[@"style"];
84
     
84
     
85
-    // merge the navigatorStyle of our parent
86
-    if ([self.topViewController isKindOfClass:[RCCViewController class]])
87
-    {
88
-      RCCViewController *parent = (RCCViewController*)self.topViewController;
89
-      NSMutableDictionary *mergedStyle = [NSMutableDictionary dictionaryWithDictionary:parent.navigatorStyle];
85
+    NSNumber *keepStyleAcrossPush = [[RCCManager sharedInstance] getAppStyle][@"keepStyleAcrossPush"];
86
+    BOOL keepStyleAcrossPushBool = keepStyleAcrossPush ? [keepStyleAcrossPush boolValue] : YES;
87
+    
88
+    if (keepStyleAcrossPushBool) {
90
       
89
       
91
-      // there are a few styles that we don't want to remember from our parent (they should be local)
92
-      [mergedStyle removeObjectForKey:@"navBarHidden"];
93
-      [mergedStyle removeObjectForKey:@"statusBarHidden"];
94
-      [mergedStyle removeObjectForKey:@"navBarHideOnScroll"];
95
-      [mergedStyle removeObjectForKey:@"drawUnderNavBar"];
96
-      [mergedStyle removeObjectForKey:@"drawUnderTabBar"];
97
-      [mergedStyle removeObjectForKey:@"statusBarBlur"];
98
-      [mergedStyle removeObjectForKey:@"navBarBlur"];
99
-      [mergedStyle removeObjectForKey:@"navBarTranslucent"];
100
-      [mergedStyle removeObjectForKey:@"statusBarHideWithNavBar"];
101
-      [mergedStyle removeObjectForKey:@"autoAdjustScrollViewInsets"];
102
-      [mergedStyle removeObjectForKey:@"statusBarTextColorSchemeSingleScreen"];
103
-      [mergedStyle removeObjectForKey:@"disabledBackGesture"];
104
-      [mergedStyle removeObjectForKey:@"navBarCustomView"];
105
-      [mergedStyle removeObjectForKey:@"navBarComponentAlignment"];
106
-       
107
-      [mergedStyle addEntriesFromDictionary:navigatorStyle];
108
-      navigatorStyle = mergedStyle;
90
+      if ([self.topViewController isKindOfClass:[RCCViewController class]])
91
+      {
92
+        RCCViewController *parent = (RCCViewController*)self.topViewController;
93
+        NSMutableDictionary *mergedStyle = [NSMutableDictionary dictionaryWithDictionary:parent.navigatorStyle];
94
+        
95
+        // there are a few styles that we don't want to remember from our parent (they should be local)
96
+        [mergedStyle removeObjectForKey:@"navBarHidden"];
97
+        [mergedStyle removeObjectForKey:@"statusBarHidden"];
98
+        [mergedStyle removeObjectForKey:@"navBarHideOnScroll"];
99
+        [mergedStyle removeObjectForKey:@"drawUnderNavBar"];
100
+        [mergedStyle removeObjectForKey:@"drawUnderTabBar"];
101
+        [mergedStyle removeObjectForKey:@"statusBarBlur"];
102
+        [mergedStyle removeObjectForKey:@"navBarBlur"];
103
+        [mergedStyle removeObjectForKey:@"navBarTranslucent"];
104
+        [mergedStyle removeObjectForKey:@"statusBarHideWithNavBar"];
105
+        [mergedStyle removeObjectForKey:@"autoAdjustScrollViewInsets"];
106
+        [mergedStyle removeObjectForKey:@"statusBarTextColorSchemeSingleScreen"];
107
+        [mergedStyle removeObjectForKey:@"disabledBackGesture"];
108
+        [mergedStyle removeObjectForKey:@"navBarCustomView"];
109
+        [mergedStyle removeObjectForKey:@"navBarComponentAlignment"];
110
+        
111
+        [mergedStyle addEntriesFromDictionary:navigatorStyle];
112
+        navigatorStyle = mergedStyle;
113
+      }
109
     }
114
     }
110
     
115
     
111
     RCCViewController *viewController = [[RCCViewController alloc] initWithComponent:component passProps:passProps navigatorStyle:navigatorStyle globalProps:nil bridge:bridge];
116
     RCCViewController *viewController = [[RCCViewController alloc] initWithComponent:component passProps:passProps navigatorStyle:navigatorStyle globalProps:nil bridge:bridge];