GithubHelp home page GithubHelp logo

Comments (7)

IjzerenHein avatar IjzerenHein commented on May 20, 2024 1

That's a really cool example. I don't have any solutions for that yet, and would even want to have something in my app as well (although it's not a must for me).

I've also been working hard on the successor of magic-move, which is an all native solution. It provides a native primitive for doing shared element transitions. You could take a closer look at that.
https://github.com/IjzerenHein/react-native-shared-element

It doesn't support travel paths other than straight-lines yet though

from react-native-magic-move.

nandorojo avatar nandorojo commented on May 20, 2024 1

Thanks for the quick reply! I saw shared element on Twitter — looks really cool. I’m excited to try it out when expo v35 comes out. If I manage to get this animation working, I’ll be sure to drop an example here. I’m really impressed by magic move and can’t wait to use it on the native side.

from react-native-magic-move.

hungtrn75 avatar hungtrn75 commented on May 20, 2024 1

I think we can complete this example with animated

from react-native-magic-move.

nandorojo avatar nandorojo commented on May 20, 2024 1

@hungtrn75 Awesome! Do you have any thoughts on what it would look like to make it happen? I considered measuring the size/position of the input before clicking send, calculating the transform value from there to the messages destination and then animating. It's a bit tricky, though, especially with maintaining 60fps and issues like the user scrolling or closing the keyboard.

from react-native-magic-move.

nandorojo avatar nandorojo commented on May 20, 2024 1

Got it. I'd love to work on a collaborative example if you'd like. In the meantime, I'm relying on reanimated's Transition API. Not as smooth but still has a nice effect.

Here is a GIF of what it looks like in an example app with GiftedChat: https://giphy.com/gifs/JmJ3G6sn4twEscyOc5

// transition ref
const ref = useRef<TransitioningView>()

// track if component is already "mounted" so it only animates for new messages
const mounted = useRef(false)

// effect that runs whenever a new message comes in
useEffect(() => {
  if (mounted.current) {
    // only animate if you're updating the component; not on initial mount
    ref.current.animateNextTransition()
  } else if (messages.length) {
    // mark the component as mounted when there are already messages
    mounted.current = true
  }
}, [messages])

return (
<Transitioning.View
  transition={
  <Transition.Sequence>
    <Transition.Change interpolation="easeInOut" />
    <Transition.In type="fade" />
  </Transition.Sequence>
  }
  ref={ref}
  style={{ flex: 1 }}
>
  // ...FlatList that takes in the messages array
</Transitioning.View>
)

from react-native-magic-move.

hungtrn75 avatar hungtrn75 commented on May 20, 2024 1

@nandorojo it's nice effect.

from react-native-magic-move.

hungtrn75 avatar hungtrn75 commented on May 20, 2024

yep, I think the same way. We can make the animation with react-native-reanimated for much greater flexibility.
About some issues, I think:

  • prevent the keyboard closing after sending a message
  • scroll to end of list message before transforming

from react-native-magic-move.

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.