@viktorvojtek/react-native-simple-components
v1.0.32
Published
Collection of essential UI components based on react-native components
Downloads
180
Maintainers
Readme
@viktorvojtek/react-native-simple-components
This package contains a collection of a few essential, customizable and reusable UI components built with React on top of React Native components. These components are designed to be easy to use, highly flexible and allowing you to quickly and easily build beautiful user interfaces for your projects.
This package inherits react native components such as buttons, spinner, text, scrollview, and more. Each component is just a react native component with enhanced list of style props, to directly style a component via props.
This approach leads to increased development speed when building UI without compromising app performance at all. That being said we are building pure React Native components (best for performance), that can be styled as quickest as possible via props only.
As mentioned above, this package is really simple and easy to use. It's a great choice for beginners and experienced developers alike, when you need to build a UI quickly and easily, right out of the box. There is no configuration to be set up, no boilerplate code to write. And it comes with TypeScript support out of the box with all the types and beauty of intellisense.
I hope you find this components package useful in your projects. If you have any questions or feedback, please don't hesitate to reach out to me. Thank you for using this package!
Installation
Make sure you have installed React Native of version 0.60 or higher.
NPM:
$ npm -i @viktorvojtek/react-native-simple-components
Yarn:
$ yarn add @viktorvojtek/react-native-simple-components
Documentation
Usage Example
import { Button, Stack, Text } from '@viktorvojtek/react-native-simple-components';
const App = () => {
return (
<Stack
flexDirection="column"
backgroundColor="red"
borderWidth={1}
borderColor="blue"
>
<Button
onPress={() => console.log('Button pressed')}
backgroundColor="green"
borderRadius={10}
padding={10}
>
<Text color="white">Button</Text>
</Button>
</Stack>
);
};
Components
| Component | Props | Description | Defaults | | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------- | | Button | Pressable props , View Style props | A basic button component | | | Center | View Style props | A component that centers it's children components both horizontally and vertically | | | Circle | size: Number | undefined, View Style props | A component that renders a circle | size: 40bgColor: '#d3d3d3' | | Checkbox | children: ReactNode | undefined, isChecked: boolean | undefined, onChange: (isChecked: boolean) => void | undefined, View Style props | A checkbox component | | | Divider | color: Color | String, isVertical: boolean | undefined, View Style props | A component that renders a divider line | color: '#d3d3d3'isVertical: false | | Image | Image props , View Style props | Replacement for Image component | | | Pressable | Pressable props , View Style props | Replacement for Pressable component | | | Spinner | ActivityIndicator props , View Style props | Displays a circular loading indicator | | | Stack | View Style props | Replacement for View component | | | StackX | View Style props | A Stack component rendering it's children components horizontally by default | | | StackY | View Style props | A Stack component rendering it's children components vertically by default | | | Text | Text props , Text Style props | Replacement for Text component | | | TextInput | TextInput props , TextInput Style props | Replacement for TextInput component | |
Shorthand Props
| Prop Name | Description | Type | Default | | --------- | ------------------ | ------------------------------------- | --------- | | bgColor | Background color | Color | String | undefined | '#d3d3d3' | | m | Margin | Number | String | undefined | 0 | | mt | Margin top | Number | String | undefined | 0 | | mr | Margin right | Number | String | undefined | 0 | | mb | Margin bottom | Number | String | undefined | 0 | | ml | Margin left | Number | String | undefined | 0 | | mx | Margin horizontal | Number | String | undefined | 0 | | my | Margin vertical | Number | String | undefined | 0 | | | | | | | p | Padding | Number | String | undefined | 0 | | pt | Padding top | Number | String | undefined | 0 | | pr | Padding right | Number | String | undefined | 0 | | pb | Padding bottom | Number | String | undefined | 0 | | pl | Padding left | Number | String | undefined | 0 | | px | Padding horizontal | Number | String | undefined | 0 | | py | Padding vertical | Number | String | undefined | 0 |
Note: All shorthand props can be used with all components such as: Button, Center, Circle, Divider, Image, Pressable, Spinner, Stack, StackX, StackY, Text, TextInput
Note: style prop still works as all othern React Native props and APIS for related components