Skip to content

knowbody/react-native-platform-stylesheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Platform Stylesheet

Seperated out the F8StyleSheet to a module.

Get started

  1. npm install react-native-platform-stylesheet

  2. Use it in your project:

import { create } from 'react-native-platform-stylesheet';


const Profile = () => (
  <View style={styles.container}>
    {/* ... */}
  </View>
);

const styles = create({
  container: {
    flex: 1,
    ios: {
      backgroundColor: 'salmon'
    },
    android: {
      backgroundColor: 'tomato'
    }
  }
});

or

import { create } from 'react-native-platform-stylesheet';


const Profile = () => (
  <View style={styles.container}>
    {/* ... */}
  </View>
);

const styles = create({
  container: {
    flex: 1
  },
  ios: {
    container: {
      backgroundColor: 'salmon'
    }
  },
  android: {
    container: {
      backgroundColor: 'tomato'
    }
  }
});

Note: in the second example, make sure that ios and android styles are defined in the end of the object.

About

React Native Platform Specific Stylesheet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published