diff --git a/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js b/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js index bb0039858..ee8c38368 100644 --- a/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js +++ b/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js @@ -44,7 +44,7 @@ const WalletLineItem = ({ )} - {text && ( + {!!text && ( userActivities.map(item => ({ ...item, - icon: POINTS[item.type].icon, - iconType: POINTS[item.type].iconType, - textKey: POINTS[item.type].textKey, + icon: get(POINTS[get(item, 'type')], 'icon'), + iconType: get(POINTS[get(item, 'type')], 'iconType'), + textKey: get(POINTS[get(item, 'type')], 'textKey'), })); _fetchuserPointActivities = async username => { diff --git a/src/components/points/view/pointsView.js b/src/components/points/view/pointsView.js index 681cb850d..82ca9c13e 100644 --- a/src/components/points/view/pointsView.js +++ b/src/components/points/view/pointsView.js @@ -1,9 +1,8 @@ -/* eslint-disable no-nested-ternary */ import React, { Component, Fragment } from 'react'; import { Text, View, FlatList, ScrollView, RefreshControl, TouchableOpacity } from 'react-native'; import { injectIntl } from 'react-intl'; import { Popover, PopoverController } from 'react-native-modal-popover'; -import { get, size } from 'lodash'; +import { get } from 'lodash'; // Components import { LineBreak, WalletLineItem, ListPlaceHolder } from '../../basicUIElements'; @@ -48,6 +47,19 @@ class PointsView extends Component { ); }; + _getTranslation = id => { + const { intl } = this.props; + let translation; + + try { + translation = intl.formatMessage({ id }); + } catch (error) { + translation = ''; + } + + return translation; + }; + _renderLoading = () => { const { isLoading, intl } = this.props; @@ -58,7 +70,7 @@ class PointsView extends Component { }; render() { - const { claimPoints, intl, isClaiming, userActivities, userPoints } = this.props; + const { claimPoints, isClaiming, userActivities, userPoints } = this.props; return ( @@ -113,7 +125,7 @@ class PointsView extends Component { - {intl.formatMessage({ id: get(POINTS[get(item, 'type')], 'nameKey') })} + {this._getTranslation(get(POINTS[get(item, 'type')], 'nameKey'))} - {intl.formatMessage({ - id: get(POINTS[get(item, 'type')], 'descriptionKey'), - })} + {this._getTranslation(get(POINTS[get(item, 'type')], 'descriptionKey'))} @@ -152,7 +162,7 @@ class PointsView extends Component { renderItem={({ item, index }) => (