Skip to content
23 changes: 16 additions & 7 deletions source/community/reactnative/src/components/elements/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import React from 'react';
import {
StyleSheet,
Image
Image,
View
} from 'react-native';

import * as Utils from '../../utils/util';
Expand Down Expand Up @@ -273,19 +274,27 @@ export class Img extends React.Component {
}

getImageComponent(imageUrl, wrapperComputedStyle, imageComputedStyle) {
console.log(this.payload.altText);
return (
<ElementWrapper
configManager={this.props.configManager}
json={this.payload}
isFirst={this.props.isFirst}
style={wrapperComputedStyle}
onPageLayout={this.onPageLayoutHandler}>
<BaseImage
style={imageComputedStyle}
accessible={true}
accessibilityLabel={this.payload.altText}
source={{uri: imageUrl}}
/>
{
this.payload.altText ? <View
accessible={true}
accessibilityLabel={this.payload.altText}>
<BaseImage
style={imageComputedStyle}
source={{uri: imageUrl}}
/>
</View> : <BaseImage
style={imageComputedStyle}
source={{uri: imageUrl}}
/>
}
</ElementWrapper>
);
}
Expand Down
8 changes: 3 additions & 5 deletions source/community/reactnative/src/utils/markdown-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ export default class MarkdownFormatter extends React.PureComponent {
}

return (
this.altText ?
<View accessible={true} accessibilityLabel={this.altText}>
{this.renderText(this.text)}
</View> :
this.renderText(this.text)
<View accessible={true} accessibilityLabel={this.altText || this.text} style={{alignSelf: 'baseline'}}>
{this.renderText(this.text)}
</View>
);
}

Expand Down