如何在 React Native Firebase 中存储单选按钮值?

问题描述

反应原生单选按钮的代码
在这里输入代码 我创建了一个单选按钮,但无法理解如何更新 firebase 中的状态

 import * as React from 'react';
 import { View,Text } from 'react-native';
 import { RadioButton } from 'react-native-paper';


 const MyComponent = () => {
 const [checked,setChecked] = React.useState(null);

 return (
<View style={{flexDirection:"row"}}>
    <View style={{flexDirection:"row",marginLeft:5}}>
    <Text style={{color:"rgba(31,133,255,1)",fontWeight:"500",fontFamily:"Roboto",marginTop:6}}>Present</Text>
  <RadioButton
    color="rgba(31,1)"
    value="first"
    status={ checked === 'first' ? 'checked' : 'unchecked' }
    onPress={() => setChecked('first')}
  />
  </View>
  <View style={{flexDirection:"row",marginLeft:55}}>
  <Text style={{color:"red",marginTop:6}}>Absent</Text>
  <RadioButton
    value="second"
    color="red"
    status={ checked === 'second' ? 'checked' : 'unchecked' }
    onPress={() => setChecked('second')}
  />
  </View>
</View>
);
};

export default MyComponent

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)