Skip to content

Instantly share code, notes, and snippets.

@vonwao
Created October 30, 2019 18:05
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 vonwao/caa7c8ec04e958966a6cb81d43c768dc to your computer and use it in GitHub Desktop.
Save vonwao/caa7c8ec04e958966a6cb81d43c768dc to your computer and use it in GitHub Desktop.
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