Coder Social home page Coder Social logo

Comments (7)

slorber avatar slorber commented on May 2, 2024 4

this works fine:

goBackAsync = () => {
  const promise = new Promise(resolve => {
    const subscription = this.props.navigation.addListener('didBlur', () => {
      subscription.remove();
      resolve();
    });
  });
  this.props.navigation.goBack();
  return promise;
};

from rfcs.

brentvatne avatar brentvatne commented on May 2, 2024

you could wrap dispatch with a fn that adds a listener for didBlur and then resolves the promise and removes itself

from rfcs.

dantman avatar dantman commented on May 2, 2024

The dispatch API is based on Redux. And When Redux is React Navigation's dispatch method is 100% replaced with the standard Redux dispatch method. So we cannot change the dispatch API to return a Promise.

Something similar to React Native's InteractionManager.runAfterInteractions but for transitions would probably work better.

I think I had more concrete API ideas in one of my comments on another issue.

from rfcs.

slorber avatar slorber commented on May 2, 2024

from rfcs.

dantman avatar dantman commented on May 2, 2024

@slorber Oh, I'm still pre-middleware. Didn't see that things changed.

from rfcs.

slorber avatar slorber commented on May 2, 2024

didBlur seems to work fine @brentvatne thanks

I've made a pr to the doc as it's not well documented: react-navigation/react-navigation.github.io#54

from rfcs.

brentvatne avatar brentvatne commented on May 2, 2024

cool, closing this then!

from rfcs.

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.