Skip to content

Commit d67038d

Browse files
authored
Merge pull request #61 from i6mi6/master
Fixed Warning: 'Using <Image> with children is deprecated'
2 parents ed72401 + 1614fd6 commit d67038d

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

ImageItem.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {Component} from 'react';
1+
import React, { Component } from 'react';
22
import {
33
Image,
44
StyleSheet,
@@ -8,40 +8,39 @@ import {
88
import PropTypes from 'prop-types';
99

1010
class ImageItem extends Component {
11-
constructor(props){
11+
constructor(props) {
1212
super(props)
1313
}
1414

1515
componentWillMount() {
16-
var {width} = Dimensions.get('window');
17-
var {imageMargin, imagesPerRow, containerWidth} = this.props;
16+
var { width } = Dimensions.get('window');
17+
var { imageMargin, imagesPerRow, containerWidth } = this.props;
1818

19-
if(typeof containerWidth != "undefined") {
19+
if (typeof containerWidth != "undefined") {
2020
width = containerWidth;
2121
}
2222
this._imageSize = (width - (imagesPerRow + 1) * imageMargin) / imagesPerRow;
2323
}
2424

2525
render() {
26-
var {item, selected, selectedMarker, imageMargin} = this.props;
26+
var { item, selected, selectedMarker, imageMargin } = this.props;
2727

2828
var marker = selectedMarker ? selectedMarker :
29-
<Image
30-
style={[styles.marker, {width: 25, height: 25}]}
31-
source={require('./circle-check.png')}
32-
/>;
29+
<Image
30+
style={[styles.marker, { width: 25, height: 25 }]}
31+
source={require('./circle-check.png')}
32+
/>;
3333

3434
var image = item.node.image;
3535

3636
return (
3737
<TouchableOpacity
38-
style={{marginBottom: imageMargin, marginRight: imageMargin}}
38+
style={{ marginBottom: imageMargin, marginRight: imageMargin }}
3939
onPress={() => this._handleClick(image)}>
4040
<Image
41-
source={{uri: image.uri}}
42-
style={{height: this._imageSize, width: this._imageSize}} >
43-
{ (selected) ? marker : null }
44-
</Image>
41+
source={{ uri: image.uri }}
42+
style={{ height: this._imageSize, width: this._imageSize }} />
43+
{(selected) ? marker : null}
4544
</TouchableOpacity>
4645
);
4746
}

0 commit comments

Comments
 (0)