-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtail.js
42 lines (37 loc) · 1.14 KB
/
tail.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
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { SettingsContext } from './settings/SettingsContext';
class Tail extends Component {
static contextType = SettingsContext;
constructor(props) {
super(props);
}
render() {
const tailList = this.props.elements.map((pos, i) => {
return (
<View
key={i}
style={[
styles.tail,
{
width: this.props.size,
height: this.props.size,
left: pos[0] * this.props.size,
top: pos[1] * this.props.size,
backgroundColor: this.context.theme.complementary2,
borderColor: this.context.theme.primary,
},
]}
/>
);
});
return <View>{tailList}</View>;
}
}
const styles = StyleSheet.create({
tail: {
position: 'absolute',
borderWidth: 1,
},
});
export { Tail };