Skip to content

Instantly share code, notes, and snippets.

@mateusreis
Created December 1, 2016 10:31
Show Gist options
  • Save mateusreis/16a3a05288a5d88182cd65de8bf1999a to your computer and use it in GitHub Desktop.
Save mateusreis/16a3a05288a5d88182cd65de8bf1999a to your computer and use it in GitHub Desktop.
React Native page
import React, { Component } from 'react';
import { Image } from 'react-native';
import { connect } from 'react-redux';
import { Container, Content, Button, View, H3, Header, Title, Icon, Text } from 'native-base';
import { openDrawer } from '../../actions/drawer';
import myTheme from '../../themes/base-theme';
import styles from './styles';
import { actions } from 'react-native-navigation-redux-helpers';
const {
replaceAt,
} = actions;
class MyButton extends Component{
render(){
return(
<Button
primary
style={ styles.button }
textStyle={ styles.buttonText }
onPress={() => this.navigateTo('nextPage')}
navigator={navigator}
>
NEXT PAGE!
</Button>
)
}
}
class Terms extends Component { // eslint-disable-line
replaceAt(route) {
this.props.replaceAt('register', { key: route }, this.props.navigation.key);
}
render() {
return (
<Container theme={myTheme}>
<Header>
<Title>Terms</Title>
<Button transparent onPress={() => this.navigateTo('home')}>
<Icon name="ios-arrow-back" />
</Button>
</Header>
<Content style={styles.content}>
<Text style={styles.heading}>
Eiusmod tempor incididunt
</Text>
<Text style={styles.text}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</Text>
<MyButton/>
</Content>
</Container>
);
}
}
function bindActions(dispatch) {
return {
navigateTo: (route, homeRoute) => dispatch(navigateTo(route, homeRoute)),
replaceAt: (routeKey, route, key) => dispatch(replaceAt(routeKey, route, key))
};
}
const mapStateToProps = state => ({
navigation: state.cardNavigation,
});
export default connect(mapStateToProps, bindActions)(Terms);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment