A blank spacer component for react native to help build components & layouts without margins
npm install react-native-blank-spacerFree your components from margins using the blank spacer!
[![Build Status][build-badge]][build]
[![Maintainability][maintainability-badge]][maintainability-url]
[![Test Coverage][coverage-badge]][coverage-url]
[![Version][version-badge]][package]
[![Downloads][downloads-badge]][npmtrends]
[![Bundlephobia][bundle-phobia-badge]][bundle-phobia]
[![Star on GitHub][github-star-badge]][github-star]
[![Watch on GitHub][github-watch-badge]][github-watch]
[![Twitter Follow][twitter-badge]][twitter]
---
- đĄ Why use blank spacer?
- đĻ Installation
- âšī¸ Usage
- đ Recipes
A good component should be usable in any layout & context. This means the component should not influence anything outside of it's own children.
Margins however break this rule by defining how much space another component should distance itself from your component. This has made many components difficult to use in certain layouts and also made maintaining the design system very difficult in the long run for my personal projects.
Max Stoiber has written a nice blog post on why we shouldn't use margins and move to spacers.
React Native Blank Spacer is component which can be used to apply blank spaces between components effectively removing the need to apply margins in general đ
``sh
#npm
npm install --save react-native-blank-spacer
#yarn
yarn add react-native-blank-spacer
`
`jsx
import BlankSpacer from "react-native-blank-spacer";
const App = () => (
);
export default App;
`
#### height?: number
Height of the blank spacer
#### width?: number
Width of the blank spacer īšŖ used to apply space when flexDirection: row
#### color?: color string
Color of the blank spacer
#### ViewProps
All the existing View props are supported as blank spacer extends the view component
- Follow the link to the snack for Simple Usage
- If you want to apply spacing based on the device screen size, you can use the blank spacer with react-native-responsive-dimensions
- If you want a blank space to avoid keyboard (i.e) a keyboard avoiding view, you can use react-native-keyboad-spacer or pair the blank spacer with keyboard height received from useKeyboard` hook of react native hooks
MIT Š [DaniAkash][twitter]
[build]: https://github.com/DaniAkash/react-native-blank-spacer/actions
[build-badge]: https://github.com/daniakash/react-native-blank-spacer/workflows/build/badge.svg
[coverage-badge]: https://api.codeclimate.com/v1/badges/9faec6134e14954b10e0/test_coverage
[coverage-url]: https://codeclimate.com/github/DaniAkash/react-native-blank-spacer/test_coverage
[maintainability-badge]: https://api.codeclimate.com/v1/badges/0cf535fb8d3da2aa4a91/maintainability
[maintainability-url]: https://codeclimate.com/github/DaniAkash/react-native-blank-spacer/maintainability
[bundle-phobia-badge]: https://badgen.net/bundlephobia/minzip/react-native-blank-spacer
[bundle-phobia]: https://bundlephobia.com/result?p=react-native-blank-spacer
[downloads-badge]: https://img.shields.io/npm/dm/react-native-blank-spacer.svg?style=flat-square
[npmtrends]: http://www.npmtrends.com/react-native-blank-spacer
[package]: https://www.npmjs.com/package/react-native-blank-spacer
[version-badge]: https://img.shields.io/npm/v/react-native-blank-spacer.svg?style=flat-square
[twitter]: https://twitter.com/dani_akash_
[twitter-badge]: https://img.shields.io/twitter/follow/dani_akash_?style=social
[github-watch-badge]: https://img.shields.io/github/watchers/DaniAkash/react-native-blank-spacer.svg?style=social
[github-watch]: https://github.com/DaniAkash/react-native-blank-spacer/watchers
[github-star-badge]: https://img.shields.io/github/stars/DaniAkash/react-native-blank-spacer.svg?style=social
[github-star]: https://github.com/DaniAkash/react-native-blank-spacer/stargazers