Created
January 19, 2016 23:14
-
-
Save rturk/e00021d694b851643db7 to your computer and use it in GitHub Desktop.
ExNavigator Push Router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class App extends Component { | |
render() { | |
return ( | |
<ExNavigator | |
initialRoute={TestRouter.getCompanyRoute()} | |
style={{flex: 1}} | |
sceneStyle={{ paddingTop: 64 }} /> | |
); | |
} | |
} | |
let HelpinRouter = { | |
getCompanyRoute() { | |
return { | |
// Return a React component class for the scene. It receives a prop | |
// called `navigator` that you can use to push on more routes. | |
//getSceneClass() { | |
// return require('./company/CompanyScreen'); | |
//}, | |
renderScene(navigator) { | |
return <CompanyScreen navigator={navigator} /> | |
}, | |
// When this scene receives focus, you can run some code. We're just | |
// proxying the `didfocus` event that Navigator emits, so refer to | |
// Navigator's source code for the semantics. | |
onDidFocus(event) { | |
}, | |
getTitle() { | |
return 'Empresas'; | |
}, | |
}; | |
}, | |
getConversationRoute(company) { | |
return { | |
renderScene(navigator) { | |
return <Conversation navigator={navigator}/> | |
}, | |
onDidFocus(event) { | |
}, | |
renderTitle() { | |
return ( | |
<View style={styles.container}> | |
<Image | |
source={{uri: company.logo}} | |
style={styles.logo} | |
resizeMode='contain' /> | |
<Text | |
style={styles.titleName}> | |
{company.name} | |
</Text> | |
</View> | |
); | |
}, | |
getTitle() { | |
return company.name; | |
} | |
}; | |
} | |
}; | |
let route = HelpinRouter.getConversationRoute(company); | |
this.props.navigator.push(route); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment