react-native-android-version

Apply styles to specific android version

Usage no npm install needed!

<script type="module">
  import reactNativeAndroidVersion from 'https://cdn.skypack.dev/react-native-android-version';
</script>

README

React Native Android Styles

This package allow to apply styles to specific android version.

Installation

npm i --save react-native-android-version

or

yarn add react-native-android-version

Example Usage


import AndroidVersion from "react-native-android-version";
import {StyleSheet} from "react-native";


const styles = StyleSheet.create({
    image: {
        ...AndroidVersion.select({
        
        //Apply styles to android api 28 and hight
        
            '>=26': {
                width: 'auto',
                height: 'auto',
            },
            
        //Apply styles to android api 28
            
            
            '28': {
                width: 'auto',
                height: 'auto',
            },
            
        //Apply styles to android api 25
        
            25: {
                width: 'auto',
                height: 'auto',
            },
            
        //Styles for other android api levels
        
            default: {
                width: '100%',
                height: '100%',
            }
        })
    }
});

Contribute

Of course, contributions welcomed! 🙌

License

MIT.