GithubHelp home page GithubHelp logo

Comments (13)

AndreaMiotto avatar AndreaMiotto commented on July 20, 2024

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.

NeverwinterMoon avatar NeverwinterMoon commented on July 20, 2024

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.

AndreaMiotto avatar AndreaMiotto commented on July 20, 2024

Should be fixed, give it a try with v2.1.6

from partialsheet.

NeverwinterMoon avatar NeverwinterMoon commented on July 20, 2024

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.

AndreaMiotto avatar AndreaMiotto commented on July 20, 2024

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.

NeverwinterMoon avatar NeverwinterMoon commented on July 20, 2024

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.

AndreaMiotto avatar AndreaMiotto commented on July 20, 2024

would you like to make a PR? at the moment I'm busy on other stuffs

from partialsheet.

AndreaMiotto avatar AndreaMiotto commented on July 20, 2024

I really can't see how to apply your code to the partial sheet modifier

from partialsheet.

NeverwinterMoon avatar NeverwinterMoon commented on July 20, 2024

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.

styrken avatar styrken commented on July 20, 2024

Hi @NeverwinterMoon, are you still up for the PR?

from partialsheet.

1337domz avatar 1337domz commented on July 20, 2024

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.

eliottrobson avatar eliottrobson commented on July 20, 2024

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.

styrken avatar styrken commented on July 20, 2024

Awesome guys! I will have a look at it

from partialsheet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.