Advertisement
Guest User

Untitled

a guest
Sep 25th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {Component} from 'react';
  2. import {List, ListItem, View, Text, Thumbnail} from 'native-base';
  3. import data from '../mock/calendar';
  4. import {Platform, StyleSheet} from 'react-native';
  5.  
  6. class CalendarList extends Component {
  7.   constructor(props) {
  8.     super(props);
  9.     this.state = {
  10.       TextHolder: null,
  11.     };
  12.   }
  13.  
  14.   replaceTextFunction = () => {
  15.     var oldText = this.state.TextHolder.toString();
  16.     var newText = oldText.replace('_', ' ');
  17.     this.setState({
  18.       TextHolder: newText,
  19.     });
  20.   };
  21.   render() {
  22.     return (
  23.       <List>
  24.         {data.map(item => (
  25.           <ListItem
  26.             key={item.id}
  27.             avatar
  28.             noIndent
  29.             noBorder
  30.             style={{
  31.               borderBottomColor: 'rgba(192,192,192,0.7)',
  32.               borderBottomWidth: 0.5,
  33.             }}>
  34.             <View style={{paddingRight: 15}}>
  35.               <Thumbnail source={{uri: item.person.avatar}} />
  36.             </View>
  37.             <View style={styles.listContainer}>
  38.               <Text>{item.person.name}</Text>
  39.               <Text note style={{color: 'red'}}>
  40.                 {(this.state.TextHolder = item.type)} // <- right here
  41.               </Text>
  42.             </View>
  43.           </ListItem>
  44.         ))}
  45.       </List>
  46.     );
  47.   }
  48. }
  49.  
  50. export default CalendarList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement