Skip to content

Commit

Permalink
Fix infinite loop while trying to remove react buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
guyca committed Sep 8, 2019
1 parent 185115f commit 88fd1f1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/ios/RNNReactComponentRegistry.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ - (instancetype)initWithCreator:(id<RNNRootViewCreator>)creator {
- (RNNReactView *)createComponentIfNotExists:(RNNComponentOptions *)component parentComponentId:(NSString *)parentComponentId reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
NSMutableDictionary* parentComponentDict = [self componentsForParentId:parentComponentId];

RNNReactView* reactView = [parentComponentDict objectForKey:component.componentId.get];
RNNReactView* reactView = parentComponentDict[component.componentId.get];
if (!reactView) {
reactView = (RNNReactView *)[_creator createRootViewFromComponentOptions:component reactViewReadyBlock:reactViewReadyBlock];
[parentComponentDict setObject:reactView forKey:component.componentId.get];
parentComponentDict[component.componentId.get] = reactView;
} else if (reactViewReadyBlock) {
reactViewReadyBlock();
}
Expand Down Expand Up @@ -50,8 +50,9 @@ - (void)removeComponent:(NSString *)componentId {

- (void)removeChildComponent:(NSString *)childId {
NSMutableDictionary* parent;
while ((parent = _componentStore.objectEnumerator.nextObject)) {
if ([parent objectForKey:childId]) {
NSEnumerator *enumerator = _componentStore.objectEnumerator;
while ((parent = enumerator.nextObject)) {
if (parent[childId]) {
[parent removeObjectForKey:childId];
return;
}
Expand Down

0 comments on commit 88fd1f1

Please sign in to comment.