Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 为UI kitten Select设置唯一的选择_Reactjs_React Native_React Native Ui Kitten - Fatal编程技术网

Reactjs 为UI kitten Select设置唯一的选择

Reactjs 为UI kitten Select设置唯一的选择,reactjs,react-native,react-native-ui-kitten,Reactjs,React Native,React Native Ui Kitten,我有一个列表,我在React native UI Kitten中循环生成一个选择元素列表。在该循环中,我为每个选择项都有一个循环,选择一个激活其他项如何使选择对每个选择元素唯一 这是我的密码 export default function SelectSubjects() { const [selectedIndex, setSelectedIndex] = React.useState(new IndexPath(0)); return ( {

我有一个列表,我在React native UI Kitten中循环生成一个选择元素列表。在该循环中,我为每个选择项都有一个循环,选择一个激活其他项如何使选择对每个选择元素唯一

这是我的密码

export default function SelectSubjects() {
const [selectedIndex, setSelectedIndex] = React.useState(new IndexPath(0));
return (
        {        
       
        getSchoolsubjects().map((subject, key)=>(

         <Card style={{height:wp('15%'),marginTop:20}}  key={key} >  

            <View >
              <CheckBox style={{alignSelf:'flex-start'}} checked={checkSubjects(testSubjects,subject)} 
              onChange={()=>setSubjects(subject)} >
                     {subject}         
              </CheckBox> 
            </View>  

            <View>
             <Select style={{alignSelf:'flex-end',marginTop:-wp('8%')}}
                selectedIndex={selectedIndex}
                onSelect={index => setSelectedIndex(index)}
                placeholder='Select year'
                
                >

                {getSchoolSchoolYears(subject).map((year:number, index:number)=>(
                    <SelectItem    key={index} title={year}/>
                )) }   
                
              </Select>
            </View>               
                

                      
         </Card>

          ))}

)

<View>

</View>

}
导出默认函数SelectSubjects(){
const[selectedIndex,setSelectedIndex]=React.useState(新索引XPath(0));
返回(
{        
getSchoolsubjects().map((主题,键)=>(
设置主题(主题)}>
{主题}
setSelectedIndex(索引)}
占位符=“选择年份”
>
{GetSchoolYears(主题).map((年份:编号,索引:编号)=>(
)) }   
))}
)
}