xSiRON

hacker-challenge

Mar 24th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import { StyleSheet, ScrollView, Text, View, Image } from 'react-native';
  3.  
  4. class Card extends Component {
  5.   render(){
  6.     return (
  7.       <View style={styles.container}>
  8.         <Image source={{uri: this.props.image}} style={{width:150, height: 150}}/>
  9.         <Text style={{color: 'steelblue', marginTop: 5}}>Hello World, {this.props.title}!</Text>
  10.       </View>
  11.     );
  12.   }
  13. }
  14.  
  15. let progLang = [
  16.   {
  17.     title: "React Native",
  18.     imageurl: "http://angular.github.io/react-native-renderer/assets/react.png"
  19.   },
  20.   {
  21.     title: "JavaScript",
  22.     imageurl: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Unofficial_JavaScript_logo_2.svg/1024px-Unofficial_JavaScript_logo_2.svg.png"
  23.   },
  24.   {
  25.     title: "C++",
  26.     imageurl: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/ISO_C%2B%2B_Logo.svg/1200px-ISO_C%2B%2B_Logo.svg.png"
  27.   },
  28.   {
  29.     title: "Java",
  30.     imageurl: "https://image.flaticon.com/icons/png/512/226/226777.png"
  31.   }
  32. ];
  33.  
  34. export default class App extends Component {
  35.   render() {
  36.     let LangCard = progLang.map(lang => {
  37.       return (
  38.         <Card
  39.           key = {"LanguageCard" + lang.title }
  40.           image = {lang.imageurl}
  41.           title = {lang.title}
  42.         />
  43.       );
  44.     })
  45.     return (
  46.       <View style={{
  47.             flex: 1,
  48.             backgroundColor: "steelblue",
  49.             alignItems: "center",
  50.             justifyContent: "center",}}>
  51.         <ScrollView>
  52.             {LangCard}
  53.         </ScrollView>
  54.       </View>
  55.     );
  56.   }
  57. }
  58.  
  59. const styles = StyleSheet.create({
  60.   container: {
  61.     backgroundColor: '#fff',
  62.     alignItems: 'center',
  63.     justifyContent: 'center',
  64.     marginTop: 10,
  65.     height: 200,
  66.     width: 330,
  67.     borderRadius: 10,
  68.   },
  69. });
Add Comment
Please, Sign In to add comment