Giter Club home page Giter Club logo

Comments (12)

mattrothenberg avatar mattrothenberg commented on July 22, 2024 1

No worries. I cooked up a rough CodeSandbox illustrating how I might go about building such a
UI. Note that the transitions themselves are super rough, and you'd definitely need to go back and add inverseFlipIds to ensure that the right elements are transitioning into place. Alex (the author of react-flip-toolkit does a great job of explaining how this works in her README.

https://codesandbox.io/s/vue-template-qw928

Kapture 2019-11-07 at 9 53 38

The main difference in our respective implementations is that I've decided to wrap the entire app in a Router that's also wrapped in a Flipper. Each screen – Home, Chat List, Chat Detail – is a Vue component inside of which lives a Flipped component with the same ID. That ensures that each "route" triggers some Flip animation.

from vue-flip-toolkit.

mattrothenberg avatar mattrothenberg commented on July 22, 2024

from vue-flip-toolkit.

dniccum avatar dniccum commented on July 22, 2024

Here is the CodeSandbox: https://codesandbox.io/s/vue-template-1pj6t

The "simple" instance that I am referring to is in the "Chat" component.

The router instance is in the ChatWrapper, ChatIndex, and ChatConversation components.

from vue-flip-toolkit.

mattrothenberg avatar mattrothenberg commented on July 22, 2024

This one is super interesting. I have a theory as to why your code isn't working, though.

I noticed that in all of my examples, the Flipped components were wrapping plain old HTML nodes, e.g.,

<Flipped flipId="foo">
  <div class="foo">Foo</div>
</Flipped>

In your examples, however, the Flipped components are wrapping actual Vue components, e.g.,

<Flipped :flipId="key">
  <chat-button />
</Flipped>

In the React Flip Toolkit docs, the author Alex calls out having to use React's "render props" API to ensure that the rendered child receives all of the right attributes from the Flip library, such that a transition can occur. These attributes – namely the inline styles – are missing from your examples, and hence the lack of transition.

My suggestion – and I think it will work, as I just did a quick experiment on my end – is to change your markup such that the Flipped instances live inside your custom components, not outside as they currently do. So, you end up with something like this –

<!-- Chat.vue (OLD WAY) -->
<Flipped :flipId="key" v-if="!visible">
  <chat-button />
</Flipped>
<!-- Chat.vue (NEW WAY)  -->
<chat-button v-if="visible" />
<!-- ChatButton.vue (NEW WAY) --> 
<template>
  <Flipped :flipId="key" v-if="!visible">
    <div>Button markup goes here</div>
  </Flipped>
</template>

Let me know if this does the trick. I can't tell whether I need to go back to the drawing board on this one so support this pretty common use case.

from vue-flip-toolkit.

dniccum avatar dniccum commented on July 22, 2024

Thanks a bunch for the feedback. I have made the requested updates. I think we are making progress. The button that shows and minimizes the chat window works like a charm. However for the life of me, I have not been able to get the router to work.

I have updated the sandbox accordingly: https://codesandbox.io/s/vue-template-1pj6t

from vue-flip-toolkit.

mattrothenberg avatar mattrothenberg commented on July 22, 2024

I don't fully understand what's not working.

When you say "the router," what do you mean? What animation or general behavior do you expect to see that isn't working?

from vue-flip-toolkit.

dniccum avatar dniccum commented on July 22, 2024

Sorry, I should have been clearer. The router itself works fine, but the transitions from index page to the child pages are not working.

from vue-flip-toolkit.

mattrothenberg avatar mattrothenberg commented on July 22, 2024

@dniccum Can I close out this issue?

from vue-flip-toolkit.

dniccum avatar dniccum commented on July 22, 2024

@mattrothenberg Sorry that I didn't get back to you. Yes this approach seemed to have fixed a lot of my issues. I need to clean up some of the animations with the available event listeners but you have put me on the right track. Thanks for your help.

from vue-flip-toolkit.

mattrothenberg avatar mattrothenberg commented on July 22, 2024

@dniccum No problem. Good luck!

from vue-flip-toolkit.

kedrzu avatar kedrzu commented on July 22, 2024

I've just digged through this issue and it helped me a lot with my project as well!
@mattrothenberg I think you should emphase this in docs, because it's really valuable info!

from vue-flip-toolkit.

mattrothenberg avatar mattrothenberg commented on July 22, 2024

@kedrzu Glad it helped. Feel free to add something to the README so that others can take advantage of that knowledge!

from vue-flip-toolkit.

Related Issues (15)

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.