New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-pss

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-pss

Platform Specific Styles. Create simple platform specific stylesheets for React Native

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

react-native-pss

Platform Specific Styles. Create simple platform specific stylesheets for React Native.

Apply Platform specific styles to components by specifying android and ios keys in the component's style property.

Installation

#npm
npm install --save react-native-pss

#yarn
yarn add react-native-pss

The below snippet will create background color 'red' on android and 'yellow' on ios

import StyleSheet from 'react-native-pss';
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    android: {
        backgroundColor: 'red',
    },
    ios: {
        backgroundColor: 'yellow',
    },
    alignItems: 'center',
  },
});

If you want to use it alongside react-native's StyleSheet, just import it with a different name like:

import PlatformStyleSheet from 'react-native-pss';

Since it overrides React Native's default stylesheet function all other styles should work normally.

A simple implementation example:

/**
 * react-native-pss example
 * https://github.com/DaniAkash/react-native-pss
 */

import React, { Component } from 'react';
import {
  Text,
  View
} from 'react-native';
import StyleSheet from 'react-native-pss';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    android: {
        backgroundColor: 'red',
    },
    ios: {
        backgroundColor: 'yellow',
    },
    alignItems: 'center',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

License

MIT

Keywords

platform

FAQs

Package last updated on 24 Jan 2017

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