Keep the order of Modals that we can dismiss in sequence (#24961)

Summary:
Fixes https://github.com/facebook/react-native/issues/16037.
We need to keep the order of Modals, if we dismiss Modal randomly(before we use hash table), some Modals may not dismiss successfully.

This PR should based on https://github.com/facebook/react-native/pull/24959.

## Changelog

[iOS] [Fixed] - Keep the order of Modals that we can dismiss in sequence
Pull Request resolved: https://github.com/facebook/react-native/pull/24961

Differential Revision: D15621858

Pulled By: cpojer

fbshipit-source-id: 964729f8f4584995f4e1dd527af4b61534d369ba
This commit is contained in:
zhongwuzw 2019-06-04 07:06:06 -07:00 коммит произвёл Facebook Github Bot
Родитель afc142bc76
Коммит fd7f5bb768
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -49,7 +49,7 @@ RCT_ENUM_CONVERTER(UIModalPresentationStyle, (@{
@implementation RCTModalHostViewManager
{
NSHashTable *_hostViews;
NSPointerArray *_hostViews;
}
RCT_EXPORT_MODULE()
@ -59,9 +59,9 @@ RCT_EXPORT_MODULE()
RCTModalHostView *view = [[RCTModalHostView alloc] initWithBridge:self.bridge];
view.delegate = self;
if (!_hostViews) {
_hostViews = [NSHashTable weakObjectsHashTable];
_hostViews = [NSPointerArray weakObjectsPointerArray];
}
[_hostViews addObject:view];
[_hostViews addPointer:(__bridge void *)view];
return view;
}
@ -104,7 +104,7 @@ RCT_EXPORT_MODULE()
for (RCTModalHostView *hostView in _hostViews) {
[hostView invalidate];
}
[_hostViews removeAllObjects];
_hostViews = nil;
}
RCT_EXPORT_VIEW_PROPERTY(animationType, NSString)