Last active
February 24, 2020 03:38
-
-
Save BrooklinJazz/b2dc464f9c47e402f857fbc26c63bdc4 to your computer and use it in GitHub Desktop.
App with Start Button
This file contains hidden or 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 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