Keep moving forward

  • Morgan Pretty's avatar
    ActionSheetIOS support for presentation from modal view controller · 43dcdaff
    Morgan Pretty authored
    Summary:
    Currently the RCTActionSheetManager attempts to present itself from the 'rootViewController' of the key window, presenting a modal from a view controller which is already presenting a modal is not allowed on iOS and this fails with the following error appearing in the XCode debugger (but not the chrome debugger):
    
    ```
    Warning: Attempt to present <UIAlertController: 0x7fca85b14f40> on <UINavigationController: 0x7fca84812000> whose view is not in the window hierarchy!
    ```
    
    This change recursively looks through modally presented view controllers until it finds the top one and then uses that to present the action sheet.
    Closes https://github.com/facebook/react-native/pull/5263
    
    Reviewed By: svcscm
    
    Differential Revision: D2823201
    
    Pulled By: nicklockwood
    
    fb-gh-sync-id: aad1ad88115563f633fd9aaea8e27d1d155a6c27
    43dcdaff
RCTActionSheetManager.m 7.84 KB