mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b58e176af0
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/28058 I'm taking the first step towards supporting iOS 13 UIScene APIs and modernizing React Native not to assume an app only has a single window. See discussion here: https://github.com/facebook/react-native/issues/25181#issuecomment-505612941 The approach I'm taking is to take advantage of `RootTagContext` and passing it to NativeModules so that they can identify correctly which window they refer to. Here I'm just laying groundwork. - [x] `Alert` and `ActionSheetIOS` take an optional `rootTag` argument that will cause them to appear on the correct window - [x] `StatusBar` methods also have `rootTag` argument added, but it's not fully hooked up on the native side — this turns out to require some more work, see: https://github.com/facebook/react-native/issues/25181#issuecomment-506690818 - [x] `setNetworkActivityIndicatorVisible` is deprecated in iOS 13 - [x] `RCTPerfMonitor`, `RCTProfile` no longer assume `UIApplicationDelegate` has a `window` property (no longer the best practice) — they now just render on the key window Next steps: Add VC-based status bar management (if I get the OK on https://github.com/facebook/react-native/issues/25181#issuecomment-506690818 ), add multiple window demo to RNTester, deprecate Dimensions in favor of a layout context, consider adding hook-based APIs for native modules such as Alert that automatically know which rootTag to pass ## Changelog [Internal] [Changed] - Modernize Modal to use RootTagContext [iOS] [Changed] - `Alert`, `ActionSheetIOS`, `StatusBar` methods now take an optional `surface` argument (for future iPadOS 13 support) [iOS] [Changed] - RCTPresentedViewController now takes a nullable `window` arg [Internal] [Changed] - Do not assume `UIApplicationDelegate` has a `window` property Pull Request resolved: https://github.com/facebook/react-native/pull/25425 Test Plan: - Open RNTester and: - go to Modal and check if it still works - Alert → see if works - ACtionSheetIOS → see if it works - StatusBar → see if it works - Share → see if it works Reviewed By: PeteTheHeat Differential Revision: D16957751 Pulled By: hramos fbshipit-source-id: ae2a4478e2e7f8d2be3022c9c4861561ec244a26
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type {TurboModule} from '../../TurboModule/RCTExport';
|
|
import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';
|
|
|
|
export interface Spec extends TurboModule {
|
|
+getConstants: () => {|
|
|
+HEIGHT: number,
|
|
+DEFAULT_BACKGROUND_COLOR?: number,
|
|
|};
|
|
|
|
// TODO(T47754272) Can we remove this method?
|
|
+getHeight: (callback: (result: {|height: number|}) => void) => void;
|
|
+setNetworkActivityIndicatorVisible: (visible: boolean) => void;
|
|
+addListener: (eventType: string) => void;
|
|
+removeListeners: (count: number) => void;
|
|
|
|
/**
|
|
* - statusBarStyles can be:
|
|
* - 'default'
|
|
* - 'dark-content'
|
|
* - 'light-content'
|
|
*/
|
|
+setStyle: (
|
|
statusBarStyle?: ?string,
|
|
animated: boolean,
|
|
reactTag?: number,
|
|
) => void;
|
|
/**
|
|
* - withAnimation can be: 'none' | 'fade' | 'slide'
|
|
*/
|
|
+setHidden: (
|
|
hidden: boolean,
|
|
withAnimation: string,
|
|
reactTag?: number,
|
|
) => void;
|
|
}
|
|
|
|
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
|
'StatusBarManager',
|
|
): Spec);
|