Skip to content

Commit fc8b828

Browse files
authored
fix: exclude macOS from iOS 26+ bottom accessory APIs (#486)
1 parent 134d585 commit fc8b828

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.changeset/cold-mice-fold.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: macos bottom accessory view compilation

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import SwiftUI
88
self.delegate = delegate
99
}
1010

11+
#if !os(macOS)
1112
@available(iOS 26.0, *)
1213
public func emitPlacementChanged(_ placement: TabViewBottomAccessoryPlacement?) {
1314
var placementValue = "none"
@@ -18,6 +19,7 @@ import SwiftUI
1819
}
1920
self.delegate?.onPlacementChanged(placement: placementValue)
2021
}
22+
#endif
2123
}
2224

2325
@objc public protocol BottomAccessoryProviderDelegate {

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,34 @@ struct ConditionalBottomAccessoryModifier: ViewModifier {
6767
}
6868

6969
func body(content: Content) -> some View {
70-
if #available(iOS 26.0, macOS 26.0, tvOS 26.0, visionOS 3.0, *), bottomAccessoryView != nil {
70+
#if os(macOS)
71+
// tabViewBottomAccessory is not available on macOS
72+
content
73+
#else
74+
if #available(iOS 26.0, tvOS 26.0, visionOS 3.0, *), bottomAccessoryView != nil {
7175
content
7276
.tabViewBottomAccessory {
7377
renderBottomAccessoryView()
7478
}
7579
} else {
7680
content
7781
}
82+
#endif
7883
}
7984

8085
@ViewBuilder
8186
private func renderBottomAccessoryView() -> some View {
87+
#if !os(macOS)
8288
if let bottomAccessoryView {
8389
if #available(iOS 26.0, *) {
8490
BottomAccessoryRepresentableView(view: bottomAccessoryView)
8591
}
8692
}
93+
#endif
8794
}
8895
}
8996

97+
#if !os(macOS)
9098
@available(iOS 26.0, *)
9199
struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
92100
@Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
@@ -115,3 +123,4 @@ struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
115123
}
116124
}
117125
}
126+
#endif

0 commit comments

Comments
 (0)