Register a callback to react to a potential changes to the active entitlements for the user, whenever such state is fetched from the Nami service. This occurs during the course of the application lifecycle as well as when refresh is called.

NamiEntitlementManager.registerActiveEntitlementsHandler { (activeEntitlements: [NamiEntitlement]) in
  // respond to the current active entitlements for the user
}
NamiEntitlementManager.registerActiveEntitlementsHandler { activeEntitlements ->
  // respond to the current active entitlements for the user
}
NamiEntitlementManager.registerActiveEntitlementsHandler()
    .listen((activeEntitlementHandlerData) {
});
import {NamiEntitlementManager, NamiEntitlement} from 'react-native-nami-sdk';

const subscriptionRemover =
  NamiEntitlementManager.registerActiveEntitlementsHandler(
    (activeEntitlements) => {
      console.log('activeEntitlements', activeEntitlements);
      setEntitlements(activeEntitlements);
    },
  );
return () => {
  subscriptionRemover();
};
NamiEntitlementManager.RegisterActiveEntitlementsHandler(activeEntitlementsCallback);

Returns

  • activeEntitlements - a list of the current entitlements active for the user and device.