Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-mice-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-native-bottom-tabs': patch
---

fix: macos bottom accessory view compilation
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import SwiftUI
self.delegate = delegate
}

#if !os(macOS)
@available(iOS 26.0, *)
public func emitPlacementChanged(_ placement: TabViewBottomAccessoryPlacement?) {
var placementValue = "none"
Expand All @@ -18,6 +19,7 @@ import SwiftUI
}
self.delegate?.onPlacementChanged(placement: placementValue)
}
#endif
}

@objc public protocol BottomAccessoryProviderDelegate {
Expand Down
11 changes: 10 additions & 1 deletion packages/react-native-bottom-tabs/ios/TabView/NewTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,34 @@ struct ConditionalBottomAccessoryModifier: ViewModifier {
}

func body(content: Content) -> some View {
if #available(iOS 26.0, macOS 26.0, tvOS 26.0, visionOS 3.0, *), bottomAccessoryView != nil {
#if os(macOS)
// tabViewBottomAccessory is not available on macOS
content
#else
if #available(iOS 26.0, tvOS 26.0, visionOS 3.0, *), bottomAccessoryView != nil {
content
.tabViewBottomAccessory {
renderBottomAccessoryView()
}
} else {
content
}
#endif
}

@ViewBuilder
private func renderBottomAccessoryView() -> some View {
#if !os(macOS)
if let bottomAccessoryView {
if #available(iOS 26.0, *) {
BottomAccessoryRepresentableView(view: bottomAccessoryView)
}
}
#endif
}
}

#if !os(macOS)
@available(iOS 26.0, *)
struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
@Environment(\.tabViewBottomAccessoryPlacement) var tabViewBottomAccessoryPlacement
Expand Down Expand Up @@ -115,3 +123,4 @@ struct BottomAccessoryRepresentableView: PlatformViewRepresentable {
}
}
}
#endif
Loading