123456789101112131415161718192021222324252627 |
- #import "RNNExternalComponentStore.h"
-
- @interface RNNExternalComponentStore ()
-
- @end
-
- @implementation RNNExternalComponentStore {
- NSMutableDictionary* _externalComponentCreators;
- }
-
- -(instancetype)init {
- self = [super init];
- _externalComponentCreators = [NSMutableDictionary new];
- return self;
- }
-
- - (void)registerExternalComponent:(NSString *)name callback:(RNNExternalViewCreator)callback {
- [_externalComponentCreators setObject:[callback copy] forKey:name];
- }
-
- - (UIViewController *)getExternalComponent:(RNNLayoutInfo *)layoutInfo bridge:(RCTBridge *)bridge {
- RNNExternalViewCreator creator = [_externalComponentCreators objectForKey:layoutInfo.name];
- return creator(layoutInfo.props, bridge);
- }
-
- @end
|