pankod / react-native-picker-modal-view

An unified React Native Picker Modal component for iOS and Android.
204 stars 56 forks source link

l.Name.toLocaleLowerCase #50

Open ChinmayDeyUI opened 4 years ago

ChinmayDeyUI commented 4 years ago

After I added your package in my project I got below error. TypeError: undefined is not an object (evaluating 'l.Name.toLocaleLowerCase')

When I used your top20.json it works, but if I used my own json I got above error. Your json is like [{"Name": "Åland Islands","Value": "Åland Islands","Code": "AX","Id": 1 }] and my json is like [{"id":1,"city":"Kolkata","type":"Metro","city_class":"A","state":"West Bengal","state_id":2,"type_id":"M"}]

Twelvefat commented 4 years ago

you must include Name key to your Json. sorry for my bad english

it look like : [{"Id":1,"Name":"Whatever"}]

nericode commented 3 years ago

@ChinmayDeyUI You json is incorrect please use map function to convert json:

 var data = json.map((item) => {
    // item values can change, but no Id, Name, Value
     return {
        Id: item.Id,
        Name: item.city,
        Value: item.type,
     };
});