Created
December 11, 2018 22:52
-
-
Save haruelrovix/8fc8ae9dab580c5e79f24a59a2c195b6 to your computer and use it in GitHub Desktop.
RNE x RNW: Add withRouter to Home
This file contains hidden or 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
import React, { PureComponent } from 'react'; | |
import { View } from 'react-native'; | |
import { Input, Button } from 'react-native-elements'; | |
import styles from './Shared.style'; | |
import { withRouter } from '../Utils/Routing'; | |
class Home extends PureComponent { | |
onPressButton = () => { | |
// Go to Commit screen | |
this.props.history.push('/commit'); | |
} | |
render() { | |
const { input, button } = styles; | |
return ( | |
<View style={styles.container}> | |
<Input | |
containerStyle={input.containerStyle} | |
inputStyle={input.inputStyle} | |
label='Owner' | |
placeholder="Github's owner" | |
/> | |
<Input | |
containerStyle={input.containerStyle} | |
inputStyle={input.inputStyle} | |
label='Repo' | |
placeholder="Github's repository name" | |
/> | |
<Button | |
title='SUBMIT' | |
icon={{ | |
color: 'white', | |
name: 'paper-plane', | |
size: 15, | |
type: 'font-awesome' | |
}} | |
buttonStyle={button.containerStyle} | |
onPress={this.onPressButton} | |
/> | |
</View> | |
); | |
} | |
} | |
export default withRouter(Home); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment