【发布时间】:2021-05-28 19:45:21
【问题描述】:
我正在尝试使用 View 和 Radio Group 创建一个自定义按钮,但无法在另一个上重叠。 基本上我要创造这样的东西:
我确实检查了反应论文,但仍然没有运气。
import * as React from 'react';
import { View } from 'react-native';
import { RadioButton, Text } from 'react-native-paper';
const MyComponent = () => {
const [value, setValue] = React.useState('first');
return (
<RadioButton.Group onValueChange={newValue => setValue(newValue)} value={value}>
<View>
<Text>First</Text>
<RadioButton value="first" />
</View>
<View>
<Text>Second</Text>
<RadioButton value="second" />
</View>
</RadioButton.Group>
);
};
export default MyComponent;
我正在尝试使用此代码。
有人可以帮我解决这个问题吗?
【问题讨论】:
-
您能否添加您当前的代码,以便我们可以看到您到目前为止所做的工作。
-
展示你的作品:-)。如果您自己先尝试一下,您更有可能获得帮助。然后,如果您遇到麻烦,请发布您遇到困难的代码并提出具体问题。祝你好运。
-
问题已编辑
-
@Pooja 你想像上图那样设置按钮的样式吗?
-
是的,我已经在网站上做过这些类型的工作,但我是 React Native 的新手
标签: react-native radio-button radio-group