mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
[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:
parent
1295c004e0
commit
21a64189d6
@ -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: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user