Advertisement
Guest User

Untitled

a guest
Oct 21st, 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 { SafeAreaView, ScrollView, View, StyleSheet, Text, Button} from 'react-native';
  3. import Icon from 'react-native-vector-icons/FontAwesome';
  4. import Api from '../Api';
  5.  
  6.  
  7. export default class Detalhes extends Component {  
  8.   constructor(props) {
  9.     super(props);
  10.     this.state = {
  11.       immobile : null,
  12.  
  13.     }
  14.   }
  15.  
  16.   async componentDidMount(){
  17.     const { codImmobile } =  this.props.navigation.state.params;
  18.     const response = await Api.post("/", {class:'immobile', action:'details', id: codImmobile});
  19.     const { data } = response;
  20.     this.setState({immobile: data});
  21.     console.log(this.state.immobile);
  22.   }
  23.  
  24.   render() {
  25.     const immob = this.state.immobile;
  26.     //const {title_ad} = this.state.immobile;
  27.     console.log(immob);
  28.     //console.log(title_ad);
  29.     return(
  30.         <SafeAreaView>
  31.           <ScrollView>
  32.             <View style={styles.container}>
  33.              
  34.               <Text style={styles.title}> </Text>
  35.               <Button title="Voltar" onPress={() => this.props.navigation.navigate('Dashboard')}/>
  36.             </View>
  37.           </ScrollView>
  38.         </SafeAreaView>
  39.  
  40.         );
  41.   }
  42. }
  43. const styles = StyleSheet.create({
  44.   container: {
  45.     marginTop: 5,
  46.     flex: 1,
  47.     justifyContent: 'center',
  48.     alignItems: 'center',
  49.   },
  50.   title:{
  51.     fontSize: 15,
  52.   }
  53. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement