fix uri should not be undefined warning

This commit is contained in:
Bart Akeley 2017-04-20 06:19:10 -05:00
parent 8a0e2dc187
commit 5c85ce9982
2 changed files with 6 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import { View, Image } from 'react-native';
import { pure } from 'recompose'; import { pure } from 'recompose';
export default pure(({ uri }: { uri?: string }) => ( export default pure(({ uri }: { uri?: string }) => (
<View style={{ position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 }}> <View style={{ position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 }}>
<Image style={{ flex: 1, resizeMode: 'stretch' }} source={{ uri }} /> {!!uri && <Image style={{ flex: 1, resizeMode: 'stretch' }} source={{ uri }} />}
</View> </View>
)); ));

View file

@ -4,7 +4,7 @@ import { View, Image } from 'react-native';
import { pure } from 'recompose'; import { pure } from 'recompose';
export default pure(({ uri, style }: { uri: string, style?: Object }) => ( export default pure(({ uri, style }: { uri: string, style?: Object }) => (
<View style={{ height: 50, width: 50, margin: 10, backgroundColor: 'grey', ...style }}> <View style={{ height: 50, width: 50, margin: 10, backgroundColor: 'grey', ...style }}>
<Image source={{ uri }} style={{ flex: 1, resizeMode: 'stretch' }} /> {!!uri && <Image source={{ uri }} style={{ flex: 1, resizeMode: 'stretch' }} />}
</View> </View>
)); ));