react-native-navigation的迁移库

RNNSideMenuOptions.m 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #import "RNNSideMenuOptions.h"
  2. #import "RNNSideMenuController.h"
  3. @implementation RNNSideMenuOptions
  4. - (void)applyOn:(UIViewController *)viewController {
  5. RNNSideMenuController* sideMenuController = (RNNSideMenuController*)UIApplication.sharedApplication.delegate.window.rootViewController;
  6. if ([sideMenuController isKindOfClass:[RNNSideMenuController class]]) {
  7. if (self.leftSideVisible) {
  8. if (self.leftSideVisible.boolValue) {
  9. [sideMenuController showSideMenu:MMDrawerSideLeft animated:YES];
  10. } else {
  11. [sideMenuController hideSideMenu:MMDrawerSideLeft animated:YES];
  12. }
  13. }
  14. if (self.rightSideVisible) {
  15. if (self.rightSideVisible.boolValue) {
  16. [sideMenuController showSideMenu:MMDrawerSideRight animated:YES];
  17. } else {
  18. [sideMenuController hideSideMenu:MMDrawerSideRight animated:YES];
  19. }
  20. }
  21. [self resetOptions];
  22. }
  23. }
  24. -(void)mergeWith:(NSDictionary *)otherOptions {
  25. self.leftSideVisible = [[otherOptions valueForKey:@"left"] valueForKey:@"visible"];
  26. self.rightSideVisible = [[otherOptions valueForKey:@"right"] valueForKey:@"visible"];
  27. }
  28. -(void)resetOptions {
  29. self.leftSideVisible = nil;
  30. self.rightSideVisible = nil;
  31. }
  32. @end