Browse Source

walk-around for React-Native bug with multiple RCTRootView (#1618)

https://github.com/wix/react-native-navigation/issues/1446
Ran Greenberg 7 years ago
parent
commit
70f46f5f08
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      ios/RCCViewController.m

+ 17
- 0
ios/RCCViewController.m View File

@@ -269,6 +269,22 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
269 269
   return [NSString stringWithFormat:@"%lld", milliseconds];
270 270
 }
271 271
 
272
+// This is walk around for React-Native bug.
273
+// https://github.com/wix/react-native-navigation/issues/1446
274
+//
275
+// Buttons in ScrollView after changing route/pushing/showing modal
276
+// while there is a momentum scroll are not clickable.
277
+// Back to normal after user start scroll with momentum
278
+- (void)_traverseAndCall:(UIView*)view
279
+{
280
+  if([view isKindOfClass:[UIScrollView class]]) {
281
+    [[(UIScrollView*)view delegate] scrollViewDidEndDecelerating:(id)view];
282
+  }
283
+  
284
+  [view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
285
+    [self _traverseAndCall:obj];
286
+  }];
287
+}
272 288
 
273 289
 - (void)viewDidAppear:(BOOL)animated
274 290
 {
@@ -289,6 +305,7 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
289 305
 
290 306
 - (void)viewDidDisappear:(BOOL)animated
291 307
 {
308
+  [self _traverseAndCall:self.view];
292 309
   [super viewDidDisappear:animated];
293 310
   [self sendGlobalScreenEvent:@"didDisappear" endTimestampString:[self getTimestampString] shouldReset:YES];
294 311
   [self sendScreenChangedEvent:@"didDisappear"];