如何在 UI Kitten v5 select 中传递动态数组?
How to pass dynamic array in UI Kitten v5 select?
如何在select中传递动态数据?
const array=['a','b','c','d']
<Select data={array}
selectedIndex={selectedIndex}
onSelect={index => setSelectedIndex(index)}>
</Select>
每当我使用
<SelectItem title='Option 1'/>
<SelectItem title='Option 2'/>
<SelectItem title='Option 3'/>
它工作正常但是当我使用数据时它不工作
这可能有帮助
const array = ['a','b','c','d'];
export const SelectDisplayValueShowcase = () => {
const renderOption = (title) => (
<SelectItem title={title}/>
);
return (
<Layout style={styles.container} level='1'>
<Select
style={styles.select}>
{array.map(renderOption)}
</Select>
</Layout>
);
};
如何在select中传递动态数据?
const array=['a','b','c','d']
<Select data={array}
selectedIndex={selectedIndex}
onSelect={index => setSelectedIndex(index)}>
</Select>
每当我使用
<SelectItem title='Option 1'/>
<SelectItem title='Option 2'/>
<SelectItem title='Option 3'/>
它工作正常但是当我使用数据时它不工作
这可能有帮助
const array = ['a','b','c','d'];
export const SelectDisplayValueShowcase = () => {
const renderOption = (title) => (
<SelectItem title={title}/>
);
return (
<Layout style={styles.container} level='1'>
<Select
style={styles.select}>
{array.map(renderOption)}
</Select>
</Layout>
);
};