Created
November 7, 2019 14:36
-
-
Save Billmike/cb54ca5f8966ac599121b45cf97696e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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