소스 검색

Prevent retaining button component in componentRegistry (#4888)

Yogev Ben David 6 년 전
부모
커밋
0186b1ac36
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3
    3
      lib/ios/RNNReactComponentRegistry.m

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

2
 
2
 
3
 @interface RNNReactComponentRegistry () {
3
 @interface RNNReactComponentRegistry () {
4
 	id<RNNRootViewCreator> _creator;
4
 	id<RNNRootViewCreator> _creator;
5
-	NSMutableDictionary* _componentStore;
5
+	NSMapTable* _componentStore;
6
 }
6
 }
7
 
7
 
8
 @end
8
 @end
12
 - (instancetype)initWithCreator:(id<RNNRootViewCreator>)creator {
12
 - (instancetype)initWithCreator:(id<RNNRootViewCreator>)creator {
13
 	self = [super init];
13
 	self = [super init];
14
 	_creator = creator;
14
 	_creator = creator;
15
-	_componentStore = [NSMutableDictionary new];
15
+	_componentStore = [NSMapTable strongToWeakObjectsMapTable];
16
 	return self;
16
 	return self;
17
 }
17
 }
18
 
18
 
31
 }
31
 }
32
 
32
 
33
 - (NSMutableDictionary *)componentsForParentId:(NSString *)parentComponentId {
33
 - (NSMutableDictionary *)componentsForParentId:(NSString *)parentComponentId {
34
-	if (!_componentStore[parentComponentId]) {
34
+	if (![_componentStore objectForKey:parentComponentId]) {
35
 		[_componentStore setObject:[NSMutableDictionary new] forKey:parentComponentId];;
35
 		[_componentStore setObject:[NSMutableDictionary new] forKey:parentComponentId];;
36
 	}
36
 	}
37
 	
37