Advertisement
Guest User

Untitled

a guest
May 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // CreativeList component
  2.  
  3. export default class CreativeList extends Component {
  4.     render(){
  5.         return (
  6.             <ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
  7.                 <FlatList
  8.                     horizontal
  9.                     keyExtractor={item => item.ID}
  10.                     data={this.props.list}
  11.                     renderItem={({item}) => <CreativeListItem data={item} />}
  12.                 />
  13.             </ScrollView>
  14.         );
  15.     }
  16. }
  17.  
  18. -----------------------------------------------------------------------------------------------------------------
  19.  
  20. // CreativeListItem Component
  21.  
  22. export default class CreativeListItem extends Component {
  23.     render(){
  24.         let item = this.props.data;
  25.         if(!item.SubTitle){
  26.             item.SubTitle = 0.4;
  27.         }
  28.         return (
  29.             <Card style={nativeBaseStyle.card}>
  30.                 <TouchableOpacity style={styles.cardContainer} onPress={this.openInBrowser}>
  31.                     <View style={styles.cardImageContainer} onPress={() => console.log('icon pressed')} >
  32.                         <Image style={styles.cardImage} source={{uri: item.Icon}} />
  33.                     </View>
  34.                     <View style={styles.cardDescription}>
  35.                         <Text style={[styles.textCardDescription, styles.appName]}>{item.Name}</Text>
  36.                         <Text style={[styles.textCardDescription, styles.appPrice]}>{ item.SubTitle / MEAL_PRICE } <Icon name='md-restaurant' android='md-restaurant' ios='ios-restaurant' style={nativeBaseStyle.mealIcon} /> ({item.SubTitle}$)</Text>
  37.                     </View>
  38.                 </TouchableOpacity>
  39.             </Card>
  40.         );
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement