swiftui-library / hstack-snap-to-scroll Goto Github PK
View Code? Open in Web Editor NEWEasy-to-use HStack that snaps to elements on scroll.
Easy-to-use HStack that snaps to elements on scroll.
How do you set value in @State of snapped item?
Is there a way to align all the items to the top.
Normally HStack alignment is used to align the items inside to the desired position.
For HStackSnap it is used for where it should snap.
I'm trying to recreate what you have in example 2 but with 3 items above each other. My search result doesn't always give me a multiple of 3 since sometimes there are only 8 results. when this happens the last 2 are aligned in the middle
Hi there,
I found an issue, if you scroll it fast in the beginning, it will stuck in the center sometimes.
I know this is because of ScrollView. When you trigger the ScrollView's scrolling, the Views which are inside the ScrollView, cannot get the DragGesture anymore. But before that, they have already started part of the scrolling, so they cannot finish it. If you use other Containers, like LIst (it also has a similar vertical scrolling behavior), there's no problem like this. Do you have any idea about this?
You could have a look at the effect here.
https://jmp.sh/SdccqRX
Thanks.
The last 2 items won't snap regardless of number of items when in center alignment. I can't pull them as it springs back to the 3rd last item.
If you change orientation to landscape, HStackSnap not working as expected. I think there is a problem because the width of the stack is changed. Is there any solution for this?
HStackSnap(alignment: .leading(20)) {
ForEachWithIndex(elements: self.dayStore.days) { index, day in
GeometryReader { cardGeo in
VStack {
Text("cao \(index)")
}
.frame(maxWidth: .infinity)
.frame(maxHeight: .infinity)
.background(RoundedCorners(color: Color("Neutral White"), tl: 20, tr: 20, bl: 20, br: 20))
.rotation3DEffect(Angle(degrees: (Double(cardGeo.frame(in: .global).minX))) / -30, axis: (x: 0, y: 10.0, z: 0))
.snapAlignmentHelper(id: day.id)
}
.frame(width: abs(geo.size.width - 80))
.frame(maxHeight: .infinity)
}
}
.padding(.top, 10)
.padding(.bottom, 10)
I have a Slider
in the View and when I move the slider, the View in the HStack
also moves in the direction that I have moved the slider. Is there anyway to disable the gesture action in this lib while the Slider
is moving?
Let me know if any more information is required
Hello! I'm noticing an issue where the library doesn't work when nested in a NavigationView
. The views are displayed correctly, however I am unable to scroll only when nested in a NavigationView
. I have included a very simple implementation reusing your demo to show what is happening.
card test.zip
In my ForEach I want a NavigationLink to open another view. The problem is when I put this the view stops being scrollable as it recognizes the tap on the link. Any idea on how to fix that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.