Coder Social home page Coder Social logo

Comments (4)

brentvatne avatar brentvatne commented on May 2, 2024

with your proposal, how does this get passed into navigationOptions?

static navigationOptions = ({ navigation }) => {
 // how do I access params here?
}

from rfcs.

mtnt avatar mtnt commented on May 2, 2024

I guess, it should be considered from a purpose point of view. So since I propose it for being able to create independently (from navigation) components, it is the purpose.
If someone makes the static navigationOptions inside his component, so, I guess he don`t want to make that component independent from navigation. And params could be accessible from the navigation.params or as navigation sibling property - actually it does not matter.

from rfcs.

mtnt avatar mtnt commented on May 2, 2024

However I still think that route params and scene outer params should be separated. So it would be pretty good to have static navigationOptions({navigation, routeParams, innerParams}) or something similar.

from rfcs.

satya164 avatar satya164 commented on May 2, 2024

React Navigation 5 passes a route object as a prop which makes accessing the params shorter (route.params as opposed to navigation.state.params).

Passing params as to-level props doesn't make components any independent of the navigation library since you still use the navigation prop which is specific to the library. To make something really independent and reusable, we'd have to extract it out to a separate components, abstract these methods out and pass them.

Passing params as top-level props also means that we can't add any more props to screens in future since there's now a chance of conflicts.

Closing since this is not something we'll implement.

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.