1.0.3 • Published 4 years ago

react-native-common-function1 v1.0.3

Weekly downloads
17
License
Biznovare Solutio...
Repository
-
Last release
4 years ago

react-native-common-function1

This project will check that app needs an update or not. It will do calculation based on version of App and will show a popup based on below 3 condition.

  • App needs a force update
  • App needs a update but with remind me later option
  • App is updated

Installation

$ npm install react-native-common-function1 --save

Usage

import { checkForVersion } from 'react-native-common-function1';

let options = {
    "current_version": "2",
    "release_note": "Today We have big app update, Please update app.",
    "last_force_update_version": "1",
    "release_date": "2019-12-31",
    "app_url": appUrl,
    "dateFormat":'DD-MM-YYYY',
}
checkForVersion(options);

Options

OptionsUsageRequiredDefault Values
current_versionCurrent version of AppYes-
release_noteMessage that you want to show on dialogYes-
last_force_update_versionLast force update versionYes-
release_dateLatest release date of AppYes-
app_urlPlatform specific app urlYes-
styleCustom styles for dialog and its componentsOptional-
dateFormatFormat of release date which will diaplay at topOptionalDD-MM-YYYY hh:mm:ss
update_btn_nameText for update buttonOptionalUpdate App
remindMeLater_btn_nameText for remind me later buttonOptionalRemind Me Later
closeBtnCallbackcallback function for close buttonOptional-
updateBtnCallbackcallback function for update buttonOptional-
remindMeBtnCallbackcallback function for remind me later buttonOptional-
How to redesign style ?

We can pass the styles prop to cover default style. See Example below.

import { checkForVersion } from 'react-native-app-version-force-update';

const styleobj = {
  titleText:{
    color: 'rgba(255,255,255,0.8)',
  },
  closeIcon:{
    tintColor:'white'
  }
};
let options = {
    "current_version": "2",
    "release_note": "Today We have big app update, Please update app.",
    "last_force_update_version": "1",
    "release_date": "2019-12-31",
    "app_url": Platform.OS === 'ios' ? iosUrl : androidUrl,
    "dateFormat":'DD-MM-YYYY',
    "style":styleobj,
}

checkForVersion(options);
Options for override style
StyleUsage
modalContainerMain container style
mainContainerContent of dialog style
headerContainerHeader container style
titleContainerTitle container style inside header
titleTextTitle text style
descTextDescription text style
btnContainerclose button container style
closeIconclose icon style
linkContainerbottom button container style
updateBtupdate button style
linkBtnUpdateupdate button text style
linkBtnRemindMeLaterremind me button text style

Example check version popup