Skip to content

Instantly share code, notes, and snippets.

@m4har
Last active May 15, 2019 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4har/e03703d35916a2052abb17d548d101c7 to your computer and use it in GitHub Desktop.
Save m4har/e03703d35916a2052abb17d548d101c7 to your computer and use it in GitHub Desktop.
component button
// src/components/Button/index.js
import React from "react";
import { TouchableOpacity, Text } from "react-native";
const Button = ({ onPress, style, title, ...props }) => (
<TouchableOpacity
{...props}
onPress={onPress}
style={[styles.container, style]}
>
<Text style={styles.textTitle}>{title}</Text>
</TouchableOpacity>
);
export default Button;
const styles = {
container: {
flex: 1,
backgroundColor: "rgba(0,0,0,0.3)",
height: 50,
justifyContent: "center",
alignItems: "center",
borderRadius: 5,
borderWidth: 1
},
textTitle: {
color: "#fff"
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment