react-native-navigation的迁移库

RNNSideMenuPresenter.m 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #import "RNNSideMenuPresenter.h"
  2. #import "RNNSideMenuController.h"
  3. @implementation RNNSideMenuPresenter
  4. - (void)applyOptions:(RNNNavigationOptions *)initialOptions {
  5. [super applyOptions:initialOptions];
  6. RNNNavigationOptions* options = [initialOptions withDefault:self.defaultOptions];
  7. RNNSideMenuController* sideMenuController = self.bindedViewController;
  8. [sideMenuController side:MMDrawerSideLeft enabled:[options.sideMenu.left.enabled getWithDefaultValue:YES]];
  9. [sideMenuController side:MMDrawerSideRight enabled:[options.sideMenu.right.enabled getWithDefaultValue:YES]];
  10. [sideMenuController setShouldStretchLeftDrawer:[options.sideMenu.left.shouldStretchDrawer getWithDefaultValue:YES]];
  11. [sideMenuController setShouldStretchRightDrawer:[options.sideMenu.right.shouldStretchDrawer getWithDefaultValue:YES]];
  12. [sideMenuController setAnimationVelocityLeft:[options.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
  13. [sideMenuController setAnimationVelocityRight:[options.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
  14. if (options.sideMenu.left.width.hasValue) {
  15. [sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
  16. }
  17. if (options.sideMenu.right.width.hasValue) {
  18. [sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
  19. }
  20. }
  21. - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
  22. [super mergeOptions:options resolvedOptions:resolvedOptions];
  23. RNNSideMenuController* sideMenuController = self.bindedViewController;
  24. if (options.sideMenu.left.enabled.hasValue) {
  25. [sideMenuController side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
  26. [options.sideMenu.left.enabled consume];
  27. }
  28. if (options.sideMenu.right.enabled.hasValue) {
  29. [sideMenuController side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
  30. [options.sideMenu.right.enabled consume];
  31. }
  32. if (options.sideMenu.left.visible.hasValue) {
  33. [sideMenuController side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
  34. [options.sideMenu.left.visible consume];
  35. }
  36. if (options.sideMenu.right.visible.hasValue) {
  37. [sideMenuController side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
  38. [options.sideMenu.right.visible consume];
  39. }
  40. if (options.sideMenu.left.width.hasValue) {
  41. [sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
  42. }
  43. if (options.sideMenu.right.width.hasValue) {
  44. [sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
  45. }
  46. if (options.sideMenu.left.shouldStretchDrawer.hasValue) {
  47. sideMenuController.shouldStretchLeftDrawer = options.sideMenu.left.shouldStretchDrawer.get;
  48. }
  49. if (options.sideMenu.right.shouldStretchDrawer.hasValue) {
  50. sideMenuController.shouldStretchRightDrawer = options.sideMenu.right.shouldStretchDrawer.get;
  51. }
  52. if (options.sideMenu.left.animationVelocity.hasValue) {
  53. sideMenuController.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
  54. }
  55. if (options.sideMenu.right.animationVelocity.hasValue) {
  56. sideMenuController.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
  57. }
  58. }
  59. @end