From fd7f5bb76868dced03747a8c128600993378c2ce Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 4 Jun 2019 07:06:06 -0700 Subject: [PATCH] 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 --- React/Views/RCTModalHostViewManager.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/React/Views/RCTModalHostViewManager.m b/React/Views/RCTModalHostViewManager.m index 495b90d2ddd..28c1c5e9423 100644 --- a/React/Views/RCTModalHostViewManager.m +++ b/React/Views/RCTModalHostViewManager.m @@ -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)