0.1.2 • Published 3 years ago

react-native-simple-view v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-simple-view

react-native-simple-view

Installation

npm install react-native-simple-view

Usage

import { View, Text } from 'react-native-simple-view';

// ...
<View
  onPress={() => console.warn('press')}
  radius-50
  bg-pink
  padding-10
  center
  margin-10
>
  <Text size-50 color-blue bold>
    test
  </Text>
</View>;

Available View Props

namedefaultdescription
rowfalserow flex direction
wrapfalsewrap content
centerfalsecenter content vertically and horizontally
spreadfalsespread content across main axis
rightfalsealign content to the right
leftfalsealign content to the left
topfalsealign content to the top
bottomfalsealign content to the bottom
safefalsethe view is wrapped with SafeAreaView
onPressnullon press event
padding-{number}0view padding
margin-{number}0view margin
radius-{number}0view radius

Available Text Props

namedefaultdescription
boldfalsetext boldness
size-{number}nullfont size
color-{color}nulltext color

Theme Provider

to setup default props for your View Wrap your root component in the

import { ThemeProvider, themes } from 'react-native-simple-view';

const mytheme = {
    ...themes.light,
    colors: {
      ...themes.light.colors,
      primary: 'white',
      secondary: 'black',
      text: 'white',
      bg: 'black',
    },
    layout: {
        padding: 5,
        radius: 15,
    },
}

<ThemeProvider theme={mytheme}>
    <App/>
</ThemeProvider>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT