isAvailable() {
    return new Promise(function(resolve, reject) {
      NativeSafariViewManager.isAvailable(function(error) {
        if (error) {
          return reject(error);
        }

        resolve(true);
      });
    });
  },

  addEventListener(event, listener) {
    if (event === 'onShow') {
      DeviceEventEmitter.addListener('SafariViewOnShow', listener);
    } else if (event === 'onDismiss') {
      NativeAppEventEmitter.addListener('SafariViewOnDismiss', listener);
    }
  },

  removeEventListener(event, listener) {
    if (event === 'onShow') {
      DeviceEventEmitter.removeListener('SafariViewOnShow', listener);
    } else if (event === 'onDismiss') {
      NativeAppEventEmitter.removeListener('SafariViewOnDismiss', listener);
    }
  }
};

module.exports = SafariViewManager;
 removeImmersiveListener: (listener) => DeviceEventEmitter.removeListener('@@IMMERSIVE_STATE_CHANGED', listener)
 off(event) {
   DeviceEventEmitter.removeListener(event, callback);
   return this;
 }