Comments (5)
Important information
Just making sure we're on the same page here: to return to the closed
state, just do context.state.wrappedValue = .closed
. No need to add a custom .id
or anything. Example:
SwipeView {
Text("Swipe to Trigger, Then Return")
.frame(maxWidth: .infinity)
.padding(.vertical, 32)
.background(Color.blue.opacity(0.1))
.cornerRadius(32)
} trailingActions: { context in
SwipeAction("Bounce Back") {
context.state.wrappedValue = .closed /// here!
}
.allowSwipeToTrigger()
}
.swipeActionWidth(140)
This works fine.
BounceBack.mov
The actual problem
The problem in this issue is about the swipe view getting stuck midway between the expanded/closed state. I can't consistently reproduce this, but it seems to have something to do with scrolling.
from swipeactions.
Facing this with leadingActions specifically
from swipeactions.
The issue about the swipe view getting stuck midway between the expanded/closed state probably because of the swiftUI Gestures
. Using .allowsHitTesting() might help solve the problem.
from swipeactions.
Workaround: just add a .id(UUID()) to SwipeView
I'm using it inside a List and it works
from swipeactions.
Workaround: just add a .id(UUID()) to SwipeView
I'm using it inside a List and it works
Could you please tell me more about it? I used the following code snippet, but it wouldn't work, swipe gesture doesn't reset.
SwipeView {
Container(title: "Basic")
} trailingActions: { _ in
SwipeAction("Tap Me!") {}
}.id(UUID())
from swipeactions.
Related Issues (15)
- Accessibility Support
- Detect Swipe Action Context State
- Mistake
- AllowSwipeToTrigger() does not work on newly added cells after fetching data HOT 3
- Multiple actions collapsing on long swipe? HOT 2
- SwipeActions not behaving correctly with -Right To Left- Languages.
- Issue on tapping 3rd of 4 buttons in .mask ActionStyle
- Check if UIImpactGenerator is allowed
- Can't access SwipeView id
- "Hint" style (option to set custom swipe offset)
- Minor issue with example linked .zip HOT 4
- Wrapped view momentarily duplicated on a swipe when it has a .contextMenu modifier attached HOT 2
- Scroll doesn't work in the example app HOT 4
- SwipeAction has some unknown minimum corner radius
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 swipeactions.