Navigating from each item in the GridView
hrishikeshsoman opened this issue · comments
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.
renderItem = (item, columnNumber) => {
return renderMovie(item, columnNumber, navigator);
}
renderIMovie = (item, columnNumber, navigator) => {
return <Movie movie={item} onPress={this.bookClicked} navigator=navigator />
}