aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/TaggRadioButton.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-05-21 21:47:43 -0400
committerGitHub <noreply@github.com>2021-05-21 21:47:43 -0400
commit5afdf9208fd3d7498a2595797e6c9fb5f567fc61 (patch)
treeb76d16e06c0fb5f89a3da9ffa44eddec71f9d52c /src/components/common/TaggRadioButton.tsx
parent83802c3a18b1a1406cb4f1336b91e477161e7340 (diff)
parentdcbe315638f6c5edc98415d6cec2a016bfc601bf (diff)
Merge pull request #436 from shravyaramesh/tma853-tag-selection-screen
[TMA-853] Tag selection screen
Diffstat (limited to 'src/components/common/TaggRadioButton.tsx')
-rw-r--r--src/components/common/TaggRadioButton.tsx53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/components/common/TaggRadioButton.tsx b/src/components/common/TaggRadioButton.tsx
new file mode 100644
index 00000000..3cc2780c
--- /dev/null
+++ b/src/components/common/TaggRadioButton.tsx
@@ -0,0 +1,53 @@
+import React from 'react';
+import {
+ GestureResponderEvent,
+ StyleSheet,
+ TouchableOpacity,
+ View,
+} from 'react-native';
+import {RADIO_BUTTON_GREY, TAGG_LIGHT_BLUE_2} from '../../constants/constants';
+
+interface TaggRadioButtonProps {
+ pressed: boolean;
+ onPress: (event: GestureResponderEvent) => void;
+}
+const TaggRadioButton: React.FC<TaggRadioButtonProps> = ({
+ pressed,
+ onPress,
+}) => {
+ const activeOuterStyle = {
+ borderColor: pressed ? TAGG_LIGHT_BLUE_2 : RADIO_BUTTON_GREY,
+ };
+
+ const activeInnerStyle = {
+ backgroundColor: pressed ? TAGG_LIGHT_BLUE_2 : 'white',
+ };
+ return (
+ <TouchableOpacity
+ style={[styles.outer, activeOuterStyle]}
+ onPress={onPress}>
+ {pressed && <View style={[styles.inner, activeInnerStyle]} />}
+ </TouchableOpacity>
+ );
+};
+
+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,
+ },
+});
+
+export default TaggRadioButton;