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

Help: showing new route from a deeply nested component #134

Open
folivi opened this issue May 15, 2016 · 2 comments
Open

Help: showing new route from a deeply nested component #134

folivi opened this issue May 15, 2016 · 2 comments
Labels

Comments

@folivi
Copy link

folivi commented May 15, 2016

Hey guys,
Can someone help achieve this?
I have the implementation below.

It's pretty simple:

-in my index.ios.js file:

<TabBarIOS>
<Icon.TabBarItem><Component1></Icon.TabBarItem>
<Icon.TabBarItem>
<Router firstRoute= Component2 />
</TabBarIOS>

Here goes the component 2

 <ScrollableTabView>
      <Component3 />
  </ScrollableTabView>

Component3 displays a collection of items
Let's say < ListItem />

In the ListItem component I render a view inside a TouchableHighlight.

The goal is to pop a < ItemDetailsView > to the router when user taps on one item inside the list
I assume I have to pass the router down from the parent to the nested children but I can't figure out how.

Thanks for your help

@charpeni
Copy link
Contributor

You can pass specific props to the children components like this :

<Component3
  toRoute={this.props.toRoute}
/>

Or pass all the props to the component :

<Component3
  {...this.props}
/>

@folivi
Copy link
Author

folivi commented May 19, 2016

Thanks but I still don't get why it doesn't work.

I created this gist: https://gist.github.com/folivi/1c3cf4a8754335860ccede337d9eedfa
I followed the tweeter example but looks like the function this.showEvent is not passed from the Events components to the eventListItem. Strange thing is when I pass a string, the child component recieves it.
Hope you can help me
thanks

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

No branches or pull requests

2 participants