diff --git a/.changeset/dull-walls-share.md b/.changeset/dull-walls-share.md new file mode 100644 index 00000000..4bffbc6d --- /dev/null +++ b/.changeset/dull-walls-share.md @@ -0,0 +1,5 @@ +--- +'react-native-bottom-tabs': patch +--- + +feat: make tabview background transparent diff --git a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift index 4f57dca2..7b695c9d 100644 --- a/packages/react-native-bottom-tabs/ios/TabViewImpl.swift +++ b/packages/react-native-bottom-tabs/ios/TabViewImpl.swift @@ -56,6 +56,8 @@ struct TabViewImpl: View { } #endif .introspectTabView { tabController in + tabController.view.backgroundColor = .clear + tabController.viewControllers?.forEach { $0.view.backgroundColor = .clear } #if os(macOS) tabBar = tabController #else diff --git a/packages/react-native-bottom-tabs/ios/TabViewProvider.swift b/packages/react-native-bottom-tabs/ios/TabViewProvider.swift index ccefac5c..53e450c7 100644 --- a/packages/react-native-bottom-tabs/ios/TabViewProvider.swift +++ b/packages/react-native-bottom-tabs/ios/TabViewProvider.swift @@ -45,7 +45,7 @@ public final class TabInfo: NSObject { } @objc public class TabViewProvider: PlatformView { - private var delegate: TabViewProviderDelegate? + private weak var delegate: TabViewProviderDelegate? private var props = TabViewProps() private var hostingController: PlatformHostingController? private var coalescingKey: UInt16 = 0 @@ -212,6 +212,7 @@ public final class TabInfo: NSObject { if let hostingController = self.hostingController, let parentViewController = reactViewController() { parentViewController.addChild(hostingController) + hostingController.view.backgroundColor = .clear addSubview(hostingController.view) hostingController.view.translatesAutoresizingMaskIntoConstraints = false hostingController.view.pinEdges(to: self)