|
|
@@ -6,6 +6,27 @@ import { propChanged } from '../actions/';
|
|
|
import { Actions } from 'react-native-router-flux';
|
|
|
|
|
|
class RegisterForm extends Component {
|
|
|
+ fields = [
|
|
|
+ { label: 'E-mail', key: 'email' },
|
|
|
+ { label: 'Nombre', key: 'nombre' },
|
|
|
+ { label: 'Apellido', key: 'apellido' },
|
|
|
+ { label: 'País', key: 'pais' },
|
|
|
+ { label: 'Provincia', key: 'provincia' },
|
|
|
+ { label: 'Ciudad', key: 'ciudad' },
|
|
|
+ { label: 'Dirección', key: 'direccion' },
|
|
|
+ { label: 'Teléfono', key: 'tel' },
|
|
|
+ { label: 'Celular', key: 'cel' }
|
|
|
+ ];
|
|
|
+ componentWillMount() {
|
|
|
+ this.createDataSource(this.fields);
|
|
|
+ }
|
|
|
+
|
|
|
+ createDataSource(data){
|
|
|
+ const ds = new ListView.DataSource({
|
|
|
+ rowHasChanged: (r1,r2) => r1 !== r2
|
|
|
+ });
|
|
|
+ this.dataSource = ds.cloneWithRows(data);
|
|
|
+ }
|
|
|
|
|
|
onRegisterPress() {
|
|
|
// Actions.register();
|
|
|
@@ -28,7 +49,7 @@ class RegisterForm extends Component {
|
|
|
return (
|
|
|
<CardSection>
|
|
|
<Input
|
|
|
- label={item.key}
|
|
|
+ label={item.label}
|
|
|
placeholder={item.placeholder}
|
|
|
value={this.props[item.key]}
|
|
|
onChangeText={ () => this.props.propChanged({ key: item.key, val: this.props[item.key] }) }
|
|
|
@@ -39,9 +60,11 @@ class RegisterForm extends Component {
|
|
|
render() {
|
|
|
return (
|
|
|
<Card>
|
|
|
- { this.renderItem( {key:"email"}) }
|
|
|
- { this.renderItem( {key:"nombre"}) }
|
|
|
- { this.renderItem( {key:"apellido"}) }
|
|
|
+ <ListView
|
|
|
+ enableEmptySections
|
|
|
+ dataSource={this.dataSource}
|
|
|
+ renderRow={this.renderItem.bind(this)}
|
|
|
+ />
|
|
|
|
|
|
<Text style={styles.errorTextStyle}>
|
|
|
{this.props.error}
|