Code Monkey home page Code Monkey logo

Comments (4)

IjzerenHein avatar IjzerenHein commented on June 14, 2024 1

Hi, that's a very good question! I haven't gotten around to test this, but my initial guess would be that this would indeed be possible. Assuming that react-native-magic-move can properly measure the elements, and can draw in front of the RNN screens, it should work.
It would also be necessary to create a binding that would transfer state information from RNN to RNMM. The react-navigation-magic-move binding was fairly easy to create, so I assume the RNN binding would also be easy to create.

So to sumarize

  • Has it been tested with RNN? No
  • Could it work as is? Probably Not
  • Can it be made to work? Probably Yes

At the moment this has no priority for me as I don't use it myself, and RNN supports shared element transitions on its own. PR's and investigative work are very welcome though

from react-native-magic-move.

alexfoxy avatar alexfoxy commented on June 14, 2024

I have a snack with this working using react-native-magic-move + react-navigation: https://snack.expo.io/@alexfoxy/473def

The only problem is that when going back, or navigating to the previous scene the animation doesn't reverse.

@IjzerenHein Am I doing something wrong?

from react-native-magic-move.

IjzerenHein avatar IjzerenHein commented on June 14, 2024

Sweet! That's probably because it now works when a new component is mounted. In order to make that work you'll need to control the active prop of the scene

from react-native-magic-move.

GioLogist avatar GioLogist commented on June 14, 2024

Spent some time looking into this. It appears that the main issue is that MagicMove.Provider needs to be wrapped around the entire app. With react-native-navigation, each screen is responsible for its own HOC's, as explained here.

So, even if we register our screens as so, they still won't share their Magic.Provider value and thus have a different context. This is due to the use of this in Provider.js. The context value can't be shared among separate providers. Unlike the redux example in which store is created once and shared among all providers.

Navigation.registerComponent(
  'ScreenExample',
  () => (props) => (
    <MagicMove.Provider>
      <ScreenExample {...props} />
    </MagicMove.Provider>
  ),
  () => ScreenExample,
);

A potentially simple workaround is to allow for exporting the shared value, like redux does. So that we can pass it explicitly via MagicMove.Provider.

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.