Skip to content

Instantly share code, notes, and snippets.

@eikonomega
Last active May 22, 2020 22:13
Show Gist options
  • Save eikonomega/3c06485f0500b0d09e9a4553e0fb3f7f to your computer and use it in GitHub Desktop.
Save eikonomega/3c06485f0500b0d09e9a4553e0fb3f7f to your computer and use it in GitHub Desktop.
Simple Typescript React-Native Component
// ... Imports and CSS Definitions as Before
type Button100x30Props = {
text: string | number;
disabled?: boolean;
onPress?: () => void;
containerStyle?: ViewStyle;
};
/**
* A simple, stylized, 100x30 button that you
* can be disabled and further styled.
*/
export default function Button100x30({
text,
onPress = () => null,
containerStyle = {},
disabled = false
}: Button100x30Props) {
return (
<TouchableOpacity
style={[styles.button, containerStyle]}
onPress={onPress}
disabled={disabled}
>
<Text style={styles.text}>{text}</Text>
</TouchableOpacity>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment