React-native-notifee: undefined is not an object (evaluating '_reactNative.Importance.DEFAULT')

Created on 10 Jun 2020  路  3Comments  路  Source: notifee/react-native-notifee

import notifee, { Importance } from "@notifee/react-native";

export const configureNotificationChannel = async () => {
  return await notifee.createChannel({
    id: "default",
    name: "Default Notifications",
    vibration: true,
    importance: Importance.DEFAULT,
  });
};

This is no longer working because it appears Importance is not longer exported. What is the correct variable to use to set a default channel importance?

The documentation needs to be updated I think.

await notifee.createChannel({
  id: 'alarm',
  name: 'Firing alarms & timers',
  lights: false,
  vibration: true,
  importance: notifee.Importance.DEFAULT,
});

Notes: using @notifee/react-native: ^0.7.1

Most helpful comment

Sorry it's now AndroidImportance, docs will be updated this week

All 3 comments

Sorry it's now AndroidImportance, docs will be updated this week

Great thks, just want to add that if I do notifee. AndroidImportance.DEFAULT <-- this is not working

if have to import it like that import notifee, { AndroidImportance } from '@notifee/react-native';

Docs have now been updated, and this is also covered in the release notes: https://notifee.app/react-native/docs/release-notes#060

Thank you for reporting the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hibinoA picture hibinoA  路  4Comments

joshuacano picture joshuacano  路  6Comments

mars-lan picture mars-lan  路  9Comments

rgommezz picture rgommezz  路  4Comments

beweinreich picture beweinreich  路  9Comments