RCTWrapperReactRootViewController.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "RCTWrapperReactRootViewController.h"
  8. #import <RCTWrapper/RCTWrapper.h>
  9. #import <React/RCTBridge.h>
  10. #import <React/RCTRootView.h>
  11. #import "RCTWrapperExampleView.h"
  12. @implementation RCTWrapperReactRootViewController {
  13. RCTBridge *_bridge;
  14. }
  15. - (instancetype)initWithBridge:(RCTBridge *)bridge
  16. {
  17. if (self = [super initWithNibName:nil bundle:nil]) {
  18. _bridge = bridge;
  19. }
  20. return self;
  21. }
  22. - (void)loadView
  23. {
  24. RCTRootView *rootView =
  25. [[RCTRootView alloc] initWithBridge:_bridge
  26. moduleName:@"WrapperExample"
  27. initialProperties:@{}];
  28. rootView.backgroundColor = [UIColor whiteColor];
  29. UIActivityIndicatorView *progressIndicatorView =
  30. [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
  31. [progressIndicatorView startAnimating];
  32. rootView.loadingView = progressIndicatorView;
  33. rootView.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight;
  34. self.view = rootView;
  35. }
  36. @end