Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
How to get API data in multi picker React native

API response

{
    "result": [
        {
            "id": "postcode-0001",
            "text": "0200"
        },
        {
            "id": "postcode-00010",
            "text": "2607"
        },
]}

I am using this dependency: react-native-multiple-select

I want to add the API data to be included in the multi picker and this is my code

const [postcode, setPostcodes] = useState([]);

const responsepostal = await axios.post
            (`${urldemo}postal-codes`)
        setDataPostal(responsepostal.data.result)

This my return code for styling

Issue: the API postcode data in the multi-picker does not show. I don't want more than three postcode data in the multi-picker

<MultiSelect
  style={GlobalSS.picker}
  selectedValue={postcode}
  onValueChange={(itemValue, itemIndex) => setPostcodes(itemValue)}
  // items={postcode}
  selectedItems={postcode}
  // onSelectedItemsChange={postcode}

  selectText="Select Postcode"
  searchInputPlaceholderText="Search Post Code"
  altFontFamily="ProximaNova-Light"
  tagRemoveIconColor="#CCC"
  tagBorderColor="#CCC"
  tagTextColor="#CCC"
  selectedItemTextColor="#CCC"
  selectedItemIconColor="#CCC"
  itemTextColor="#000"
  displayKey="name"
  searchInputStyle={{ color: "#CCC" }}
  submitButtonColor="#CCC"
  submitButtonText="Submit"
>
  {/* <Picker.Item color='grey'
        label=
        "Select Postcode"
        // {postcode} 
        value=
        ""
    // {postcode} 
    /> */}

  {datapostal.map((item) => (
    <Picker.Item label={item.text} value={item.id} />
  ))}
</MultiSelect>;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

use items props

<MultiSelect
  style={GlobalSS.picker}
  selectedValue={postcode}
  items={postcode}
  onValueChange={(itemValue, itemIndex) => setPostcodes(itemValue)}
  // items={postcode}
  selectedItems={postcode}
  // onSelectedItemsChange={postcode}

  selectText="Select Postcode"
  searchInputPlaceholderText="Search Post Code"
  altFontFamily="ProximaNova-Light"
  tagRemoveIconColor="#CCC"
  tagBorderColor="#CCC"
  tagTextColor="#CCC"
  selectedItemTextColor="#CCC"
  selectedItemIconColor="#CCC"
  itemTextColor="#000"
  displayKey="name"
  searchInputStyle={{ color: "#CCC" }}
  submitButtonColor="#CCC"
  submitButtonText="Submit"
/>
  
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!