Skip to content

Instantly share code, notes, and snippets.

@BrooklinJazz
Last active February 24, 2020 03:38
Show Gist options
  • Select an option

  • Save BrooklinJazz/b2dc464f9c47e402f857fbc26c63bdc4 to your computer and use it in GitHub Desktop.

Select an option

Save BrooklinJazz/b2dc464f9c47e402f857fbc26c63bdc4 to your computer and use it in GitHub Desktop.
App with Start Button
import React from 'react';
import {Text} from "react-native";
import styled from "styled-components/native";
const Container = styled.View`
flex: 1;
justify-content: center;
align-items: center;
`
const BaseText = styled.Text`
color: ${props => props.color};
`
const BaseButton = styled.TouchableOpacity`
justify-content: center;
align-items: center;
padding: 5px;
height: 40px;
min-width: 100px;
`;
const Button = ({children, color, ...props}) => (
<BaseButton {...props}>
<BaseText color={color} >{children}</BaseText>
</BaseButton>
);
const success = "#43a047";
const SuccessButton = styled(Button).attrs(props => ({
color: "white",
}))`
background-color: ${success};
`;
export default function App() {
return (
<Container>
<SuccessButton>Start</SuccessButton>
</Container>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment