-
Notifications
You must be signed in to change notification settings - Fork 0
/
Floor.js
29 lines (25 loc) · 1.08 KB
/
Floor.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
import React, { Component } from 'react'
import { StyleSheet, Text, View,Image, Dimensions, TouchableHighlightBase } from 'react-native'
import Images from './assets/Images'
export default class Floor extends Component{
render(){
const width = this.props.body.bounds.max.x - this.props.body.bounds.min.x
const height = this.props.body.bounds.max.y - this.props.body.bounds.min.y
const x = this.props.body.position.x - width / 2
const y = this.props.body.position.y - height / 2
const imageIterations = Math.ceil(width/height)
return (
<View style={{position : 'absolute',
top : y,
left : x ,
width : width,
height : height,
overflow : "hidden",
flexDirection : "row" }} >
{Array.apply(null, Array(imageIterations)).map((element, index) => {
return <Image style={{width : height, height : height}} key={index} resizeMode="stretch" source={Images.floor} />
}) }
</View>
)
}
}