react-native-navigation的迁移库

RCCDrawerController.m 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //#import "RCCDrawerController.h"
  2. //#import "RCCViewController.h"
  3. //#import "MMExampleDrawerVisualStateManager.h"
  4. //#import "RCCDrawerHelper.h"
  5. //#import "RCTConvert.h"
  6. //#import "RCCManagerModule.h"
  7. //
  8. //#define RCCDRAWERCONTROLLER_ANIMATION_DURATION 0.33f
  9. //
  10. //
  11. //@implementation RCCDrawerController
  12. //
  13. //@synthesize drawerStyle = _drawerStyle;
  14. //
  15. //
  16. //
  17. //- (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children globalProps:(NSDictionary*)globalProps bridge:(RCTBridge *)bridge
  18. //{
  19. //
  20. // self.drawerStyle = props[@"style"];
  21. //
  22. // // center
  23. // if ([children count] < 1) return nil;
  24. // UIViewController *centerViewController = [RCCViewController controllerWithLayout:children[0] globalProps:globalProps bridge:bridge];
  25. //
  26. // // left
  27. // UIViewController *leftViewController = nil;
  28. // NSString *componentLeft = props[@"componentLeft"];
  29. // NSDictionary *passPropsLeft = props[@"passPropsLeft"];
  30. // if (componentLeft) leftViewController = [[RCCViewController alloc] initWithComponent:componentLeft passProps:passPropsLeft navigatorStyle:nil globalProps:globalProps bridge:bridge];
  31. //
  32. // // right
  33. // UIViewController *rightViewController = nil;
  34. // NSString *componentRight = props[@"componentRight"];
  35. // NSDictionary *passPropsRight = props[@"passPropsRight"];
  36. // if (componentRight) rightViewController = [[RCCViewController alloc] initWithComponent:componentRight passProps:passPropsRight navigatorStyle:nil globalProps:globalProps bridge:bridge];
  37. //
  38. // self = [super initWithCenterViewController:centerViewController
  39. // leftDrawerViewController:leftViewController
  40. // rightDrawerViewController:rightViewController];
  41. //
  42. // [self setAnimationTypeWithName:props[@"animationType"]];
  43. //
  44. // // default is all MMOpenDrawerGestureModeAll and MMCloseDrawerGestureModeAll
  45. // self.openDrawerGestureModeMask = MMOpenDrawerGestureModeAll;
  46. // self.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll;
  47. //
  48. // NSNumber *disableOpenGesture = props[@"disableOpenGesture"];
  49. // if ([disableOpenGesture boolValue]) {
  50. // self.openDrawerGestureModeMask = MMOpenDrawerGestureModeNone;
  51. // }
  52. //
  53. // [self setStyle];
  54. //
  55. // [self setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
  56. // MMDrawerControllerDrawerVisualStateBlock block;
  57. // block = [[MMExampleDrawerVisualStateManager sharedManager] drawerVisualStateBlockForDrawerSide:drawerSide];
  58. // if (block) {
  59. // block(drawerController, drawerSide, percentVisible);
  60. // }
  61. // }];
  62. //
  63. // [self setGestureStartBlock:^(MMDrawerController *drawerController, UIGestureRecognizer *gesture) {
  64. // [RCCManagerModule cancelAllRCCViewControllerReactTouches];
  65. // }];
  66. //
  67. // self.view.backgroundColor = [UIColor clearColor];
  68. //
  69. // if (!self) return nil;
  70. // return self;
  71. //}
  72. //
  73. //
  74. //-(void)setStyle {
  75. //
  76. // if (self.drawerStyle[@"drawerShadow"]) {
  77. // self.showsShadow = ([self.drawerStyle[@"drawerShadow"] boolValue]) ? YES : NO;
  78. // }
  79. //
  80. // NSNumber *leftDrawerWidth = self.drawerStyle[@"leftDrawerWidth"];
  81. // if (leftDrawerWidth) {
  82. // self.maximumLeftDrawerWidth = self.view.bounds.size.width * MIN(1, (leftDrawerWidth.floatValue/100.0));
  83. // }
  84. //
  85. // NSNumber *rightDrawerWidth = self.drawerStyle[@"rightDrawerWidth"];
  86. // if (rightDrawerWidth) {
  87. // self.maximumRightDrawerWidth = self.view.bounds.size.width * MIN(1, (rightDrawerWidth.floatValue/100.0));
  88. // }
  89. //
  90. // NSString *contentOverlayColor = self.drawerStyle[@"contentOverlayColor"];
  91. // if (contentOverlayColor)
  92. // {
  93. // UIColor *color = contentOverlayColor != (id)[NSNull null] ? [RCTConvert UIColor:contentOverlayColor] : nil;
  94. // [self setCenterOverlayColor:color];
  95. // }
  96. //}
  97. //
  98. //
  99. //- (void)performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams bridge:(RCTBridge *)bridge
  100. //{
  101. // MMDrawerSide side = MMDrawerSideLeft;
  102. // if ([actionParams[@"side"] isEqualToString:@"right"]) side = MMDrawerSideRight;
  103. // BOOL animated = actionParams[@"animated"] ? [actionParams[@"animated"] boolValue] : YES;
  104. //
  105. // // open
  106. // if ([performAction isEqualToString:@"open"])
  107. // {
  108. // [self openDrawerSide:side animated:animated completion:nil];
  109. // return;
  110. // }
  111. //
  112. // // close
  113. // if ([performAction isEqualToString:@"close"])
  114. // {
  115. // if (self.openSide == side) {
  116. // [self closeDrawerAnimated:animated completion:nil];
  117. // }
  118. //
  119. // return;
  120. // }
  121. //
  122. // // toggle
  123. // if ([performAction isEqualToString:@"toggle"])
  124. // {
  125. // [super toggleDrawerSide:side animated:animated completion:nil];
  126. // return;
  127. // }
  128. //
  129. // // setStyle
  130. // if ([performAction isEqualToString:@"setStyle"])
  131. // {
  132. // if (actionParams[@"animationType"]) {
  133. // NSString *animationTypeString = actionParams[@"animationType"];
  134. // [self setAnimationTypeWithName:animationTypeString];
  135. // }
  136. // return;
  137. // }
  138. //
  139. //}
  140. //
  141. //-(void)setAnimationTypeWithName:(NSString*)animationTypeName {
  142. // MMDrawerAnimationType animationType = MMDrawerAnimationTypeNone;
  143. //
  144. // if ([animationTypeName isEqualToString:@"door"]) animationType = MMDrawerAnimationTypeSwingingDoor;
  145. // else if ([animationTypeName isEqualToString:@"parallax"]) animationType = MMDrawerAnimationTypeParallax;
  146. // else if ([animationTypeName isEqualToString:@"slide"]) animationType = MMDrawerAnimationTypeSlide;
  147. // else if ([animationTypeName isEqualToString:@"slide-and-scale"]) animationType = MMDrawerAnimationTypeSlideAndScale;
  148. //
  149. // [MMExampleDrawerVisualStateManager sharedManager].leftDrawerAnimationType = animationType;
  150. // [MMExampleDrawerVisualStateManager sharedManager].rightDrawerAnimationType = animationType;
  151. //}
  152. //
  153. //
  154. //@end