Skip to content

Commit

Permalink
fix: supersede Platform.isTVOS for Platform.isTV (react-navigation#10973
Browse files Browse the repository at this point in the history
)

**Motivation**

This PR supersedes a deprecated `Platform.isTVOS` which got removed in
facebook/react-native#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: software-mansion/react-native-screens#1605
  • Loading branch information
VickyA371 authored and satya164 committed Nov 27, 2022
1 parent 10d4d00 commit 156cbde
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/elements/src/Header/getDefaultHeaderHeight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions packages/native-stack/src/views/NativeStackView.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 156cbde

Please sign in to comment.