Created
October 2, 2017 07:18
-
-
Save ysfzrn/6c4a84bcde918f37180ae06303cb42c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/components/segment.js | |
import React, { Component } from "react"; | |
import { View, Text, StyleSheet } from "react-native"; | |
import SharedStyle from "../utils/sharedStyle"; | |
// create a component | |
class Segment extends Component { | |
render() { | |
const customStyle = { | |
left: this.props.x, | |
top: this.props.y | |
}; | |
return <View style={[styles.container, customStyle]} />; | |
} | |
} | |
// define your styles | |
const styles = StyleSheet.create({ | |
container: { | |
position: "absolute", | |
width: SharedStyle.segment.width, | |
height: SharedStyle.segment.height, | |
backgroundColor: SharedStyle.color.snake, | |
borderWidth: SharedStyle.segment.borderWidth, | |
borderColor: SharedStyle.segment.borderColor | |
} | |
}); | |
//make this component available to the app | |
export default Segment; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment