12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
-
- #import "RNNReactRootViewCreator.h"
- #import "RNNReactRootView.h"
- #import "RNNReactView.h"
-
- @implementation RNNReactRootViewCreator {
- RCTBridge *_bridge;
- }
-
- -(instancetype)initWithBridge:(RCTBridge*)bridge {
- self = [super init];
-
- _bridge = bridge;
-
- return self;
-
- }
-
- - (UIView*)createRootView:(NSString*)name rootViewId:(NSString*)rootViewId {
- if (!rootViewId) {
- @throw [NSException exceptionWithName:@"MissingViewId" reason:@"Missing view id" userInfo:nil];
- }
-
- UIView *view = [[RNNReactRootView alloc] initWithBridge:_bridge
- moduleName:name
- initialProperties:@{@"componentId": rootViewId}];
- return view;
- }
-
- - (UIView*)createCustomReactView:(NSString*)name rootViewId:(NSString*)rootViewId {
- if (!rootViewId) {
- @throw [NSException exceptionWithName:@"MissingViewId" reason:@"Missing view id" userInfo:nil];
- }
-
- UIView *view = [[RNNReactView alloc] initWithBridge:_bridge
- moduleName:name
- initialProperties:@{@"componentId": rootViewId}];
- return view;
- }
-
- -(UIView*)createRootViewFromComponentOptions:(RNNComponentOptions*)componentOptions {
- return [self createCustomReactView:componentOptions.name rootViewId:componentOptions.componentId];
- }
-
- @end
|