jadnco / locus

🏎️ Experimental car spotting app. This was an exercise to help me learn React Native + Flow.
0 stars 0 forks source link

Delay updating state until animations completed #28

Closed jadnco closed 8 years ago

jadnco commented 8 years ago

As the Navigator transitions between views there is a bit of a hiccup. This is because the animations and rendering the large assets (photos) happen asynchronously.

The InteractionManager API should be used to facilitate the necessary changes. Waiting until all animations have finished to render will make the app feel a whole lot smoother.

https://facebook.github.io/react-native/docs/interactionmanager.html#content

jadnco commented 8 years ago

From the Performance docs:

componentDidMount() {
    InteractionManager.runAfterInteractions(() => {
      this.setState({renderPlaceholderOnly: false});
    });
  }
jadnco commented 8 years ago

Implemented, works great. Closed in https://github.com/jadnco/locus/commit/6201ed73209930d3202e8247d71757d1d05745f5.