here is my code
importReact,{Fragment,useState,useEffect,useReducer}from'react';import{SafeAreaView,ScrollView,View,Text,TouchableHighlight,FlatList}from'react-native';constHomePage=(props)=>{const[selectedName,setselectedName]=useState('');const[nameList,setNameList]=useState([{'name':'abcd'},{'name':'abcd'},{'name':'abcd'},{'name':'abcd'}]);functionhandleSelectName(value){setselectedName(value);}return(<Fragment><SafeAreaView><ScrollViewcontentInsetAdjustmentBehavior="automatic"><View>{nameList.length>0&&CustomCount(nameList,selectedName,handleSelectName)}</View></ScrollView></SafeAreaView></Fragment>);};functionCustomCount(data,count,handle){constcounterStyle={fontSize: 30,color: 'red',};return(<FlatListdata={data}renderItem={({ item, index })=>(<Viewkey={item}><TouchableHighlightonPress={()=>handle(index)}><Textstyle={index===count ? counterStyle : {color: 'green'}}>{item.name}</Text></TouchableHighlight></View>)}numColumns={3}/>)}exportdefaultHomePage;What I expected
when i clicked the name, which name's style changes
What actually did
nothing happened
env
"react": "16.8.6",
"react-native": "0.60.4",
here is my code
What I expected
when i clicked the name, which name's style changes
What actually did
nothing happened
env
"react": "16.8.6",
"react-native": "0.60.4",