@ntd1003/react-native-badge
Version:
Display badge number on Android/iOS app icon in React Native
19 lines (18 loc) • 755 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setBadge = setBadge;
const react_native_1 = require("react-native");
const BadgeNotification = react_native_1.NativeModules.BadgeNotification;
function setBadge(count) {
console.log('setBadge called, count =', count);
if (!(BadgeNotification === null || BadgeNotification === void 0 ? void 0 : BadgeNotification.setBadgeCount)) {
console.warn('BadgeNotification.setBadgeCount is undefined');
return;
}
if (react_native_1.Platform.OS === 'android' || react_native_1.Platform.OS === 'ios') {
BadgeNotification.setBadgeCount(count);
}
else {
console.warn('Unsupported platform:', react_native_1.Platform.OS);
}
}