application-amicale/screens/Tetris/components/Cell.js

42 lines
896 B
JavaScript
Raw Normal View History

2020-03-15 18:44:32 +01:00
// @flow
import * as React from 'react';
import {View} from 'react-native';
import {withTheme} from 'react-native-paper';
2020-03-15 20:18:48 +01:00
type Props = {
color: string,
isEmpty: boolean,
id: string,
}
class Cell extends React.PureComponent<Props> {
colors: Object;
constructor(props) {
super(props);
this.colors = props.theme.colors;
}
render() {
return (
<View
style={{
flex: 1,
2020-03-17 14:22:49 +01:00
backgroundColor: this.props.isEmpty ? 'transparent' : this.props.color,
borderColor: this.props.isEmpty ? 'transparent' : this.colors.tetrisBorder,
2020-03-15 20:18:48 +01:00
borderStyle: 'solid',
2020-03-20 21:15:37 +01:00
borderRadius: 2,
2020-03-15 20:18:48 +01:00
borderWidth: 1,
aspectRatio: 1,
}}
/>
);
}
2020-03-15 18:44:32 +01:00
}
export default withTheme(Cell);