I am fetching data from API for the options to display in Select component of UI Kitten
data format is like this
const data = [
{
"id": 1,
"name": "General",
},
{
"id": 2,
"name": "Other Category",
},
{
"id": 3,
"name": "Public transport",
},
{
"id": 4,
"name": "Help Support",
}
]
It is showing the data in the dropdown but after selecting it is showing option1, option 2
etc
but I want to show original data and onselect
I want to get the original id of selected option
because by default it is taking index which is starting from 0
I have used
const [selectedIndex, setSelectedIndex] = useState(new IndexPath(0));
and I'm displaying my data like this
<Select
selectedIndex={selectedIndex}
status="basic"
style={[STYLES.input]}
value={selectedIndex}
size="large"
onSelect={(index) => handleFaqCategorySelection(index)}
>
{data.map((item) => (
<SelectItem title={item.name} index={item.id} />
))}
</Select>;
any idea how to do it ? I tried document by it is not clear how to work will dynamic data
Thanks in advance