如何在React Native中的下拉组件内部实现单选按钮

时间:2019-12-05 17:18:18

标签: react-native drop-down-menu radio-button

我想在react native中实现一个下拉组件,其中可以使用react native中的单选按钮组件在下拉列表中选择一项。

1 个答案:

答案 0 :(得分:0)

https://www.npmjs.com/package/react-native-simple-radio-button

mport RadioForm, {RadioButton, RadioButtonInput, RadioButtonLabel} from 'react-native-simple-radio-button';


var radio_props = [
  {label: 'param1', value: 0 },
  {label: 'param2', value: 1 }
];

<RadioForm
  radio_props={radio_props}
  initial={0}
  onPress={(value) => {this.setState({value:value})}}
/>