Coder Social home page Coder Social logo

Comments (4)

mmarvick avatar mmarvick commented on May 2, 2024 4

Is the intention here just to override handling for the Android back button, or to also override handling the up button in a stack navigator on both platforms?

from rfcs.

satya164 avatar satya164 commented on May 2, 2024

Should let you inject a back handler that runs before the current screen

What do you mean by injecting a back handler before the current screen? Do you mean before the current screen's back handler is attached? Won't that make it the previous one to be never called since the screen's handler will override that?

Need to be able to disable the back button for any given screen

Do you mean preventing navigating away from the screen or it's only about the hardware back button? I think ability to prevent navigating away is useful, but not sure about only disabling the hardware back button. Though could do that by returning this.props.navigation.isFocused() from a back handler if such a method existed :)

from rfcs.

brentvatne avatar brentvatne commented on May 2, 2024

@mmarvick - that's a good point, we probably want a generic way to handle any kind of back action and override.

@satya164 - isFocused() would be great! let's do that :)

from rfcs.

mmarvick avatar mmarvick commented on May 2, 2024

Some related issues:

react-navigation/react-navigation#779
react-navigation/react-navigation#1743
react-navigation/react-navigation#207

In addition to the header back button and the Android hardware back button, goBacks can also be triggered programatically. Any generic solution may want to get callbacks for those as well. I'm not sure how useful that'd be though ¯\_(ツ)_/¯

For what it's worth, being able to use the exported HeaderBackButton as the headerLeft satisfies my main use case for a callback -- a callback would still be a nicer API, but it seems less urgent. It took a bit of digging to find that information though. It might be nice to note with the headerLeft documentation.

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.