-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: do not rerender tab on navigate #26
Changes from all commits
30d8384
7b2850d
e808fa2
d5e9870
d494b01
1bb8095
0a89f6f
a146f34
f4f370d
bec6b94
cd56569
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,30 +96,32 @@ public struct TabBar<TabItem: Tabbable, Content: View>: View { | |
.frame(maxWidth: .infinity) | ||
} | ||
} | ||
|
||
|
||
public var body: some View { | ||
ZStack { | ||
self.content | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.environmentObject(self.selectedItem) | ||
|
||
GeometryReader { geometry in | ||
VStack { | ||
Spacer() | ||
|
||
self.tabBarStyle.tabBar(with: geometry) { | ||
.init(self.tabItems) | ||
} | ||
} | ||
.edgesIgnoringSafeArea(.bottom) | ||
.visibility(self.visibility) | ||
} | ||
} | ||
.onPreferenceChange(TabBarPreferenceKey.self) { value in | ||
self.items = value | ||
} | ||
} | ||
|
||
public var body: some View { | ||
GeometryReader { geometry in | ||
ZStack { | ||
self.content | ||
.environmentObject(self.selectedItem) | ||
.padding(.bottom, 50) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please clarify why we need this padding here, and what does value of 50 points mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Child view of TabBar collides with TabBar without this. 50 is the DefaultTabBarStyle tabbar height. Bottom 50px of view is not visible without this padding. |
||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
|
||
VStack { | ||
Spacer() | ||
|
||
self.tabBarStyle.tabBar(with: geometry) { | ||
.init(self.tabItems) | ||
} | ||
} | ||
.edgesIgnoringSafeArea(.bottom) | ||
.visibility(self.visibility) | ||
} | ||
.onPreferenceChange(TabBarPreferenceKey.self) { value in | ||
self.items = value | ||
} | ||
} | ||
.ignoresSafeArea(.keyboard) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain why we need this here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you use a keyboard inside a child view of tabbar. The tabbar moves up with keyboard without this modifier. This is the reason I increased iOS version from 13 to 14. |
||
} | ||
} | ||
|
||
extension TabBar { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use
.v14
value hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing a point?