1.1.0 • Published 6 years ago
react-native-version-upgrade-check v1.1.0
react-native-version-upgrade-check
Getting started
$ npm install react-native-version-upgrade-check --save
Mostly automatic installation
$ react-native link react-native-version-upgrade-check
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-version-upgrade-checkand addRNVersionUpgradeCheck.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNVersionUpgradeCheck.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNVersionUpgradeCheckPackage;to the imports at the top of the file - Add
new RNVersionUpgradeCheckPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-version-upgrade-check' project(':react-native-version-upgrade-check').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-upgrade-check/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-version-upgrade-check')
Usage
import RNVersionUpgradeCheck from 'react-native-version-upgrade-check';
RNVersionUpgradeCheck.getVersionData(versionData => {
if(versionData["isStoreVersion"]) {
// the version is from appstore or play store
}
if(versionData["isFirstLaunch"]) {
// this is the first launch of your app
}
else if (versionData["isUpdated"]){
// version was updated
}
else if (versionData["isSameVersion"]){
// same version as before
}
})