[TicTacToe] Fix missing image styles for TicTacToe example

Summary:
Without a width or height set for the X or O image they don't appear, fix this problem by adding styles with width and height specified.
Closes https://github.com/facebook/react-native/pull/1122
Github Author: Rusty Conover <rusty@luckydinosaur.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Rusty Conover 2015-06-11 18:00:33 -07:00
parent 66c7511f73
commit 394cc661a1
1 changed files with 23 additions and 1 deletions

View File

@ -118,6 +118,17 @@ var Cell = React.createClass({
}
},
imageStyle() {
switch (this.props.player) {
case 1:
return styles.imageX;
case 2:
return styles.imageO;
default:
return {};
}
},
textContents() {
switch (this.props.player) {
case 1:
@ -147,7 +158,7 @@ var Cell = React.createClass({
underlayColor="transparent"
activeOpacity={0.5}>
<View style={[styles.cell, this.cellStyle()]}>
<Image source={{uri: this.imageContents()}} />
<Image source={{uri: this.imageContents()}} style={this.imageStyle()}/>
</View>
</TouchableHighlight>
);
@ -293,6 +304,17 @@ var styles = StyleSheet.create({
color: '#b9dc2f',
},
// CELL IMAGE
imageX: {
width: 34,
height: 42,
},
imageO: {
width: 45,
height: 41,
},
// GAME OVER
overlay: {