react-native-catch-first-time

Reject promise when your app is running for the first time

Usage no npm install needed!

<script type="module">
  import reactNativeCatchFirstTime from 'https://cdn.skypack.dev/react-native-catch-first-time';
</script>

README

react-native-catch-first-time

Rejects promise when your app is running for the first time.

Useful when providing a first-login experience.

Usage

var firstTime = require('react-native-catch-first-time');
var DeviceInfo = require('react-native-device-info');

firstTime(DeviceInfo.getUniqueID())
  .catch(function () {
    navigator.push({
      component: AppIntro
    })
  });

Why not resolving into .then branch?

Putting your code into a .catch clause allows you not specifying the .then handler, which wouldn't be true in the opposite case.

Choosing on UID

The recommended way is to use device's UUID. You can obtain one using react-native-device-info or react-native-device-uuid libraries.

If you prefer not to catch on the first time after reinstalling the app, put a random string into your config and never change it.

License

MIT

2016