Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: RCTAlertController's UserInterfaceStyle to follow root window (#…
…34218) Summary: The motivation of this PR is for the Alert to follow the same style override (`overrideUserInterfaceStyle` being light/dark) as the one used by the root window (`UIApplication.sharedApplication.delegate.window`). This is something that has worked previously because `RCTPResentedViewController()` was used to present the Alert (the behavior has changed in vonovak@f319ff3). With the former approach, the alert would "inherit" the `userInterfaceStyle` of the view controller it was presented within (and that one, in turn, would "inherit" from `UIApplication.sharedApplication.delegate.window`). With the current approach, the "style inheritance" does not work with the view controller being created [here](https://github.com/facebook/react-native/blob/f3db6cc52792e3006a16408df4ae40f3aee19a86/React/CoreModules/RCTAlertController.m#L24). Because this viewcontroller instance does not have where to "inherit" the styling from, the styling might be different from the rest of the app. This PR fixes that. ## Changelog [iOS] [Fixed] - fix: RCTAlertController's UserInterfaceStyle to follow root window Pull Request resolved: #34218 Test Plan: Instead of ``` self.overrideUserInterfaceStyle = UIApplication.sharedApplication.delegate.window.overrideUserInterfaceStyle; ``` you can do ``` self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark; ``` and observe the result. So if the override is set, it'll manifest itself. If it's not set, the value of `UIApplication.sharedApplication.delegate.window.overrideUserInterfaceStyle` will be `UIUserInterfaceStyleUnspecified`, and it'll have no effect. <details> <summary>screenshot</summary>  </details> Reviewed By: dmitryrykun Differential Revision: D38660799 Pulled By: cipolleschi fbshipit-source-id: c979266900e27be7a4732bdb6e9a496906534931
- Loading branch information