Skip to content

Commit 1c5b385

Browse files
oscnordthiagobrez
andauthored
fix: add tvOS availability annotations for iOS 26 APIs (#508)
* fix: add tvOS availability annotations for iOS 26 APIs Several iOS 26 APIs used in the library lack tvOS availability annotations, causing compilation failures when building for tvOS: - `TabViewBottomAccessoryPlacement` needs `tvOS 26.0` availability - `.tabViewBottomAccessory` modifier is unavailable on tvOS — excluded via `#if` - `TabBarMinimizeBehavior` enum values (.never, .onScrollUp, .onScrollDown) are unavailable on tvOS — falls back to `.automatic` - `tabBarMinimizeBehavior` view modifier needs `tvOS 26.0` availability check * chore: add changeset --------- Co-authored-by: Thiago Brezinski <thiagobrez@gmail.com>
1 parent 1db5579 commit 1c5b385

5 files changed

Lines changed: 14 additions & 9 deletions

File tree

.changeset/short-teeth-fix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-bottom-tabs': patch
3+
---
4+
5+
Fix tvOS compilation due to unavailable APIs

packages/react-native-bottom-tabs/ios/BottomAccessoryProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import SwiftUI
99
}
1010

1111
#if !os(macOS)
12-
@available(iOS 26.0, *)
12+
@available(iOS 26.0, tvOS 26.0, *)
1313
public func emitPlacementChanged(_ placement: TabViewBottomAccessoryPlacement?) {
1414
var placementValue = "none"
1515
if placement == .inline {

packages/react-native-bottom-tabs/ios/TabView/NewTabView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ struct ConditionalBottomAccessoryModifier: ViewModifier {
7878
}
7979

8080
func body(content: Content) -> some View {
81-
#if os(macOS)
81+
#if os(macOS) || os(tvOS)
8282
// tabViewBottomAccessory is not available on macOS
8383
content
8484
#else
85-
if #available(iOS 26.0, tvOS 26.0, visionOS 3.0, *), bottomAccessoryView != nil {
85+
if #available(iOS 26.0, visionOS 3.0, *), bottomAccessoryView != nil {
8686
content
8787
.tabViewBottomAccessory {
8888
renderBottomAccessoryView()
@@ -95,7 +95,7 @@ struct ConditionalBottomAccessoryModifier: ViewModifier {
9595

9696
@ViewBuilder
9797
private func renderBottomAccessoryView() -> some View {
98-
#if !os(macOS)
98+
#if !os(macOS) && !os(tvOS)
9999
if let bottomAccessoryView {
100100
if #available(iOS 26.0, *) {
101101
BottomAccessoryRepresentableView(view: bottomAccessoryView)
@@ -105,8 +105,8 @@ struct ConditionalBottomAccessoryModifier: ViewModifier {
105105
}
106106
}
107107

108-
#if !os(macOS)
109-
@available(iOS 26.0, *)
108+
#if !os(macOS) && !os(tvOS)
109+
@available(iOS 26.0, tvOS 26.0, *)
110110
struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
111111
@Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
112112
var view: PlatformView

packages/react-native-bottom-tabs/ios/TabViewImpl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ extension View {
282282
@ViewBuilder
283283
func tabBarMinimizeBehavior(_ behavior: MinimizeBehavior?) -> some View {
284284
#if compiler(>=6.2)
285-
if #available(iOS 26.0, macOS 26.0, *) {
285+
if #available(iOS 26.0, macOS 26.0, tvOS 26.0, *) {
286286
if let behavior {
287287
self.tabBarMinimizeBehavior(behavior.convert())
288288
} else {

packages/react-native-bottom-tabs/ios/TabViewProps.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ internal enum MinimizeBehavior: String {
77
case onScrollDown
88

99
#if compiler(>=6.2)
10-
@available(iOS 26.0, macOS 26.0, *)
10+
@available(iOS 26.0, macOS 26.0, tvOS 26.0, *)
1111
func convert() -> TabBarMinimizeBehavior {
12-
#if os(macOS)
12+
#if os(macOS) || os(tvOS)
1313
return .automatic
1414
#else
1515
switch self {

0 commit comments

Comments
 (0)