Parcourir la source

Prevent retaining button component in componentRegistry (#4888)

Yogev Ben David il y a 6 ans
Parent
révision
0186b1ac36
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3
    3
      lib/ios/RNNReactComponentRegistry.m

+ 3
- 3
lib/ios/RNNReactComponentRegistry.m Voir le fichier

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