react-native-navigation的迁移库

ReactNativeNavigation.m 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #import "ReactNativeNavigation.h"
  2. #import <UIKit/UIKit.h>
  3. #import <React/RCTBridge.h>
  4. #import <React/RCTUIManager.h>
  5. #import "RNNBridgeManager.h"
  6. #import "RNNSplashScreen.h"
  7. @interface ReactNativeNavigation()
  8. @property (nonatomic, strong) RNNBridgeManager *bridgeManager;
  9. @end
  10. @implementation ReactNativeNavigation
  11. # pragma mark - public API
  12. +(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions {
  13. [[ReactNativeNavigation sharedInstance] bootstrap:jsCodeLocation launchOptions:launchOptions];
  14. }
  15. # pragma mark - instance
  16. + (instancetype) sharedInstance {
  17. static ReactNativeNavigation *instance = nil;
  18. static dispatch_once_t onceToken = 0;
  19. dispatch_once(&onceToken,^{
  20. if (instance == nil) {
  21. instance = [[ReactNativeNavigation alloc] init];
  22. }
  23. });
  24. return instance;
  25. }
  26. -(void)bootstrap:(NSURL *)jsCodeLocation launchOptions:(NSDictionary *)launchOptions {
  27. self.bridgeManager = [[RNNBridgeManager alloc] initWithJsCodeLocation:jsCodeLocation launchOptions:launchOptions];
  28. [RNNSplashScreen show];
  29. }
  30. @end