Skip to content

React Plugin for the Facebook library that analyzes an Android device's specifications and calculates which year the device would be considered "high end”.

License

Notifications You must be signed in to change notification settings

Upinion/react-native-device-year-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-device-year-class

React Native DeviceYearClass allows you to estimate the performance of an Android device.

Installation

1) Add repository to package.json
"react-native-device-year-class": "git+ssh://[email protected]:Upinion/react-native-device-year-class.git"

2) Run
npm install

or manually:
git clone the directory to [node_modules/react-native-device-year-class]

Add it to your android project

  • In android/setting.gradle
...
include ':DeviceYearClass', ':app'
project(':DeviceYearClass').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-year-class')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':DeviceYearClass')
}
  • register module (in MainActivity.java)
import com.upinion.DeviceYearClass.DeviceYearClassPackage;  // <--- import

...

protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new DeviceYearClassPackage() // <-- Add this line with your package name.
    ); 
}

Example

DeviceYearClass.getYearClass() returns a promise!

Example:

const DeviceYearClass = require('react-native-device-year-class');

let animations = false;

DeviceYearClass.getYearClass()
    .then((yearClass) => {
        if (yearClass > 2011) {
            animations = true;
        }
    });

Java dependency

https://github.com/facebook/device-year-class

About

React Plugin for the Facebook library that analyzes an Android device's specifications and calculates which year the device would be considered "high end”.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published