From 156cbded3d36412d6499fe7b78cfd8c7106eb459 Mon Sep 17 00:00:00 2001 From: VickyA371 <109548803+VickyA371@users.noreply.github.com> Date: Mon, 7 Nov 2022 15:03:45 +0530 Subject: [PATCH] fix: supersede Platform.isTVOS for Platform.isTV (#10973) **Motivation** This PR supersedes a deprecated `Platform.isTVOS` which got removed in https://github.com/facebook/react-native/pull/34071 for the currently used standard - a `Platform.isTV` check. `Platform.isTV` check exists since react-native `v0.61` that way no breaking changes are introduced to react-navigation. Ref: https://github.com/software-mansion/react-native-screens/pull/1605 --- packages/elements/src/Header/getDefaultHeaderHeight.tsx | 2 +- packages/native-stack/src/views/NativeStackView.native.tsx | 3 +-- .../stack/src/TransitionConfigs/CardStyleInterpolators.tsx | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/elements/src/Header/getDefaultHeaderHeight.tsx b/packages/elements/src/Header/getDefaultHeaderHeight.tsx index d2dee788ff..cb117b900e 100644 --- a/packages/elements/src/Header/getDefaultHeaderHeight.tsx +++ b/packages/elements/src/Header/getDefaultHeaderHeight.tsx @@ -12,7 +12,7 @@ export default function getDefaultHeaderHeight( const isLandscape = layout.width > layout.height; if (Platform.OS === 'ios') { - if (Platform.isPad || Platform.isTVOS) { + if (Platform.isPad || Platform.isTV) { if (modalPresentation) { headerHeight = 56; } else { diff --git a/packages/native-stack/src/views/NativeStackView.native.tsx b/packages/native-stack/src/views/NativeStackView.native.tsx index f605bd8406..37deb79ff2 100644 --- a/packages/native-stack/src/views/NativeStackView.native.tsx +++ b/packages/native-stack/src/views/NativeStackView.native.tsx @@ -204,8 +204,7 @@ const SceneView = ({ const isModal = presentation === 'modal' || presentation === 'formSheet'; // Modals are fullscreen in landscape only on iPhone - const isIPhone = - Platform.OS === 'ios' && !(Platform.isPad || Platform.isTVOS); + const isIPhone = Platform.OS === 'ios' && !(Platform.isPad || Platform.isTV); const isLandscape = frame.width > frame.height; const isParentHeaderShown = React.useContext(HeaderShownContext); diff --git a/packages/stack/src/TransitionConfigs/CardStyleInterpolators.tsx b/packages/stack/src/TransitionConfigs/CardStyleInterpolators.tsx index a59b8d73eb..fc5db3646d 100644 --- a/packages/stack/src/TransitionConfigs/CardStyleInterpolators.tsx +++ b/packages/stack/src/TransitionConfigs/CardStyleInterpolators.tsx @@ -101,7 +101,7 @@ export function forModalPresentationIOS({ const hasNotchIos = Platform.OS === 'ios' && !Platform.isPad && - !Platform.isTVOS && + !Platform.isTV && insets.top > 20; const isLandscape = screen.width > screen.height; const topOffset = isLandscape ? 0 : 10;