export class Register extends Component {
render() {
const [selectedGoal, setSelectedGoal] = React.useState(1);
return (
<RadioButtonRN
boxStyle={{
height: hp("6%"),
width: wp("80%"),
}}
activeColor="white"
boxActiveBgColor="red"
textColor="black"
textStyle={{ fontWeight: "bold" }}
data={goal}
initial={selectedGoal}
selectedBtn={(e) => setSelectedGoal(e.id)}
/>
{selectedGoal == 1 ? (
<View style={{ alignItems: "center" }}>
<Text style={{ color: "red", fontSize: 15, top: hp("5%") }}>
How much would you like to gain per week?
</Text>
<RadioButtonRN
style={{ top: hp("10%") }}
boxStyle={{
height: hp("6%"),
width: wp("80%"),
}}
activeColor="white"
boxActiveBgColor="red"
textColor="black"
textStyle={{ fontWeight: "bold" }}
data={details}
selectedBtn={(e) => console.log(e)}
/>
</View>
) : selectedGoal == 2 ? (
<View>
<Text>Ciao</Text>
</View>
) : (
<View>
<Text> you made it</Text>
</View>
)})}
大家好,我是编程新手,我尝试在 render() 下使用 const,然后在 RadioButtonRN 中使用它,但当然,它给了我一个无效的挂钩调用,我怎样才能将它转换为在我的类中工作?