Skip to content

Commit

Permalink
Prevent retaining button component in componentRegistry (#4888)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd authored and guyca committed Mar 20, 2019
1 parent 5ba7ccb commit 0186b1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ios/RNNReactComponentRegistry.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@interface RNNReactComponentRegistry () {
id<RNNRootViewCreator> _creator;
NSMutableDictionary* _componentStore;
NSMapTable* _componentStore;
}

@end
Expand All @@ -12,7 +12,7 @@ @implementation RNNReactComponentRegistry
- (instancetype)initWithCreator:(id<RNNRootViewCreator>)creator {
self = [super init];
_creator = creator;
_componentStore = [NSMutableDictionary new];
_componentStore = [NSMapTable strongToWeakObjectsMapTable];
return self;
}

Expand All @@ -31,7 +31,7 @@ - (RNNReactView *)createComponentIfNotExists:(RNNComponentOptions *)component pa
}

- (NSMutableDictionary *)componentsForParentId:(NSString *)parentComponentId {
if (!_componentStore[parentComponentId]) {
if (![_componentStore objectForKey:parentComponentId]) {
[_componentStore setObject:[NSMutableDictionary new] forKey:parentComponentId];;
}

Expand Down

0 comments on commit 0186b1a

Please sign in to comment.