diff --git a/packages/react-native/Libraries/Utilities/Platform.d.ts b/packages/react-native/Libraries/Utilities/Platform.d.ts index e80241e807d934..82246df0ffb4b0 100644 --- a/packages/react-native/Libraries/Utilities/Platform.d.ts +++ b/packages/react-native/Libraries/Utilities/Platform.d.ts @@ -55,6 +55,7 @@ interface PlatformIOSStatic extends PlatformStatic { OS: 'ios'; isPad: boolean; isTV: boolean; + isVision: boolean; isMacCatalyst?: boolean | undefined; Version: string; } diff --git a/packages/react-native/Libraries/Utilities/Platform.flow.js b/packages/react-native/Libraries/Utilities/Platform.flow.js index b0c23b4fe77cc5..cb5e56871aad2f 100644 --- a/packages/react-native/Libraries/Utilities/Platform.flow.js +++ b/packages/react-native/Libraries/Utilities/Platform.flow.js @@ -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, diff --git a/packages/react-native/Libraries/Utilities/Platform.ios.js b/packages/react-native/Libraries/Utilities/Platform.ios.js index 4c5377395c0b3b..1fa1b83ab44cc0 100644 --- a/packages/react-native/Libraries/Utilities/Platform.ios.js +++ b/packages/react-native/Libraries/Utilities/Platform.ios.js @@ -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] diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 7bd8f7b59eb40a..5a52f701e3bf0d 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -9910,6 +9910,7 @@ type IOSPlatform = { |}, get isPad(): boolean, get isTV(): boolean, + get isVision(): boolean, get isTesting(): boolean, get isDisableAnimations(): boolean, get isMacCatalyst(): boolean, diff --git a/packages/react-native/React/CoreModules/RCTPlatform.mm b/packages/react-native/React/CoreModules/RCTPlatform.mm index d6ceed27dfa320..a908677a3c66c3 100644 --- a/packages/react-native/React/CoreModules/RCTPlatform.mm +++ b/packages/react-native/React/CoreModules/RCTPlatform.mm @@ -30,6 +30,10 @@ return @"tv"; case UIUserInterfaceIdiomCarPlay: return @"carplay"; +#if TARGET_OS_VISION + case UIUserInterfaceIdiomVision: + return @"vision"; +#endif default: return @"unknown"; }