dimanche 2 septembre 2018

cant know how to use post method in react native

     constructor(props) {
        super(props);
        this.state = {text: this.props.navigation.state.params.text,
    name:this.props.navigation.state.params.name};
      }

    manage = () => {

    Alert.alert('done')
      Actions.reset('mainScreen');

    fetch("http://ip/api/confirm", {
      method: "POST",
      headers: {
        Accept: "application/json",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({

        name: this.props.navigation.state.params.name,
n=text:this.props.navigation.state.params.name
      })
    })
    .then(response => response.json())

      .catch(error => {
        console.error(error);
      });

    }

i want to do this

when i press in button go to manage function and post the text and the name to my api i dont know how can i do this any help please



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire