Created
October 30, 2019 18:05
-
-
Save vonwao/caa7c8ec04e958966a6cb81d43c768dc to your computer and use it in GitHub Desktop.
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 * as N from 'react-native'; | |
import styled from 'styled-components'; | |
import { | |
compose, | |
space, | |
color, | |
layout, | |
typography, | |
flexbox, | |
border, | |
background, | |
position, | |
grid, | |
shadow, | |
buttonStyle, | |
colorStyle, | |
textStyle | |
} from 'styled-system' | |
const themed = key => props => props.theme[key] | |
// const types = variant | |
const View = styled(N.View)( | |
compose( | |
space, | |
color, | |
layout, | |
typography, | |
flexbox, | |
border, | |
background, | |
position, | |
grid, | |
shadow, | |
buttonStyle, | |
colorStyle, | |
textStyle, | |
themed('SSN') | |
) | |
) | |
const Text = props => <View as={N.Text} {...props} /> | |
const Image = props => <View as={N.Image} {...props} /> | |
const TextInput = props => <View as={N.TextInput} {...props} /> | |
const ScrollView = props => <View as={N.ScrollView} {...props} /> | |
const Picker = props => <View as={N.Picker} {...props} /> | |
const Slider = props => <View as={N.Slider} {...props} /> | |
const Switch = props => <View as={N.Switch} {...props} /> | |
const FlatList = props => <View as={N.FlatList} {...props} /> | |
const SectionList = props => <View as={N.SectionList} {...props} /> | |
const ActivityIndicator = props => <View as={N.ActivityIndicator} {...props} /> | |
const Alert = props => <View as={N.Alert} {...props} /> | |
const Modal = props => <View as={N.Modal} {...props} /> | |
const StatusBar = props => <View as={N.StatusBar} {...props} /> | |
const Button = ({ children, color, fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, textAlign, fontStyle, ...props }) => ( | |
<View as={N.TouchableOpacity} {...props}> | |
<View as={N.Text} color={color} fontFamily={fontFamily} fontSize={fontSize} fontWeight={fontWeight} lineHeight={lineHeight} letterSpacing={letterSpacing} textAlign={textAlign} fontStyle={fontStyle} >{children}</View> | |
</View> | |
) | |
export { | |
View, Text, Image, TextInput, ScrollView, Picker, Slider, Switch, FlatList, SectionList, ActivityIndicator, Alert, Modal, StatusBar, Button | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment