暂无描述

ViewController.m 856B

123456789101112131415161718192021222324252627282930
  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 "ViewController.h"
  8. #import "AppDelegate.h"
  9. #import <React/RCTRootView.h>
  10. @implementation ViewController
  11. - (void)viewDidLoad {
  12. [super viewDidLoad];
  13. RCTBridge *bridge = [((AppDelegate *)[NSApp delegate])bridge];
  14. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"example" initialProperties:nil];
  15. NSView *view = [self view];
  16. [view addSubview:rootView];
  17. [rootView setBackgroundColor:[NSColor windowBackgroundColor]];
  18. [rootView setFrame:[view bounds]];
  19. [rootView setAutoresizingMask:(NSViewMinXMargin | NSViewMinXMargin | NSViewMinYMargin | NSViewMaxYMargin | NSViewWidthSizable | NSViewHeightSizable)];
  20. }
  21. @end