[MM-24706] Use cache only for http URIs (#4257)

* Use cache only for http URIs

* Style fixes

* No need for cache prop

* Remove redundant absolute positioning

* Cap at two lines
This commit is contained in:
Miguel Alatzar 2020-05-06 19:30:42 -07:00 committed by GitHub
parent 67fa7aeb53
commit 65314fae47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 11 deletions

View file

@ -186,18 +186,16 @@ exports[`ImagePreview should match snapshot 1`] = `
}
style={
Object {
"bottom": 0,
"justifyContent": "flex-end",
"left": 0,
"maxHeight": 64,
"paddingBottom": 0,
"paddingHorizontal": 24,
"position": "absolute",
"right": 0,
}
}
>
<Text
ellipsizeMode="tail"
numberOfLines={2}
style={
Object {
"color": "white",

View file

@ -313,7 +313,11 @@ export default class ImagePreview extends PureComponent {
colors={['transparent', '#000000']}
pointerEvents='none'
>
<Text style={style.filename}>
<Text
style={style.filename}
numberOfLines={2}
ellipsizeMode='tail'
>
{(files[index] && files[index].caption) || ''}
</Text>
</LinearGradient>
@ -375,12 +379,11 @@ export default class ImagePreview extends PureComponent {
const flattenStyle = StyleSheet.flatten(style);
const calculatedDimensions = calculateDimensions(height, width, deviceWidth, deviceHeight - statusBar);
const imageStyle = {...flattenStyle, ...calculatedDimensions};
const src = {...source, cache: FastImage.cacheControl.cacheOnly};
return (
<View style={[style, {justifyContent: 'center', alignItems: 'center'}]}>
<FastImage
source={src}
source={source}
style={imageStyle}
/>
</View>
@ -646,10 +649,6 @@ const style = StyleSheet.create({
width: '100%',
},
footer: {
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
maxHeight: 64,
justifyContent: 'flex-end',
paddingHorizontal: 24,