Skip to content

Instantly share code, notes, and snippets.

@Billmike
Created November 7, 2019 14:36
Show Gist options
  • Save Billmike/cb54ca5f8966ac599121b45cf97696e2 to your computer and use it in GitHub Desktop.
Save Billmike/cb54ca5f8966ac599121b45cf97696e2 to your computer and use it in GitHub Desktop.
import * as React from "react";
import { View, SafeAreaView, StyleSheet, Text } from "react-native";
import { RectButton } from "react-native-gesture-handler";
import StyleGuide from "./StyleGuide";
import CheckIcon, { CHECK_ICON_SIZE } from "./CheckIcon";
const styles = StyleSheet.create({
buttonContainer: {
borderBottomWidth: 1,
borderColor: "#f4f6f3"
},
button: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
height: StyleGuide.spacing * 2 + CHECK_ICON_SIZE,
padding: StyleGuide.spacing
}
});
interface SelectionProps {
name: string;
onPress: () => void;
isSelected: boolean;
}
export default ({ name, onPress, isSelected }: SelectionProps) => {
return (
<SafeAreaView style={styles.buttonContainer}>
<RectButton {...{ onPress }}>
<View style={styles.button} accessible>
<Text>{name}</Text>
{isSelected && <CheckIcon />}
</View>
</RectButton>
</SafeAreaView>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment