diff --git a/app/components/Profile/CreateProfile.js b/app/components/Profile/CreateProfile.js
new file mode 100644
index 0000000..a6ea3ec
--- /dev/null
+++ b/app/components/Profile/CreateProfile.js
@@ -0,0 +1,225 @@
+import { List } from 'immutable';
+import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import { Button, Picker, ScrollView, Text, TextInput, View } from 'react-native';
+import { Avatar } from 'react-native-elements';
+
+import { getEmailAvailability, getNomAvailability } from '../../api/profile.js';
+
+import EditNomDeBid from './ProfileInputs/EditNomDeBid.js';
+import EmailInput from './ProfileInputs/EmailInput.js';
+import PasswordInput from './ProfileInputs/PasswordInput.js';
+import PhoneListInput from './ProfileInputs/PhoneListInput.js';
+
+import styles from './Profile.styles.js';
+
+const STRINGS = {
+ BUTTONS: {
+ CANCEL: 'Cancel',
+ SUBMIT: 'Register',
+ },
+ DEV: {
+ FORM_INCOMPLETE_SUBMIT: 'Incomplete form... how did the button become enabled?',
+ },
+ ERRORS: {
+ FORM_SUBMIT_ERRORS: 'Please complete all of the required fields. They have bold labels.',
+ },
+ HEADINGS: {
+ AVATAR: 'Want to add a picture?',
+ EMAIL: 'Email (this will be your username)',
+ NOM: 'and a Nom de Bid - your bidding alias!',
+ PASSWORD: 'For security, let\'s choose a password',
+ PERSONAL: 'Great! And now a bit about you...',
+ },
+};
+
+export default class CreateProfile extends Component {
+ static get propTypes() {
+ return {
+ cancelEditAction: PropTypes.func.isRequired,
+ saveProfileAction: PropTypes.func.isRequired,
+ };
+ }
+
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ addresses: new List(),
+ avatar: null,
+ email: null,
+ firstName: null,
+ lastName: null,
+ invalidEmail: null,
+ nomDeBid: null,
+ password: null,
+ passwordMatch: false,
+ phones: new List(),
+ };
+
+ this.handleCancel = this.handleCancel.bind(this);
+ this.handleSubmit = this.handleSubmit.bind(this);
+
+ this._handleValidPasswordEntry = this._handleValidPasswordEntry.bind(this);
+ }
+
+ _handleComponentStateUpdate(key, value) {
+ this.setState({ [key]: value });
+ }
+
+ _handleValidPasswordEntry(password) {
+ if (!password) {
+ this.setState({ passwordMatch: false });
+ return;
+ }
+
+ this.setState({ password, passwordMatch: true });
+ }
+
+ _validateEmail() {
+ getEmailAvailability(this.state.email)
+ .then((result) => {
+ console.log(`_validateEmail => getEmailAvailability(${this.state.email}):`, result);
+ this.setState({ invalidEmail: !result.available });
+ });
+ }
+
+ getProfileFromState() {
+ return {
+ addresses: this.state.addresses.toArray(),
+ avatar: this.state.avatar,
+ email: this.state.email,
+ firstName: this.state.firstName,
+ lastName: this.state.lastName,
+ nomDeBid: this.state.nomDeBid,
+ password: this.state.password,
+ phones: this.state.phones.toArray(),
+ };
+ }
+
+ handleCancel() {
+ this.props.cancelEditAction();
+ }
+
+ handleSubmit() {
+ if (!this.isFormComplete()) {
+ console.error(STRINGS.DEV.FORM_INCOMPLETE_SUBMIT);
+ alert(STRINGS.ERRORS.FORM_SUBMIT_ERRORS);
+ return;
+ }
+
+ this.props.saveProfileAction(this.getProfileFromState());
+ }
+
+ isFormComplete() {
+ return (
+ !!this.state.email &&
+ !!this.state.firstName &&
+ !!this.state.lastName &&
+ !!this.state.email &&
+ !!this.state.nomDeBid &&
+ !!this.state.phones.size &&
+ this.state.passwordMatch && !!this.state.password
+ );
+ }
+
+ render() {
+ const {
+ addresses,
+ avatar,
+ email,
+ firstName,
+ lastName,
+ nomDeBid,
+ password,
+ passwordMatch,
+ phones
+ } = this.state;
+
+ return (
+
+
+ {STRINGS.HEADINGS.EMAIL}
+ this.setState({ email })}
+ isRequired
+ showContinueButton
+ />
+ {email !== false && (
+
+ {`Great, lets add a bit more detail...`}
+
+ )}
+
+ {email !== null && (
+
+ {STRINGS.HEADINGS.PERSONAL}
+ this.setState({ firstName: text })}
+ placeholder="first name"
+ style={[styles.textInput, styles.requiredInput]}
+ value={this.state.firstName || ''}
+ />
+ this.setState({ lastName: text })}
+ placeholder="last name"
+ style={[styles.textInput, styles.requiredInput]}
+ value={this.state.lastName || ''}
+ />
+
+ )}
+ {firstName !== null && lastName !== null && (
+
+ {STRINGS.HEADINGS.PASSWORD}
+
+
+ )}
+ {passwordMatch && (
+
+ {STRINGS.HEADINGS.NOM}
+ this.setState({ nomDeBid })}
+ />
+
+ )}
+ {nomDeBid !== null && (
+
+
+ this.setState({ phones })}
+ handleDelete={(phones) => this.setState({ phones })}
+ handleEdit={(phones) => this.setState({ phones })}
+ phones={phones}
+ />
+
+
+ {addresses !== null && addresses.size > 0 && (
+ /* LIST ADDRESSES */
+
+ )}
+
+
+ {STRINGS.AVATAR_HEADING}
+ {avatar !== null ? (
+
+ ) : (
+
+ )}
+
+
+ )}
+ {phones.size > 0 && (
+
+
+
+ )}
+
+
+
+
+ );
+ }
+}
diff --git a/app/components/Profile/EditProfile.js b/app/components/Profile/EditProfile.js
index d3b1a2c..38944e5 100644
--- a/app/components/Profile/EditProfile.js
+++ b/app/components/Profile/EditProfile.js
@@ -6,18 +6,27 @@ import { Avatar } from 'react-native-elements';
import { getEmailAvailability, getNomAvailability } from '../../api/profile.js';
-import EditNomDeBid from './EditNomDeBid.js';
-import PhoneListInput from './PhoneInput/PhoneListInput.js';
+import EditNomDeBid from './ProfileInputs/EditNomDeBid.js';
+import PasswordInput from './ProfileInputs/PasswordInput.js';
+import PhoneListInput from './ProfileInputs/PhoneListInput.js';
+
import styles from './Profile.styles.js';
const STRINGS = {
- AVATAR_HEADING: 'Want to add a picture?',
- CANCEL: 'Cancel',
- EMAIL_HEADING: 'Email (this will be your username)',
- NOM_HEADING: 'and a Nom de Bid - your bidding alias!',
- PASSWORD_HEADING: 'For security, let\'s choose a password',
- PERSONAL_HEADING: 'Great! And now a bit about you...',
- SAVE_PROFILE: 'Save profile',
+ BUTTONS: {
+ CANCEL: 'Cancel',
+ SUBMIT: 'Save changes',
+ },
+ DEV: {
+ FORM_INCOMPLETE_SUBMIT: 'Incomplete form... how did the button become enabled?',
+ },
+ ERRORS: {
+ FORM_SUBMIT_ERRORS: 'Please complete all of the required fields. They have bold labels.',
+ },
+ HEADINGS: {
+ NOM: 'Nom de Bid',
+ PASSWORD: 'Password',
+ },
};
export default class EditProfile extends Component {
@@ -28,15 +37,13 @@ export default class EditProfile extends Component {
cancelEditAction: PropTypes.func.isRequired,
email: PropTypes.string,
firstName: PropTypes.string,
+ hasLocalAccount: PropTypes.bool,
initials: PropTypes.string,
isGeneratedNomDeBid: PropTypes.bool,
- isGuided: PropTypes.bool,
- isRegsiteredAccount: PropTypes.bool,
lastName: PropTypes.string,
nomDeBid: PropTypes.string,
phones: PropTypes.oneOfType([PropTypes.array, PropTypes.instanceOf(List)]),
saveProfileAction: PropTypes.func.isRequired,
- saveProfileLabel: PropTypes.string,
showPasswordEntry: PropTypes.bool,
};
}
@@ -47,28 +54,16 @@ export default class EditProfile extends Component {
avatar: null,
email: null,
firstName: null,
+ hasLocalAccount: false,
initials: null,
isGeneratedNomDeBid: false,
- isGuided: false,
- isRegsiteredAccount: false,
lastName: null,
nomDeBid: null,
phones: new List(),
- saveProfileLabel: STRINGS.SAVE_PROFILE,
showPasswordEntry: false,
};
}
- static validatePasswordMatch(password, passwordCheck) {
- if ((!password || !passwordCheck) ||
- (password || passwordCheck && password.length === passwordCheck.length)
- ){
- return null;
- }
-
- return password === passwordCheck;
- }
-
constructor(props) {
super(props);
@@ -81,7 +76,7 @@ export default class EditProfile extends Component {
invalidEmail: null,
nomDeBid: this.props.nomDeBid,
password: this.props.password,
- passwordCheck: null,
+ passwordMatch: false,
phones: this.props.phones,
};
@@ -89,6 +84,15 @@ export default class EditProfile extends Component {
this.handleSubmit = this.handleSubmit.bind(this);
}
+ _handleValidPasswordEntry(password) {
+ if (!password) {
+ this.setState({ passwordMatch: false });
+ return;
+ }
+
+ this.setState({ password, passwordMatch: true });
+ }
+
_validateEmail() {
getEmailAvailability(this.state.email)
.then((result) => {
@@ -97,6 +101,7 @@ export default class EditProfile extends Component {
});
}
+
getProfileFromState() {
return {
addresses: this.state.addresses.toArray(),
@@ -116,8 +121,8 @@ export default class EditProfile extends Component {
handleSubmit() {
if (!this.isFormComplete()) {
- console.error('Incomplete form... how did the button become enabled?');
- alert('Please complete all of the required fields. They have bold labels.');
+ console.error(STRINGS.DEV.FORM_INCOMPLETE_SUBMIT);
+ alert(STRINGS.ERRORS.FORM_SUBMIT_ERRORS);
return;
}
@@ -141,15 +146,19 @@ export default class EditProfile extends Component {
}
render() {
- const { isGeneratedNomDeBid, isGuided, isRegsiteredAccount, showPasswordEntry } = this.props;
+ const { hasLocalAccount, isGeneratedNomDeBid, showPasswordEntry } = this.props;
const { addresses, avatar, firstName, invalidEmail, lastName, password, passwordCheck, phones } = this.state;
- const addressesTitle = 'Addresses';
- const numbersTitle = 'Numbers';
return (
+
+ {avatar !== null ? (
+
+ ) : (
+
+ )}
+
- {STRINGS.EMAIL_HEADING}
{`Great, lets add a bit more detail...`}
)}
- {(!isGuided || (isGuided && invalidEmail === false)) && (
-
-
- {STRINGS.PERSONAL_HEADING}
- this.setState({ firstName: text })}
- placeholder="first name"
- style={[styles.textInput, styles.requiredInput]}
- value={this.state.firstName || ''}
- />
- this.setState({ lastName: text })}
- placeholder="last name"
- style={[styles.textInput, styles.requiredInput]}
- value={this.state.lastName || ''}
- />
-
- {showPasswordEntry &&
- (!isGuided || (isGuided && firstName !== null && lastName !== null)) &&
- (
-
- {STRINGS.PASSWORD_HEADING}
- this.setState({ password: text })}
- placeholder="password"
- secureTextEntry
- style={[styles.textInput, styles.requiredInput]}
- />
- this.setState({ passwordCheck: text })}
- placeholder="re-enter password"
- secureTextEntry
- style={[styles.textInput, styles.requiredInput]}
- />
- {EditProfile.validatePasswordMatch(password, passwordCheck) === true && (
- {`That's a match!`}
- )}
- {EditProfile.validatePasswordMatch(password, passwordCheck) === false && (
- {`Well that's not a match...`}
- )}
-
- )}
- {(isGeneratedNomDeBid || !isRegsiteredAccount) &&
- (!isGuided || (isGuided && EditProfile.validatePasswordMatch(password, passwordCheck) === true)) &&
- (
-
- {STRINGS.NOM_HEADING}
- this.setState({ nomDeBid })}
- />
-
- )}
- {(!isGuided || (isGuided && this.state.nomDeBid !== null)) && (
-
-
- this.setState({ phones })}
- handleDelete={(phones) => this.setState({ phones })}
- handleEdit={(phones) => this.setState({ phones })}
- phones={phones}
- />
-
-
- {addressesTitle}
- {addresses !== null && addresses.size > 0 && (
- /* LIST ADDRESSES */
-
- )}
-
-
- {STRINGS.AVATAR_HEADING}
- {avatar !== null ? (
-
- ) : (
-
- )}
-
-
- )}
- {(!isGuided || (isGuided && phones !== null && phones.size > 0)) && (
-
-
-
- )}
+
+ this.setState({ firstName: text })}
+ placeholder="first name"
+ style={[styles.textInput, styles.requiredInput]}
+ value={this.state.firstName || ''}
+ />
+ this.setState({ lastName: text })}
+ placeholder="last name"
+ style={[styles.textInput, styles.requiredInput]}
+ value={this.state.lastName || ''}
+ />
+
+ {showPasswordEntry && (
+
+ {STRINGS.HEADINGS.PASSWORD}
+
)}
-
-
+ {(isGeneratedNomDeBid || !hasLocalAccount) && (
+
+ {STRINGS.HEADINGS.NOM}
+ this.setState({ nomDeBid })}
+ />
+
+ )}
+
+ this.setState({ phones })}
+ handleDelete={(phones) => this.setState({ phones })}
+ handleEdit={(phones) => this.setState({ phones })}
+ phones={phones}
+ />
+
+
+ {addresses !== null && addresses.size > 0 && (
+ /* LIST ADDRESSES */
+
+ )}
+
+
+
+
);
diff --git a/app/components/Profile/PhoneInput/PhoneListItem.js b/app/components/Profile/PhoneInput/PhoneListItem.js
deleted file mode 100644
index 6420511..0000000
--- a/app/components/Profile/PhoneInput/PhoneListItem.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-
-import { Button, Text, View } from 'react-native';
-
-import styles from '../Profile.styles.js';
-
-export default function PhoneListItem({ index, label, number, handleDelete, handleEdit, handleEditStart }) {
- return (
-
-
- {number}
- {label}
-
-
- {handleEdit !== null &&
-
- );
-}
-
-PhoneListItem.propTypes = {
- index: PropTypes.number.isRequired,
- label: PropTypes.string.isRequired,
- number: PropTypes.string.isRequired,
- handleDelete: PropTypes.func.isRequired,
- handleEdit: PropTypes.func,
- handleEditStart: PropTypes.func.isRequired,
-};
-
-PhoneListItem.defaultProps = {
- handleEdit: null,
-};
-
-
-
diff --git a/app/components/Profile/Profile.js b/app/components/Profile/Profile.js
index ea115e8..5040e3c 100644
--- a/app/components/Profile/Profile.js
+++ b/app/components/Profile/Profile.js
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
+import CreateProfile from './CreateProfile.js';
import EditProfile from './EditProfile.container.js';
import ViewProfile from './ViewProfile.container.js';
@@ -10,7 +11,6 @@ export default function Profile({
isGuidedRegistration,
isInEditMode,
saveProfileAction,
- saveProfileLabel,
}) {
const [editMode, setEditMode] = useState(isInEditMode);
@@ -26,15 +26,20 @@ export default function Profile({
return (
- {editMode ? (
+ {!editMode && (
+ setEditMode(true)} />
+ )}
+ {editMode && isGuidedRegistration && (
+
+ )}
+ {editMode && !isGuidedRegistration && (
- ) : (
- setEditMode(true)} />
)}
);
@@ -45,7 +50,6 @@ Profile.propTypes = {
isGuidedRegistration: PropTypes.bool,
isInEditMode: PropTypes.bool,
saveProfileAction: PropTypes.func.isRequired,
- saveProfileLabel: PropTypes.string,
};
Profile.defaultProps = {
diff --git a/app/components/Profile/EditNomDeBid.container.js b/app/components/Profile/ProfileInputs/EditNomDeBid.container.js
similarity index 75%
rename from app/components/Profile/EditNomDeBid.container.js
rename to app/components/Profile/ProfileInputs/EditNomDeBid.container.js
index 1b98eba..276a6e5 100644
--- a/app/components/Profile/EditNomDeBid.container.js
+++ b/app/components/Profile/ProfileInputs/EditNomDeBid.container.js
@@ -1,7 +1,7 @@
import { connect } from 'react-redux';
-import { setNomDeBid } from '../../actions/profile.js';
-import { getNomDeBid, isGeneratedNomDeBid } from '../../selectors/profile.js';
+import { setNomDeBid } from '../../../actions/profile.js';
+import { getNomDeBid, isGeneratedNomDeBid } from '../../../selectors/profile.js';
import EditNomDeBid from './EditNomDeBid.js';
diff --git a/app/components/Profile/EditNomDeBid.js b/app/components/Profile/ProfileInputs/EditNomDeBid.js
similarity index 77%
rename from app/components/Profile/EditNomDeBid.js
rename to app/components/Profile/ProfileInputs/EditNomDeBid.js
index b06f15f..79a8ac1 100644
--- a/app/components/Profile/EditNomDeBid.js
+++ b/app/components/Profile/ProfileInputs/EditNomDeBid.js
@@ -3,15 +3,17 @@ import PropTypes from 'prop-types';
import { Button, Text, TextInput, View } from 'react-native';
import { Avatar } from 'react-native-elements';
-import { getNomAvailaibility } from '../../api/profile.js';
-import styles from './Profile.styles.js';
+import { getNomAvailaibility } from '../../../api/profile.js';
+import styles from '../Profile.styles.js';
const STRINGS = {
ABOUT_GENERATED_NOM:
'You currently have a generated Nom De Bid - the alias other bidders will know you as - why not personalize it?',
+ CHECK_AVAILABILITY: 'check availability',
NOM_EXPLANATION:
"Selecting a nom de bid allows you to bid anonymously - or not. By default, we'll use your first initial and last name.",
ONLY_SET_ONCE: 'This can only be set once!',
+ PLACEHOLDER: 'nom de bid',
SUBMIT_NOM: 'Set Nom De Bid',
};
@@ -24,22 +26,16 @@ export default function EditNomDeBid({
const [newNom, setNomDeBid] = useState(isGeneratedNomDeBid || !nomDeBid ? '' : nomDeBid);
const [isNomValid, setValidNom] = useState(null);
- const _handleEndEditing = () => {
+ const _handleEndEditing = (updateOnValid = false) => () => {
getNomAvailaibility(newNom).then((result) => {
setValidNom(result.available);
- if (isStandalone) {
+ if (updateOnValid && result.available) {
updateNomDeBid(newNom);
}
});
};
- const _handleSubmitNom = () => {
- if (isNomValid) {
- updateNomDeBid(newNom);
- }
- };
-
const explanationString = isGeneratedNomDeBid
? `${STRINGS.ABOUT_GENERATED_NOM} ${STRINGS.ONLY_SET_ONCE}`
: `${STRINGS.NOM_EXPLANATION} ${STRINGS.ONLY_SET_ONCE}`;
@@ -50,8 +46,8 @@ export default function EditNomDeBid({
setNomDeBid(text)}
- onEndEditing={() => _handleEndEditing()}
- placeholder="nom de bid"
+ onEndEditing={!isStandalone && _handleEndEditing(false)}
+ placeholder={STRINGS.PLACEHOLDER}
style={[styles.textInput, styles.requiredInput]}
value={newNom}
/>
@@ -61,13 +57,10 @@ export default function EditNomDeBid({
{isNomValid === true && (
Nom De Bid is available!
)}
- {!isStandalone && (
-
- )}
+
);
}
diff --git a/app/components/Profile/ProfileInputs/EmailInput.js b/app/components/Profile/ProfileInputs/EmailInput.js
new file mode 100644
index 0000000..dd4c925
--- /dev/null
+++ b/app/components/Profile/ProfileInputs/EmailInput.js
@@ -0,0 +1,86 @@
+import React, { useState } from 'react';
+import PropTypes from 'prop-types';
+import { Button, Text, TextInput, View } from 'react-native';
+
+import { getEmailAvailability } from '../../../api/profile.js';
+
+import styles from '../Profile.styles.js';
+
+const STRINGS = {
+ CONTINUE: 'continue',
+ PLACEHOLDER: 'email address',
+ REGISTERED: `You've already registered!`,
+ RESET_PASSWORD: 'reset password',
+};
+
+export default function EmailInput({ email, handleValidEmailEntry, isRequired, showContinueButton }) {
+ const [emailValue, setEmail] = useState(email);
+ const [isEmailAvailable, setEmailAvailable] = useState(null);
+
+ const _handleContinueButtonPress = () => {
+
+ };
+
+ const _handleEndEditing = () => {
+ if (!emailValue.match(/.+\@.+\..+/)) {
+ Alert.alert(
+ 'Invalid Email',
+ `Hmmm... You entered '${emailValue}' and something doesn't look quite right...`,
+ );
+
+ return;
+ }
+
+ getEmailAvailability(emailValue)
+ .then((result) => {
+ const { available } = result;
+
+ console.log(`EmailInput._validateEmail => getEmailAvailability(${emailValue}):`, result);
+
+ if (available) {
+ handleValidEmailEntry(emailValue);
+ }
+
+ setEmailAvailable(available);
+ });
+ };
+
+ return (
+
+
+ {isEmailAvailable === false && (
+
+ {STRINGS.REGISTERED}
+ {}} />
+
+ )}
+ {showContinueButton && !isEmailAvailable && (
+
+ )}
+
+ );
+}
+
+EmailInput.propTypes = {
+ email: PropTypes.string,
+ handleValidEmailEntry: PropTypes.func.isRequired,
+ isRequired: PropTypes.bool,
+ showContinueButton: PropTypes.bool,
+};
+
+EmailInput.defaultProps = {
+ email: null,
+ isRequired: false,
+ showContinueButton: false,
+}
diff --git a/app/components/Profile/ProfileInputs/PasswordInput.js b/app/components/Profile/ProfileInputs/PasswordInput.js
new file mode 100644
index 0000000..fcc1536
--- /dev/null
+++ b/app/components/Profile/ProfileInputs/PasswordInput.js
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import PropTypes from 'prop-types';
+import { Text, TextInput, View } from 'react-native';
+
+import styles from '../Profile.styles.js';
+
+const STRINGS = {
+ HINT: `Password must be at least 8 characters and contain a minimum of one lowercase and one uppercase letter, a number, and a symbol. Spaces are allowed. Be memorable and secure!`,
+ MATCH: `That's a match!`,
+ NO_MATCH: `Well that's not a match...`,
+ PLACEHOLDER_PASSWORD: 'password',
+ PLACEHOLDER_VERIFY: 're-enter password',
+};
+
+export default function PasswordInput({ handleValidPasswordEntry }) {
+ const [password, setPassword] = useState(null);
+ const [doPasswordsMatch, setPasswordMatch] = useState(null);
+
+ const _doesVerificationPasswordMatch = (text) => {
+ if (!password || password.length < text.length) {
+ setPasswordMatch(null);
+ return;
+ }
+
+ const result = password === text;
+ handleValidPasswordEntry(result && password);
+ setPasswordMatch(result);
+ };
+
+ return (
+
+ {STRINGS.HINT}
+
+
+ {doPasswordsMatch === true && {STRINGS.MATCH}}
+ {doPasswordsMatch === false && {STRINGS.NO_MATCH}}
+
+ );
+}
+
+PasswordInput.propTypes = {
+ handleValidPasswordEntry: PropTypes.func.isRequired,
+};
diff --git a/app/components/Profile/PhoneInput/PhoneListInput.js b/app/components/Profile/ProfileInputs/PhoneListInput.js
similarity index 98%
rename from app/components/Profile/PhoneInput/PhoneListInput.js
rename to app/components/Profile/ProfileInputs/PhoneListInput.js
index f74d01c..e7771c4 100644
--- a/app/components/Profile/PhoneInput/PhoneListInput.js
+++ b/app/components/Profile/ProfileInputs/PhoneListInput.js
@@ -82,6 +82,7 @@ export default class PhoneListInput extends Component {
{phones.map((phone, index) =>
{
+ handleDelete(index);
+ };
+
+ const _onPressDelete = (isLongPress = false) => () => {
+ if (isLongPress) {
+ handleDelete(index);
+ return;
+ }
+
+ Alert.alert(
+ 'Delete this number?',
+ 'Are you sure you want to delete this number?',
+ [
+ { text: 'Cancel', style: 'cancel' },
+ { text: 'OK', onPress: () => handleDelete(index) },
+ ],
+ { cancelable: true },
+ );
+ };
+
+ return (
+
+
+ {number}
+ {label}
+
+
+ {handleEdit !== null && handleEditStart()} />}
+ {!hideDelete && (
+
+ )}
+
+
+ );
+}
+
+PhoneListItem.propTypes = {
+ hideDelete: PropTypes.bool,
+ index: PropTypes.number.isRequired,
+ label: PropTypes.string.isRequired,
+ number: PropTypes.string.isRequired,
+ handleDelete: PropTypes.func.isRequired,
+ handleEdit: PropTypes.func,
+ handleEditStart: PropTypes.func.isRequired,
+};
+
+PhoneListItem.defaultProps = {
+ hideDelete: false,
+ handleEdit: null,
+};
+
+
+
diff --git a/app/components/Profile/ViewProfile.js b/app/components/Profile/ViewProfile.js
index f04b6f6..6232a26 100644
--- a/app/components/Profile/ViewProfile.js
+++ b/app/components/Profile/ViewProfile.js
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import { Button, ScrollView, Text, TextInput, View } from 'react-native';
import { Avatar } from 'react-native-elements';
-import EditNomDeBid from './EditNomDeBid.container.js';
+import EditNomDeBid from './ProfileInputs/EditNomDeBid.container.js';
import styles from './Profile.styles.js';
diff --git a/app/screens/Register.js b/app/screens/Register.js
index 2ae96e6..dbf3659 100644
--- a/app/screens/Register.js
+++ b/app/screens/Register.js
@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Text, View } from 'react-native';
-import EditProfile from '../components/Profile/EditProfile.container.js';
+import CreateProfile from '../components/Profile/CreateProfile.js';
import styles from './Register.styles.js';
@@ -20,11 +20,9 @@ export default function Register({ doRegistration, navigation }) {
return (
{title}
- navigation.goBack()}
- isGuided
saveProfileAction={_doRegistration}
- saveProfileLabel="Register"
showPasswordEntry
/>