@react-native-pure/tag-selector
v1.0.0
Published
React Native tag-selector
Downloads
9
Readme
tag-selector
tag选择器
Install
$ npm i --save @react-native-pure/tag-selector
TagSelector
Tag选择器
props
value?
ArrayonChange?
signaturestyle?
anyrenderTag
signaturedataSource
ArraykeyExtractor
signature
Examples
class Test extends React.Component{
state={
value:[],
dataSource:[1,2,3]
};
render(){
return (
<TagSelector value={this.state.value}
renderTag={(value,index,selected)=>{
return <Text key={index} style={{color:selected?"red":"blue"}}>{value}</Text>
}}
onChange={(type,value)=>{
if(type==="select"){
this.setState({
value:[...this.state.value,value]
})
}
if(type==="unselect"){
this.setState({
value:this.state.value.filter(f=>f!==value)
});
}
}}
dataSource={this.state.dataSource}
keyExtractor={(value)=>value}/>
);
}
}