【发布时间】:2018-08-30 07:01:41
【问题描述】:
你好,我是 React Native 的新手。我需要一个解决方案,我在 flatlist 中有 radioform。所以会有与平面列表行渲染相同数量的radioform。我想为反应原生 onpress 功能设置状态。因为我能够获得 radioform state 的值,但我想获得 index wise 。那么如何为 Radioform 明智地设置 State 索引。这是我在平面列表中的 Radioform 代码。
<RadioForm
animation={true}
buttonColor={"#C2E3A9"}
index={index}
formHorizontal={true}
labelHorizontal={true}
buttonStyle={{ marginRight: 20 }}
radioStyle={{ paddingRight: 20 }}
// labelHorizontal={false}
style={styles.radiostyle}
radio_props={radio_props}
initial={this.state.typeofattendance[1]}
isSelected = {true}
**onPress={value => {this.setState({ typeofattendance: value});
}**
}
ItemSeparatorComponent={this.renderSeparator}
/>
【问题讨论】:
标签: android react-native radio-button react-native-flatlist