Skip to content

Commit ac96b23

Browse files
authored
feat: make more tab pressable (#303)
1 parent b9c9840 commit ac96b23

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.changeset/young-experts-exercise.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+
feat: make more tab pressable on iOS

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import SwiftUI
22
import SwiftUIIntrospect
3+
import UIKit
34

45
#if !os(macOS) && !os(visionOS)
56

67
private final class TabBarDelegate: NSObject, UITabBarControllerDelegate {
78
var onClick: ((_ index: Int) -> Void)? = nil
89

910
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
11+
#if os(iOS)
12+
// Handle "More" Tab
13+
if tabBarController.moreNavigationController == viewController {
14+
return true
15+
}
16+
#endif
17+
1018
if let index = tabBarController.viewControllers?.firstIndex(of: viewController) {
1119
onClick?(index)
1220
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ struct TabViewImpl: View {
8787

8888
RepresentableView(view: child)
8989
.ignoresTopSafeArea(
90-
props.ignoresTopSafeArea,
91-
frame: child.frame
90+
props.ignoresTopSafeArea
9291
)
9392
.tabItem {
9493
TabItem(
@@ -293,8 +292,7 @@ extension View {
293292

294293
@ViewBuilder
295294
func ignoresTopSafeArea(
296-
_ flag: Bool,
297-
frame: CGRect
295+
_ flag: Bool
298296
) -> some View {
299297
if flag {
300298
self

0 commit comments

Comments
 (0)