Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import { StyleSheet, Text, View ,Button ,TouchableHighlight , ListView ,TouchableOpacity ,Image} from 'react-native';
  3. import DatePicker from 'react-native-datepicker' ;
  4.  
  5. const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
  6. export default class Planning extends React.Component {
  7.   static navigationOptions = {
  8.     title: 'Planning',
  9.   }
  10.   constructor(props){
  11.       super(props)
  12.       this.state = {date:new Date() ,
  13.         dataSource: ds.cloneWithRows([{nom:'Pharmacie LA VICTOIRE' , ville:'Marrakech' ,adresse:'798, Unité 4, à côté de Diour Massakine et Boulangerie Ayourli ' } , {nom:'Pharmacie HANI' , ville:'Marrakech' ,adresse:'Rue Souraya Lot. Saâdia Résidence El Amane' },
  14.       {nom:'Pharmacie DU SOLEIL' , ville:'Marrakech' ,adresse:'28, Sidi Abbad IV' },{nom:'Pharmacie LA VICTOIRE' , ville:'Marrakech' ,adresse:'798, Unité 4, à côté de Diour Massakine et Boulangerie Ayourli ' } , {nom:'MASJID DAOUDIATE' , ville:'Marrakech' ,adresse:'app 2 imm 10 jnane awrad' } , {nom:'Pharmacie HANI' , ville:'Marrakech' ,adresse:'Rue Souraya Lot. Saâdia Résidence El Amane' }]),
  15.       };
  16.     }
  17.  
  18.     render(){
  19.       return (
  20.         <View>
  21.         <View style={{flexDirection: 'row' , justifyContent: 'space-between'}}>
  22.         <DatePicker
  23.           date={this.state.date}
  24.           mode="date"
  25.           placeholder="select date"
  26.           format="DD-MM-YYYY"
  27.           minDate="2016-05-01"
  28.           confirmBtnText="Confirm"
  29.           cancelBtnText="Cancel"
  30.           customStyles={{
  31.             dateIcon: {
  32.               position: 'absolute',
  33.               left: 0,
  34.               top: 4,
  35.               marginLeft: 0
  36.             },
  37.             dateInput: {
  38.               marginLeft: 36
  39.             }
  40.             // ... You can check the source to find the other keys.
  41.           }}
  42.           onDateChange={(date) => {this.setState({date: date})}}
  43.         />
  44.         <Button
  45.           onPress = { () => this.props.navigation.navigate('Planning')}
  46.           title="Ajouter"/>
  47.         </View>
  48.         <ListView style={{marginTop:10}}
  49.           dataSource={this.state.dataSource}
  50.           renderRow={(rowData) => <View style={{ flexDirection: 'row' ,  justifyContent:'center' , marginBottom:10 , height: 100  , backgroundColor: '#3498db'}}>
  51.             <TouchableOpacity style={{flex:1}}
  52.               onPress={() => this.props.navigation.navigate('Planning',{name: 'amine'})}>
  53.               <View style={styles.container}>
  54.                 <Text style={styles.text}>{rowData.nom.toUpperCase()}</Text>
  55.                 <Text style={styles.text2}>{rowData.ville}</Text>
  56.                 <Text style={styles.text2}>{rowData.adresse}</Text>
  57.               </View>
  58.             </TouchableOpacity>
  59.             <TouchableHighlight style={{justifyContent: 'center'}}>
  60.               <Image
  61.                 style={{width: 12, height: 12 , alignItems:'center'}}
  62.                 source={{uri:'https://image.flaticon.com/icons/png/128/32/32178.png'}}
  63.               />
  64.             </TouchableHighlight>
  65.  
  66.  
  67.           </View>}
  68.         />
  69.         </View>
  70.       )
  71.     }
  72.   }
  73.   const styles = StyleSheet.create({
  74.     container: {
  75.       flex: 1,
  76.       justifyContent: 'center',
  77.     },
  78.     text:{
  79.       fontWeight: 'bold' ,
  80.       fontSize:20 ,
  81.       color:'#ecf0f1' ,
  82.       left:10
  83.     },
  84.     text2:{
  85.       color:'#ecf0f1' ,
  86.       fontSize:13 ,
  87.       left:10,
  88.     }
  89.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement