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

Navigating from each item in the GridView #40

Open
hrishikeshsoman opened this issue Feb 13, 2017 · 1 comment
Open

Navigating from each item in the GridView #40

hrishikeshsoman opened this issue Feb 13, 2017 · 1 comment

Comments

@hrishikeshsoman
Copy link

Hi,

I am trying to use GridView to list some movies in my project. Each movie item in the GridView is supposed to take the application to a movie detail page. I was trying to accomplish this using the Navigator component. Please find the code snippet here:

  renderScene = (route, navigator) => {
    switch (route.name) {
      case 'List':
        return (<GridView
          items={data.result}
          itemsPerRow={MOVIES_PER_ROW}
          renderItem={this.renderItem}
          style={styles.listView}
        />);
renderItem = (item) => {
   return <Movie movie={item} onPress={this.bookClicked} />
 }

I would like to pass a 'navigator' object to my Movie component from the switch statement. I am facing trouble in doing that. Any suggestions would be appreciated.

@mark0978
Copy link

mark0978 commented Apr 1, 2017

renderItem = (item, columnNumber) => {
   return renderMovie(item, columnNumber, navigator);
}

renderIMovie = (item, columnNumber, navigator) => {
   return <Movie movie={item} onPress={this.bookClicked} navigator=navigator />
 }

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

2 participants