react-native-navigation的迁移库

RNN.m 937B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #import "RNN.h"
  2. #import "RNNEventEmitter.h"
  3. #import "RCTBridge.h"
  4. @interface RNN()
  5. @end
  6. @implementation RNN
  7. {
  8. RCTBridge* bridge;
  9. }
  10. +(instancetype)instance
  11. {
  12. static RNN *sharedInstance = nil;
  13. static dispatch_once_t onceToken = 0;
  14. dispatch_once(&onceToken,^{
  15. if (sharedInstance == nil)
  16. {
  17. sharedInstance = [[RNN alloc] init];
  18. }
  19. });
  20. return sharedInstance;
  21. }
  22. -(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions
  23. {
  24. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onJavaScriptLoaded) name:RCTJavaScriptDidLoadNotification object:nil];
  25. // this will load the JS bundle
  26. bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation moduleProvider:nil launchOptions:launchOptions];
  27. }
  28. -(void)onJavaScriptLoaded
  29. {
  30. [RNNEventEmitter sendOnAppLaunched];
  31. }
  32. -(RCTBridge *)bridge
  33. {
  34. return bridge;
  35. }
  36. @end