|
|
|
|
19
|
- (RNNReactView *)createComponentIfNotExists:(RNNComponentOptions *)component parentComponentId:(NSString *)parentComponentId reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
|
19
|
- (RNNReactView *)createComponentIfNotExists:(RNNComponentOptions *)component parentComponentId:(NSString *)parentComponentId reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
|
20
|
NSMutableDictionary* parentComponentDict = [self componentsForParentId:parentComponentId];
|
20
|
NSMutableDictionary* parentComponentDict = [self componentsForParentId:parentComponentId];
|
21
|
|
21
|
|
22
|
- RNNReactView* reactView = [parentComponentDict objectForKey:component.componentId.get];
|
|
|
|
|
22
|
+ RNNReactView* reactView = parentComponentDict[component.componentId.get];
|
23
|
if (!reactView) {
|
23
|
if (!reactView) {
|
24
|
reactView = (RNNReactView *)[_creator createRootViewFromComponentOptions:component reactViewReadyBlock:reactViewReadyBlock];
|
24
|
reactView = (RNNReactView *)[_creator createRootViewFromComponentOptions:component reactViewReadyBlock:reactViewReadyBlock];
|
25
|
- [parentComponentDict setObject:reactView forKey:component.componentId.get];
|
|
|
|
|
25
|
+ parentComponentDict[component.componentId.get] = reactView;
|
26
|
} else if (reactViewReadyBlock) {
|
26
|
} else if (reactViewReadyBlock) {
|
27
|
reactViewReadyBlock();
|
27
|
reactViewReadyBlock();
|
28
|
}
|
28
|
}
|
|
|
|
|
50
|
|
50
|
|
51
|
- (void)removeChildComponent:(NSString *)childId {
|
51
|
- (void)removeChildComponent:(NSString *)childId {
|
52
|
NSMutableDictionary* parent;
|
52
|
NSMutableDictionary* parent;
|
53
|
- while ((parent = _componentStore.objectEnumerator.nextObject)) {
|
|
|
54
|
- if ([parent objectForKey:childId]) {
|
|
|
|
|
53
|
+ NSEnumerator *enumerator = _componentStore.objectEnumerator;
|
|
|
54
|
+ while ((parent = enumerator.nextObject)) {
|
|
|
55
|
+ if (parent[childId]) {
|
55
|
[parent removeObjectForKey:childId];
|
56
|
[parent removeObjectForKey:childId];
|
56
|
return;
|
57
|
return;
|
57
|
}
|
58
|
}
|