Skip to content
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

Closed
wants to merge 11 commits into from

Conversation

Yunus-Gedik
Copy link

by using opacity, instead of if; tabs view state stays on changing to another tab. If you have a scroll view and user scrolled, switching tab and returning back preserves scroll view state. Tab view do not reinit.

Copy link
Owner

@onl1ner onl1ner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello and thanks for your PR!

I have indicated some small issues that should be fixed before we move forward with the merge. Also, if the thing with ignoring keyboard area is not connected with the issue #7, it should be moved into separate PR.

@@ -5,7 +5,7 @@ import PackageDescription
let package = Package(
name: "TabBar",
platforms: [
.iOS(.v13)
.iOS("14")
Copy link
Owner

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 here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Am I missing a point?

Comment on lines 33 to 34
content
.opacity(self.item == self.selectionObject.selection ? 1 : 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct indentation of opacity modifier

ZStack {
self.content
.environmentObject(self.selectedItem)
.padding(.bottom, 50)
Copy link
Owner

Choose a reason for hiding this comment

The 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?

Copy link
Author

Choose a reason for hiding this comment

The 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.

self.items = value
}
}
.ignoresSafeArea(.keyboard)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why we need this here?

Copy link
Author

Choose a reason for hiding this comment

The 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.

@Yunus-Gedik
Copy link
Author

Ignoring keyboard codes are not related. Sorry for that, I will seperate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants