Skip to content

Commit

Permalink
pass details obj
Browse files Browse the repository at this point in the history
  • Loading branch information
Jag96 committed Jun 23, 2021
1 parent a5fec46 commit 6c776e0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/pages/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ const propTypes = {
/**
* Gets the phone number to display for SMS logins
*
* @param {String} login
* @param {String} displayName
* @param {Object} details
* @param {String} details.login
* @param {String} details.displayName
* @returns {String}
*/
const getPhoneNumber = (login, displayName) => {
const getPhoneNumber = (details) => {
// If the user hasn't set a displayName, it is set to their phone number, so use that
if (Str.isValidPhone(displayName)) {
return displayName;
if (Str.isValidPhone(details.displayName)) {
return details.displayName;
}

// If the user has set a displayName, get the phone number from the SMS login
return Str.removeSMSDomain(login);
return Str.removeSMSDomain(details.login);
};

const DetailsPage = ({
Expand Down Expand Up @@ -104,7 +105,7 @@ const DetailsPage = ({
</Text>
<Text style={[styles.textP]} numberOfLines={1}>
{isSMSLogin
? toLocalPhone(getPhoneNumber(details.login, details.displayName))
? toLocalPhone(getPhoneNumber(details))
: details.login}
</Text>
</View>
Expand Down

0 comments on commit 6c776e0

Please sign in to comment.