Browse Source

Prevent retaining button component in componentRegistry (#4888)

Yogev Ben David 5 years ago
parent
commit
0186b1ac36
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      lib/ios/RNNReactComponentRegistry.m

+ 3
- 3
lib/ios/RNNReactComponentRegistry.m View File

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