selvi jp

selvi jp

  • NA
  • 323
  • 77.7k

select dropdown react native

Sep 27 2021 5:02 AM

Hi,

I want to select dropdown in react native. if i click the user_id value is null

 formdata {"_parts": [["Group_Name", "gangname"], ["user_id", " "], ["ImagePath", [Object]]]}

500 error will appear.

Second time click the user_id value is pass.

 formdata {"_parts": [["Group_Name", "Gangname"], ["user_id", "75t7hghnghdtfg5ryu"], ["ImagePath", [Object]]]}

I dont know why.Can anyone solve this.

 function onMultiChange() {

    return item => setSelectedTeams(xorBy(selectedTeams, [item], 'id'));

  }

 const onSubmit = async () => {

    try {

      var ids = [];

      selectedTeams.forEach((i, v) => {

        ids.push(i.id);

      });

      setselectedid(ids.toString());

   

      let formdata = new FormData();

      formdata.append('Group_Name', Uploadgangname);

      formdata.append('user_id', selectedid);

     

      await  (url', formdata)

        .then(response => {

       

        })

        .catch(error => {

          console.error(error);

        });

    } catch (e) {

      console.log(e);

    }

  };

  <SelectBox

              selectedValues={selectedTeams}

            onMultiSelect={onMultiChange()}

            onTapClose={onMultiChange()}

            isMulti

          />


Answers (1)