in src/components/custom-field/custom-field.tsx [100:151]
_renderValue(value: CustomFieldValue | CustomFieldValue[], fieldType: string | null) {
const { active, disabled } = this.props;
const textStyle = [
styles.valueText,
active && styles.valueTextActive,
disabled && styles.valueTextDisabled,
];
const render = (val: CustomFieldValue | null) => {
const valuePresentation: string = this._getValue(val, fieldType) || '';
return (
<View style={styles.value} key="value" accessible={false}>
{val && fieldType === 'user' ? this.renderAvatar(val as User) : null}
<Text testID="test:id/value" accessible={true} style={textStyle}>
{valuePresentation?.length > maxValueStringWidth
? `${valuePresentation.substring(0, maxValueStringWidth)}…`
: valuePresentation}
</Text>
{isURLPattern(valuePresentation) && (
<TouchableOpacity
hitSlop={HIT_SLOP}
onPress={() => Linking.openURL(valuePresentation.trim())}
>
<IconUrl
width={14}
height={14}
fill={styles.url.color}
style={styles.url}
/>
</TouchableOpacity>
)}
</View>
);
};
if (Array.isArray(value)) {
if (!value.length) {
return render(null);
}
return value.map((val, ind) => {
return [
render(val),
<Text style={textStyle} key={`cf-${ind}`}>
{ind === value.length - 1 ? ' ' : ', '}
</Text>,
];
});
}
return render(value);
}