aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShravya Ramesh <shravs1208@gmail.com>2021-05-19 16:42:45 -0700
committerShravya Ramesh <shravs1208@gmail.com>2021-05-20 17:54:35 -0700
commit408c1c4046d1945ea4d2e857796841368ab1b8e8 (patch)
treeb290c0f4ecb860f7a9a3d464ae789e2c1235ddc6 /src
parent8ad9571539f1cf8b468dc830fb3643f567ba11e5 (diff)
Add new radio button
Diffstat (limited to 'src')
-rw-r--r--src/components/common/TaggRadioButton.tsx51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/components/common/TaggRadioButton.tsx b/src/components/common/TaggRadioButton.tsx
new file mode 100644
index 00000000..bd48bd5c
--- /dev/null
+++ b/src/components/common/TaggRadioButton.tsx
@@ -0,0 +1,51 @@
+import React from 'react';
+import {StyleSheet, TouchableOpacity, View} from 'react-native';
+
+interface TaggRadioButtonProps {
+ pressed: boolean;
+ setPressed: Function;
+ onPress: Function;
+}
+const TaggRadioButton: React.FC<TaggRadioButtonProps> = ({
+ pressed,
+ setPressed,
+ onPress,
+}) => {
+ const activeOuterStyle = {
+ borderColor: pressed ? '#6EE7E7' : '#BEBEBE',
+ };
+
+ const activeInnerStyle = {
+ backgroundColor: pressed ? '#6EE7E7' : 'white',
+ };
+ return (
+ <TouchableOpacity
+ style={[styles.outer, activeOuterStyle]}
+ onPress={() => {
+ setPressed(!pressed);
+ onPress();
+ }}>
+ {pressed && <View style={[styles.inner, activeInnerStyle]} />}
+ </TouchableOpacity>
+ );
+};
+
+export default TaggRadioButton;
+const styles = StyleSheet.create({
+ outer: {
+ width: 20,
+ height: 20,
+ borderWidth: 1.5,
+ borderRadius: 20,
+
+ backgroundColor: 'white',
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
+ inner: {
+ width: 14,
+ height: 14,
+ borderRadius: 8,
+ },
+});