https://github.com/thegamenicorus/react-native-flexi-radio-button )但是我想使用json值循环单选按钮,但它不起作用。请看下面的代码。提前谢谢
这很管用
<RadioGroup onSelect={(index, value) => this.onSelect(index, value)}> <RadioButton value={"item1"}> <Text>This is item #1</Text> </RadioButton> </RadioGroup>
但是下面的give无法读取null的属性'props'
<RadioGroup onSelect={(index, value) => this.onSelect(index, value)} > {this.state.cuisinesByFoodList.map(item1 => { console.log("result", item1); <RadioButton value={"abc"}> <Text>{"abc"}</Text> </RadioButton>; })} </RadioGroup> P.S there's value in item1 in the console when debugged.
你忘了 return
return
<RadioGroup onSelect={(index, value) => this.onSelect(index, value)} > {this.state.cuisinesByFoodList.map(item1 => { console.log("result", item1); return(<RadioButton value={"abc"}> <Text>{"abc"}</Text> </RadioButton>); })} </RadioGroup>