1.0.2 • Published 4 years ago

react-native-onupdate v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Get migration like logic for your released App

Keep track of which functions have been called when releasing a new update!

Installation

yarn add react-native-onupdate @react-native-async-storage/async-storage && npx pod-install

or

npm i react-native-onupdate @react-native-async-storage/async-storage && npx pod-install

Usage

import OnUpdate from 'react-native-onupdate';

const migrationFunctions = [
    () => { console.log('migration 1') },
    () => { console.log('migration 2') },
    () => { console.log('migration 3') }
];

OnUpdate.migrations = migrationFunctions;

const App = () => {
    OnUpdate.migrate();

    return (
        <View>
            <Text>TEST</Text>
        </View>
    );
}

API

Property | MethodDEFINITIONTYPE
migrationsMigration functions to runFunction[]
migrate()Runs the migrations which have been never calledfunction()
DEBUG(true\|false)Enables loggingfunction(debug:boolean):void
versionLast runned migration functions index. It persists in AsyncStorage.number
AsyncStorageKeyThe key used for AsyncStoragestring