<commit_before>'use strict';

import React, { Component } from 'react';
import { Image, Platform, TouchableOpacity } from 'react-native';
import { connect } from 'react-redux';

import { actions } from 'react-native-navigation-redux-helpers';

import { Container, Content, Text, Button, Icon, InputGroup, Input, View } from 'native-base';

import theme from '../login/login-theme';
import styles from './styles';

const {
  reset,
} = actions;

class SignUp extends Component {


    static propTypes = {
      reset: React.PropTypes.func,
      navigation: React.PropTypes.shape({
        key: React.PropTypes.string,
      }),
    }

    constructor(props) {
        super(props);
        this.state = {
            offset: {
                x:0,
                y:0
            }
        };
        this.constructor.childContextTypes = {
            theme: React.PropTypes.object,
        }
    }

       resetRoute(route) {
            this.props.resetRoute(route);
        }

    render() {
        return (
            <Container>
                    <View theme={theme}>
                        <Image source={require('../../../images/BG-signUp.png')} style={styles.background} >
                            <Content padder scrollEnabled={false}>
                                <Text style={styles.signupHeader}>
                                    CREATE ACCOUNT
                                </Text>
                                <View style={styles.signupContainer}>
                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Icon name='ios-person-outline' />
                                        <Input placeholder='Username'  style={styles.input}/>
                                    </InputGroup>

                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Icon name='ios-mail-open-outline' />
                                        <Input placeholder='Email'  style={styles.input}/>
                                    </InputGroup>

                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Icon name='ios-unlock-outline' />
                                        <Input placeholder='Password' secureTextEntry={true}  style={styles.input}/>
                                    </InputGroup>

                                    <Button
                                        rounded transparent  block
                                        onPress={() => this.props.reset(this.props.navigation.key)}
                                        style={styles.signupBtn}
                                    >
                                        Continue
                                    </Button>

                                    <TouchableOpacity>
                                        <Text style={styles.termsText}>Terms & Conditions</Text>
                                    </TouchableOpacity>
                                </View>
                            </Content>
                        </Image>
                    </View>
            </Container>
        )
    }
}


function bindAction(dispatch) {
    return {
        reset: key => dispatch(reset([{ key: 'login' }], key, 0))
    }
}

const mapStateToProps = state => ({
  navigation: state.cardNavigation,
});

export default connect(mapStateToProps, bindAction)(SignUp);
<commit_msg>Allow redux to dispatch actions to store credentials<commit_after>'use strict';

import React, { Component } from 'react';
import { Image, Platform, TouchableOpacity } from 'react-native';
import { connect } from 'react-redux';

import { actions } from 'react-native-navigation-redux-helpers';

import { Container, Content, Text, Button, Icon, InputGroup, Input, View } from 'native-base';

import theme from '../login/login-theme';
import styles from './styles';
import ApiRequest from '../../api/ApiRequest.js';
import {addFirstName, addLastName, addEmailAddress, addPassword, addOrganization} from '../../actions/user'


const {
  reset,
} = actions;

class SignUp extends Component {


    static propTypes = {
      reset: React.PropTypes.func,
      navigation: React.PropTypes.shape({
        key: React.PropTypes.string,
      }),
    }

    constructor(props) {
        super(props);
        this.state = {
            offset: {
              email: '',
              password: '',
              firstname: '',
              lastname: '',
              confirmPassword: '',
                x:0,
                y:0
            }
        };
        this.constructor.childContextTypes = {
            theme: React.PropTypes.object,
        }
    }

    resetRoute(route) {
      this.props.resetRoute(route);
    }

    signupOnClick(email, password) {
      console.log(this.state.firstname);
      this.props.reset(this.props.navigation.key);
      this.props.addFirstName(this.state.firstname);
      this.props.addLastName(this.state.lastname);
      this.props.addEmailAddress(this.state.email);
      this.props.addPassword(this.state.password);
      ApiRequest.signup(email, password);
    }

    render() {
        return (
            <Container>
                    <View theme={theme}>
                        <Image source={require('../../../images/BG-signUp.png')} style={styles.background} >
                            <Content padder scrollEnabled={false}>
                                <Text style={styles.signupHeader}>
                                    CREATE ACCOUNT
                                </Text>
                                <View style={styles.signupContainer}>
                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Input
                                        placeholder='<NAME>'
                                        style={styles.input}
                                        onChangeText={firstname => this.setState({ firstname })}
                                        />
                                    </InputGroup>
                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Input
                                        placeholder='<NAME>'
                                        style={styles.input}
                                        onChangeText={lastname => this.setState({ lastname })}
                                        />
                                    </InputGroup>
                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Input
                                        placeholder='Email Address'
                                        style={styles.input}
                                        onChangeText={email => this.setState({ email })}
                                        />
                                    </InputGroup>

                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Input
                                        placeholder='Password'
                                        secureTextEntry={true}
                                        style={styles.input}
                                        onChangeText={password => this.setState({ password })}
                                        />
                                    </InputGroup>
                                    <InputGroup borderType='rounded' style={styles.inputGrp}>
                                        <Input
                                        placeholder='Confirm Password'
                                        style={styles.input}
                                        onChangeText={confirmPassword => this.setState({ confirmPassword })}
                                        />
                                    </InputGroup>

                                    <Button
                                        rounded transparent  block
                                        onPress={ () =>
                                          {
                                            this.signupOnClick(this.state.email, this.state.password);
                                          }
                                        }
                                        style={styles.signupBtn}
                                    >
                                        Continue
                                    </Button>

                                    <TouchableOpacity>
                                        <Text style={styles.termsText}>Terms & Conditions</Text>
                                    </TouchableOpacity>
                                </View>
                            </Content>
                        </Image>
                    </View>
            </Container>
        )
    }
}


function bindAction(dispatch) {
    return {
        addFirstName: (firstName) => dispatch(addFirstName(firstName)),
        addLastName: (lastName) => dispatch(addLastName(lastName)),
        addEmailAddress: (emailAddress) => dispatch(addEmailAddress(emailAddress)),
        addPassword: (password) => dispatch(addPassword(password)),
        reset: key => dispatch(reset([{ key: 'orgPage' }], key, 0)),
    };
}

const mapStateToProps = state => ({
  navigation: state.cardNavigation,
  credentials: state.credentials
});

export default connect(mapStateToProps, bindAction)(SignUp);

{'fraction_non_alphanumeric': 0.09868489178834007, 'fraction_numerical': 0.0006213109661385523, 'mean_word_length': 1.0175475245456445, 'pattern_counts': {'":': 0, '<': 68, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 75, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2950648', 'n_tokens_mistral': 2006, 'n_tokens_neox': 1932, 'n_words': 374}