Guest User

Untitled

a guest
Jan 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. import React from 'react';
  2. import { StyleSheet, Text, View, Image } from 'react-native';
  3.  
  4. export default class App extends React.Component {
  5. render() {
  6. return (
  7. <View style={styles.container}>
  8. <View style={{height:100}}/>
  9. <View style={styles.trackingContainer}>
  10. <TrackingItem stageName="Payment" left={false}/>
  11. <TrackingItem stageName="Shipping" style={{flexBasis: 50, flexGrow: 1}}/>
  12. <TrackingItem stageName="Confirmation" right={false}/>
  13. </View>
  14. </View>
  15. );
  16. }
  17. }
  18.  
  19. const Line = function({style, left = true, right = true}) {
  20. return <View style={[style, {height : StyleSheet.hairlineWidth, backgroundColor: 'black', position : 'absolute', top: '50%', left: left?0 : '50%', right: right?0:'50%'}]}></View>
  21. }
  22. class TrackingItem extends React.Component {
  23. render() {
  24. const { left = true, right = true } = this.props;
  25. return (
  26. <View style={[this.props.style, { alignItems: "center" }]}>
  27. <Image
  28. resizeMode="contain"
  29. source={this.props.logoImage || require("./images/location-blue.png")}
  30. style={{ width: 15, height: 14 }}
  31. />
  32. <View style={{alignItems:'center', width: "100%"}}>
  33. <Line left={left} right={right}/>
  34. <Image
  35. resizeMode="contain"
  36. source={this.props.stageImage || require("./images/circle.png")}
  37. style={{
  38. backgroundColor: "#F5F5F5",
  39. width: 12,
  40. height: 12,
  41. marginVertical: 10
  42. }}
  43. />
  44. </View>
  45. <View style={{ alignItems: "center" }}>
  46. <Text
  47. style={[
  48. styles.fontSmall,
  49. styles.fontRegular
  50. ]}
  51. >
  52. {this.props.stageName}
  53. </Text>
  54. </View>
  55. </View>
  56. );
  57. }
  58. }
  59.  
  60. const styles = StyleSheet.create({
  61. container: {
  62. flex: 1,
  63. backgroundColor: '#fff',
  64. alignItems: 'center',
  65. },
  66. trackingContainer : {
  67. paddingHorizontal: 20,
  68. width : "100%",
  69. justifyContent : "space-between",
  70. flexDirection : "row"
  71. }
  72. });
Add Comment
Please, Sign In to add comment