react-native-navigation的迁移库

RNNSplitViewControllerPresenter.m 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #import "RNNSplitViewControllerPresenter.h"
  2. #import "UISplitViewController+RNNOptions.h"
  3. #import "RCTConvert+Modal.h"
  4. #import "RNNSplitViewController.h"
  5. @implementation RNNSplitViewControllerPresenter
  6. - (void)applyOptions:(RNNNavigationOptions *)options {
  7. [super applyOptions:options];
  8. UISplitViewController* splitViewController = self.boundViewController;
  9. [splitViewController rnn_setDisplayMode:options.splitView.displayMode];
  10. [splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
  11. [splitViewController rnn_setMinWidth:options.splitView.minWidth];
  12. [splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
  13. }
  14. - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
  15. [super applyOptionsOnInit:initialOptions];
  16. UISplitViewController* splitViewController = self.boundViewController;
  17. [splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
  18. [splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
  19. [splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
  20. [splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
  21. }
  22. - (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
  23. [super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
  24. UISplitViewController* splitViewController = self.boundViewController;
  25. if (newOptions.splitView.displayMode) {
  26. [splitViewController rnn_setDisplayMode:newOptions.splitView.displayMode];
  27. }
  28. if (newOptions.splitView.primaryEdge) {
  29. [splitViewController rnn_setPrimaryEdge:newOptions.splitView.primaryEdge];
  30. }
  31. if (newOptions.splitView.minWidth) {
  32. [splitViewController rnn_setMinWidth:newOptions.splitView.minWidth];
  33. }
  34. if (newOptions.splitView.maxWidth) {
  35. [splitViewController rnn_setMaxWidth:newOptions.splitView.maxWidth];
  36. }
  37. }
  38. @end