react-native-navigation的迁移库

RNNSideMenuPresenter.m 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 setShouldStretchDrawer:[options.sideMenu.shouldStretchDrawer getWithDefaultValue:YES]];
  11. [sideMenuController setAnimationVelocity:[options.sideMenu.animationVelocity getWithDefaultValue:840.0f]];
  12. if (options.sideMenu.left.width.hasValue) {
  13. [sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
  14. }
  15. if (options.sideMenu.right.width.hasValue) {
  16. [sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
  17. }
  18. }
  19. - (void)mergeOptions:(RNNNavigationOptions *)options {
  20. [super mergeOptions:options];
  21. RNNSideMenuController* sideMenuController = self.bindedViewController;
  22. if (options.sideMenu.left.enabled.hasValue) {
  23. [sideMenuController side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
  24. [options.sideMenu.left.enabled consume];
  25. }
  26. if (options.sideMenu.right.enabled.hasValue) {
  27. [sideMenuController side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
  28. [options.sideMenu.right.enabled consume];
  29. }
  30. if (options.sideMenu.left.visible.hasValue) {
  31. [sideMenuController side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
  32. [options.sideMenu.left.visible consume];
  33. }
  34. if (options.sideMenu.right.visible.hasValue) {
  35. [sideMenuController side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
  36. [options.sideMenu.right.visible consume];
  37. }
  38. if (options.sideMenu.left.width.hasValue) {
  39. [sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
  40. }
  41. if (options.sideMenu.right.width.hasValue) {
  42. [sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
  43. }
  44. if (options.sideMenu.shouldStretchDrawer.hasValue) {
  45. sideMenuController.shouldStretchDrawer = options.sideMenu.shouldStretchDrawer.get;
  46. }
  47. if (options.sideMenu.animationVelocity.hasValue) {
  48. sideMenuController.animationVelocity = options.sideMenu.animationVelocity.get;
  49. }
  50. }
  51. @end