This repository has been archived by the owner on May 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.js
55 lines (51 loc) · 1.39 KB
/
Block.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { Component } from "react";
import { ImageBackground, View, Text } from "react-native";
import { array, object, string } from 'prop-types';
export default class Block extends Component {
render() {
const width = this.props.size[0];
const height = this.props.size[1];
const x = this.props.body.position.x - width / 2;
const y = this.props.body.position.y - height / 2;
// console.log(this.props.body)
//backgroundColor: this.props.color || "pink",
// borderWidth: 2,
// borderColor: 'white',
// transform: [{rotate: this.props.body.angle + 'rad'}],
return (
<View
style={{
position: "absolute",
left: x,
top: y,
width: width,
height: height,
flex: 1,
justifyContent: 'center',
alignItems: 'center',
//backgroundColor: this.props.color
}}
>
<ImageBackground
source={require('./assets/floor.png')}
style={{
flex: 1,
width: width+4,
height: height+4,
//zIndex: 1
}}/>
<Text style={{color: 'white'}}>
{this.props.letter}
</Text>
<Text style={{color: 'white'}}>
{" "+this.props.text}
</Text>
</View>
);
}
}
Block.propTypes = {
size: array,
body: object,
color: string
}