🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-native-style-names

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-style-names

A very simple JavaScript utility for conditionally joining React-native styles.

0.0.11
latest
Source
npm
Version published
Weekly downloads
5
-61.54%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-style-names

NPM

Say goodbye to if and else for styles on your react-native App, react-native-style-names is a very simple JavaScript utility for conditionally joining react-native styles

1. Installation

npm install --save react-native-style-names

2. Usage
import {StyleSheet} from 'react-native';
import stylenames from 'react-native-style-names';

stylenames(
  styles.container,
  styles.background
) // => [styles.container, styles.background]

stylenames({ [styles.container]: true }) // => [styles.container]

stylenames({ [styles.container]: false }) // => []

stylenames({
  [styles.container]: true,
  [styles.background]: true
}) // => [styles.container, styles.background]

stylenames({
  [styles.container]: false,
  [styles.background]: true
}) // => [styles.background]

const widthAnimation = new Animated.value(10);
stylenames(styles.container, {
  height: widthAnimation
}); // => [styles.container, {height: widthAnimation}];

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  background: {
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

License

MIT. Copyright (c) 2017 Diego Oliveira.

Keywords

react-native-style-names

FAQs

Package last updated on 29 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts