mobxjs / mobx-react

React bindings for MobX
https://mobx.js.org/react-integration.html
MIT License
4.85k stars 349 forks source link

Support to trigger React Native's "LayoutAnimation.configureNext(*)" before re-rendering. #332

Closed garrettmac closed 7 years ago

garrettmac commented 7 years ago

React Native has an easy way to trigger animation by adding LayoutAnimation.configureNext(*) before calling setState.

Example:

    LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
    this.setState({index});

Is it possible to trigger the LayoutAnimation without forking? or even the ability to inject a function to be triggered before mobx re-renders?


Resources:

LayoutAnimation blog post https://medium.com/@Jpoliachik/react-native-s-layoutanimation-is-awesome-4a4d317afd3e

LayoutAnimation source - https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/Libraries/LayoutAnimation/LayoutAnimation.js

urugator commented 7 years ago

ability to inject a function to be triggered before mobx re-renders?

Is componentWillReact usable?

mweststrate commented 7 years ago

Closing for inactivity / provided answer

phumaster commented 7 years ago

plz, open this issue.

phumaster commented 7 years ago

Oops. Sorry, I tried:

componentWillReact() {
        LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
    }

It's work!