Comments (12)
An update. I know longer think that nav bar is the issue I am seeing so I don't think there is a bug here. Hiding nav bar removed much of my issue but it came back in a different case. After further debugging, it seems that my complicated view, where content was shifting down randomly was more easily fixed by making the view ignore safe areas such that the view under the tab bar extended to the bottom of the screen. Then on redraws, it would always fit to the bottom of the screen and I just made sure all the content shows above the tab bar.
I am hiding and showing the tab bar and that creates this odd behavior in SwiftUI which doesn't look like it is well tested for this case.
Anyway, if anyone else has the issue, try my approach. Amir thanks for your consideration on this.
from collectionviewpaginglayout.
Hi, did you solve this? I'm seeing this also now on iOS 15.6.1 and iOS 14.8
from collectionviewpaginglayout.
I found a solution using: https://github.com/siteline/SwiftUI-Introspect.
On your VStack above, use this:
.introspectNavigationController(customize: { NavController in NavController.navigationBar.isHidden = true navBar? = NavController.navigationBar navBar?.isHidden = true })
And add a State variable for the Nav Bar:
@State private var navBar: UINavigationBar?
In onAppear, add,
navBar?.isHidden = true
And I added it in a onChange modifier to. I think anywhere the view could get redrawn hide the nav bar.
from collectionviewpaginglayout.
The above approach solve the issue in SwiftUI where the view with a ScalePageView shifts down randomly. I found it is because the Nav Bar is being added, even if you have it turned off in your code above in SwiftUI. Somehow this framework is showing it's own nav bar and so that has to be hidden.
from collectionviewpaginglayout.
@harveyjhuang @daver234 I had the quick fix in the fork
from collectionviewpaginglayout.
Great thanks. Are you maintaining this fork or are you proposing to merge it back to master here?
from collectionviewpaginglayout.
@harveyjhuang Hi, I'm just looking at your code and something seems incorrect.
In order to hide the navigation bar we should use ".navigationBarHidden(true)" in your code and the description it's ".navigationBarHidden(false)" which means the navigation bar should be hidden but you expect the navigation bar to be hidden.
from collectionviewpaginglayout.
@amirdew So do you have an alternative fix for this issue?
from collectionviewpaginglayout.
I can't reproduce the error, could you share a simple project that shows the bug?
from collectionviewpaginglayout.
It is part of our bigger app so I can't easily extract to show the bug. A key difference is that I am using SwiftUI TabView and showing and hiding tab view at various points. A key area we have a problem is that we load a web view, full screen, with TabView hidden, then when exist out of the web view, the resulting view has content shifted down and in the debugging the view hierarchy I see a nav bar at the top.
from collectionviewpaginglayout.
That seems like a different problem than what is described in the issue.
A simple NavigationView doesn't have a problem with hiding the navigation bar:
extension UUID: Identifiable {
public var id: String {
uuidString
}
}
struct ContentView: View {
let items: [UUID] = [
.init(),
.init(),
.init()
]
var body: some View {
NavigationView {
ScalePageView(items) { item in
Text(item.uuidString)
}
.pagePadding(horizontal: .absolute(100))
.navigationTitle("Title")
.navigationBarHidden(true)
}
}
}
from collectionviewpaginglayout.
Our use case is more complicated as I am using ScalePageView (for image display) on a view with multiple stacks and at different Z values. Our version should be live within the week then I could send you a video to show you more specifically what I am seeing. Thanks.
from collectionviewpaginglayout.
Related Issues (20)
- swiftui ensure currentPage is greater than or equal to zero to prevent Index out of range error HOT 1
- Xcode 13.3 and swift version 5.6 Archiving issue ### HOT 1
- Hello, I encountered a problem with UI debugging or description during the development process HOT 1
- Vertical orientation of items HOT 1
- Suggestion for automatic looping scroll
- RTL support for layout HOT 2
- Using ScrollViewReader
- Strange SwiftUI navigation behavior when using CollectionViewPagingLayout HOT 1
- 新版为什么仅支持iOS13?? HOT 1
- Start on specific page in ScalePageView HOT 2
- How to handle button click event in cell with ScaleTransformView? HOT 1
- About Mac App HOT 2
- Compile time issue HOT 2
- Where is the LayoutDesigner sample app code hosted? HOT 1
- Question on memory leak HOT 1
- Is support objc?
- How to make the layout vertical instead of horizontal?
- TransformPageView RTL dragging is reversed
- View would blink and scrolling when the list changed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from collectionviewpaginglayout.