mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
iOS: Introduce vision interfaceIdiom (#42243)
Summary: This PR introduces the `vision` interfaceIdiom to check if the app runs on visionOS. An update to the documentation should follow this change. ## Changelog: [IOS] [ADDED] - Introduce `vision` interfaceIdiom Pull Request resolved: https://github.com/facebook/react-native/pull/42243 Test Plan: This change has been used in `react-native-visionos` and the interfaceIdiom changes **only** when running in the non-compatibility mode. But it's still useful to have this upstream if at some point React native would compile to visionOS natively Reviewed By: cortinico Differential Revision: D52730028 Pulled By: cipolleschi fbshipit-source-id: 711c5c2c6c7fe05b3ff8da7383b5e63e9e04acfa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8211cb8986
commit
258d8e51b4
@@ -55,6 +55,7 @@ interface PlatformIOSStatic extends PlatformStatic {
|
||||
OS: 'ios';
|
||||
isPad: boolean;
|
||||
isTV: boolean;
|
||||
isVision: boolean;
|
||||
isMacCatalyst?: boolean | undefined;
|
||||
Version: string;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ type IOSPlatform = {
|
||||
// $FlowFixMe[unsafe-getters-setters]
|
||||
get isTV(): boolean,
|
||||
// $FlowFixMe[unsafe-getters-setters]
|
||||
get isVision(): boolean,
|
||||
// $FlowFixMe[unsafe-getters-setters]
|
||||
get isTesting(): boolean,
|
||||
// $FlowFixMe[unsafe-getters-setters]
|
||||
get isDisableAnimations(): boolean,
|
||||
|
||||
@@ -58,6 +58,11 @@ const Platform: PlatformType = {
|
||||
return this.constants.interfaceIdiom === 'tv';
|
||||
},
|
||||
// $FlowFixMe[unsafe-getters-setters]
|
||||
get isVision(): boolean {
|
||||
// $FlowFixMe[object-this-reference]
|
||||
return this.constants.interfaceIdiom === 'vision';
|
||||
},
|
||||
// $FlowFixMe[unsafe-getters-setters]
|
||||
get isTesting(): boolean {
|
||||
if (__DEV__) {
|
||||
// $FlowFixMe[object-this-reference]
|
||||
|
||||
@@ -9910,6 +9910,7 @@ type IOSPlatform = {
|
||||
|},
|
||||
get isPad(): boolean,
|
||||
get isTV(): boolean,
|
||||
get isVision(): boolean,
|
||||
get isTesting(): boolean,
|
||||
get isDisableAnimations(): boolean,
|
||||
get isMacCatalyst(): boolean,
|
||||
|
||||
@@ -30,6 +30,10 @@ static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom)
|
||||
return @"tv";
|
||||
case UIUserInterfaceIdiomCarPlay:
|
||||
return @"carplay";
|
||||
#if TARGET_OS_VISION
|
||||
case UIUserInterfaceIdiomVision:
|
||||
return @"vision";
|
||||
#endif
|
||||
default:
|
||||
return @"unknown";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user