Comments (13)
Thank you for your feedback, can you provide a starting point with your code.
Anyway I will try to give it a look and modify it.
from partialsheet.
Hi!
My actual use case is slightly different and looks even worse, but this example hopefully gives an idea of what's wrong: https://github.com/NeverwinterMoon/PartialSheet-animation-issue
from partialsheet.
Should be fixed, give it a try with v2.1.6
from partialsheet.
Well, this certainly does fix an issue when one doesn't want animations in the content view at all, but now it disables animations altogether for the content. Even if I use explicit property animations in the content view, they won't work, as the parent explicitly disables the animations for all the children views...
As I noted before, using any animation modifier on the parent (be it nil or anything else) is not a good way to go, as it messes up the children views.
from partialsheet.
ok you are right, but then I don't know how to fix this, I need to apply the animation on the parent:
.animation(self.dragState.isDragging ?
nil : .interpolatingSpring(stiffness: 300.0, damping: 30.0, initialVelocity: 10.0))
otherwise when you open and close the partial sheet the effect it's very bad
from partialsheet.
I tried doing a similar thing (to have nice effect for sheet appearing/disappearing) differently: by using .transition.
var body: some View {
ZStack {
if isOpen {
background
.transition(AnyTransition.opacity.animation(.easeInOut))
GeometryReader { proxy in
self.card(proxy: proxy)
}
.transition(.move(edge: .bottom))
.onDisappear {
self.opacity = 0.65
self.dragStateClone = .inactive
}
}
}
}
I have separate transition for the slide up and for background fading in. Both are animated using property animation (on @Binding var isOpen: Bool
), so they don't affect any children views.
So, it would be triggered like that:
withAnimation(.interpolatingSpring(stiffness: 300.0, damping: 30.0, initialVelocity: 10.0)) {
self.isOpen = true
}
from partialsheet.
would you like to make a PR? at the moment I'm busy on other stuffs
from partialsheet.
I really can't see how to apply your code to the partial sheet modifier
from partialsheet.
I could take a stab at a PR but it would also take me some time, as I am overly occupied with stuff at work.
Otherwise, the change might not be that trivial. The code I posted I've applied to a simplified version of PartialSheet and it is working really nicely with all the required animations on the sheet itself but without affecting the animations of the sheet content.
from partialsheet.
Hi @NeverwinterMoon, are you still up for the PR?
from partialsheet.
I have a somewhat working version which allows you to use explicit animations again (removes the .animation modifier):
https://github.com/1337domz/PartialSheet
At the moment:
- It will only work on iOS 14, as I am using the .onChange(of:) modifier. There is probably a way to do this differently to make it iOS 13 compatible.
- When the keyboard first gets shown it doesn't seem to adjust the height properly, I'm not sure why. I don't need the keyboard functionality so I didn't spend too much time trying to fix it.
Other than that, it seems to function as expected with the examples. I added a new example of an animation, that doesn't work with the currently released version. Maybe someone else can build upon this?
from partialsheet.
I noticed that the animations were clunky when showing and hiding the sheet so I also started to have a look at this. I have a working version with explicit animations in that pull request. I have also included an example with working animations in the sheet (implicit, explicit and none) all working as expected.
from partialsheet.
Awesome guys! I will have a look at it
from partialsheet.
Related Issues (20)
- Bound preference PresenterPreferenceKey tried to update multiple times per frame. HOT 2
- PartialSheet disappears automatically after Alert is presented
- PartialSheet 3: PSButton action is never called in ListExample
- PartialSheet Crash when using multiple horizontal scroll views HOT 2
- Partial Sheet over tab bar
- The `DragGesture.onEnded(_:)` not be called up. HOT 1
- PartialSheet auto close when openURL in sheet content with `@Environment(\.scenePhase)`
- Could not find module 'PartialSheet' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator HOT 1
- Can't scroll with WKWebView inside the PartialSheet
- TabView over the PartialSheet
- Partial sheet on top of .sheet() gets cut off HOT 1
- How to prevent PartialSheet from closing when clicking on the background or dragging down? HOT 1
- onDismiss in version 3+ HOT 1
- Crash on tap to show the Partial sheet HOT 2
- macOS Support Mentioned in README but Not in Package.swift
- Partial Sheet Not Triggering When Using @Published Variable in ViewModel HOT 1
- Sticky Footer In ScrollView Partial Sheet HOT 1
- Simple partialSheet with type .scrollView doesn't work HOT 1
- Issue in updating the state variable's value within the partial sheet's content
- UIKit can use it?
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 partialsheet.