akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.34k stars 956 forks source link

The Select element does not select items from the list #1566

Closed Latgals closed 2 years ago

Latgals commented 2 years ago

🐛 Bug Report

In the Expo application, the Select element does not select items from the list, but shows "Option 1", "Option 2", etc.

I copied the code from the UI Kitten documentation for the Select element and pasted it into my application. I just replaced the "title" value in with my own text. But the Select after selection still shows "Option 1", "Option 2", and not my items.

scr_select_bug3 scr_select_bug1 scr_select_bug2

I have reproduced the bug at Expo Snack - you can check it here.

The same thing happens with the enabled and disabled multiSelect option.

How do I fix the bug?

UI Kitten and Eva version

Package Version
@eva-design/eva 2.1.1
@ui-kitten/components 5.1.1

Environment information

"expo": "~43.0.2", "react": "17.0.1", "react-dom": "17.0.1", "react-native": "0.64.3",

Ycmelon commented 2 years ago

Having the same problem... unless we're missing something?

In the meantime, this is how I'm doing it:

const [index, setIndex] = useState();
const options = ["a", "b", "c"];
...
<Select selectedIndex={index} onSelect={setIndex} value={options[index.row]}>
  {options.map((value)=><SelectItem title={value} key={value}>)}
</Select>

Seems like value is what is displayed in the input box.

Latgals commented 2 years ago

Having the same problem... unless we're missing something?

In the meantime, this is how I'm doing it:

const [index, setIndex] = useState();
const options = ["a", "b", "c"];
...
<Select selectedIndex={index} onSelect={setIndex} value={options[index.row]}>
  {options.map((value)=><SelectItem title={value} key={value}>)}
</Select>

Seems like value is what is displayed in the input box.

Thanks to. With single select I solved the problem too. But with multiSelect not yet.

dVaytul commented 2 years ago

@Latgals

By default, Select displays a value by building strings for selected indices. For a real-word examples, a value property should be configured.

Please, take a look at the example 'Select Display Value'.