Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various prop types are missing #4

Closed
jaredly opened this issue Jan 26, 2017 · 9 comments
Closed

Various prop types are missing #4

jaredly opened this issue Jan 26, 2017 · 9 comments

Comments

@jaredly
Copy link

jaredly commented Jan 26, 2017

From the code, there are a bunch of places where prop types are used, but not indicated in other places.

  • screenProps -> apparently these can be passed down, but there's little indication
  • making a custom header; StackNavigator passes in HeaderComponent to CardStack but CardStack doesn't seem to do anything with it
@ericvicenti
Copy link
Contributor

Hey Jared!

As for CardStack, yeah there are a handful of old props left over from the NavigationExperimental views that were moved over. For now I think the best approach is to clean them up, and we can revisit adding things in later.

@satya164, could you make sure the flow types and docs are up to date for screenProps?

@satya164
Copy link
Member

@ericvicenti screenProps are typed as {} since they can hold arbitrary objects. Not sure what I have to change there.

@coodoo
Copy link

coodoo commented Jan 30, 2017

As a side note, while reading the docs I got a bit confused by whether screenProps is the same thing as this.props.navigation object in each screen, maybe it was just an old name?

@ericvicenti
Copy link
Contributor

@coodoo, screenProps are extra props that will be passed through the navigator into each screen component, in addition to the navigation prop. Could you submit a PR to help clarify the docs?

@jaredly
Copy link
Author

jaredly commented Jan 30, 2017

@satya164 screenProps are not listed in a bunch of places -- for example, I believe that NavigationContainer should list screenProps as a thing it accepts

@satya164
Copy link
Member

@jaredly
Copy link
Author

jaredly commented Jan 30, 2017

@satya164 I believe that it does

Here's the trail:

from StackNavigator

  return createNavigationContainer(createNavigator(router)(props => (
    <CardStack
      {...props}
      headerComponent={headerComponent}
      headerMode={headerMode}
      mode={mode}
    />
  )), containerOptions);

createNavigationContainer and createNavigator both spread in all props.

And then CardStack accepts screenProps.

TLDR I had to read a ton of source code to realize that I could do

const SomeStack = StackNavigator({
  // config
});

<SomeStack
  screenProps={/* these will get passed to the screen components */}
/>

Please fix the docs so future users don't have to read all your source code.

@coodoo
Copy link

coodoo commented Jan 31, 2017

@ericvicenti Absolutely, will see how to merge all above mentioned details into the docs.

@grabbou
Copy link

grabbou commented Apr 24, 2017

Closing as we are now generating prop-types directly from flow which should make it more up-to-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants