Wondering what’s next for npm?Check out our public roadmap! »

react-native-blank-spacerTypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

React Native Blank Spacer 📦↔️📦

Free your components from margins using the blank spacer!

Build Status Maintainability Test Coverage

Version Downloads Bundlephobia

Star on GitHub Watch on GitHub Twitter Follow


Compatible with Expo & React Native Web 🚀

PRs Welcome 👍✨

Why use blank spacer

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 🎉

Installation

#npm 
npm install --save react-native-blank-spacer
 
#yarn 
yarn add react-native-blank-spacer

Usage

import BlankSpacer from "react-native-blank-spacer";
 
const App = () => (
  <View>
    <Text>Hello!</Text>
    <BlankSpacer height={16} />
    <Text>Nice to Meet you!</Text>
  <View>
);
 
export default App;

Props

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

Recipes

Licenses

MIT © DaniAkash

Install

npm i react-native-blank-spacer

DownloadsWeekly Downloads

12

Version

0.0.2

License

MIT

Unpacked Size

13 kB

Total Files

11

Last publish

Collaborators

  • avatar