소스 검색

Fix infinite loop while trying to remove react buttons

Guy Carmeli 5 년 전
부모
커밋
61a9abeaf1
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5
    4
      lib/ios/RNNReactComponentRegistry.m

+ 5
- 4
lib/ios/RNNReactComponentRegistry.m 파일 보기

@@ -19,10 +19,10 @@
19 19
 - (RNNReactView *)createComponentIfNotExists:(RNNComponentOptions *)component parentComponentId:(NSString *)parentComponentId reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
20 20
 	NSMutableDictionary* parentComponentDict = [self componentsForParentId:parentComponentId];
21 21
 	
22
-	RNNReactView* reactView = [parentComponentDict objectForKey:component.componentId.get];
22
+	RNNReactView* reactView = parentComponentDict[component.componentId.get];
23 23
 	if (!reactView) {
24 24
 		reactView = (RNNReactView *)[_creator createRootViewFromComponentOptions:component reactViewReadyBlock:reactViewReadyBlock];
25
-		[parentComponentDict setObject:reactView forKey:component.componentId.get];
25
+		parentComponentDict[component.componentId.get] = reactView;
26 26
 	} else if (reactViewReadyBlock) {
27 27
 		reactViewReadyBlock();
28 28
 	}
@@ -50,8 +50,9 @@
50 50
 
51 51
 - (void)removeChildComponent:(NSString *)childId {
52 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 56
 			[parent removeObjectForKey:childId];
56 57
 			return;
57 58
 		}