added notification

This commit is contained in:
Samandar Turgunboyev
2025-09-04 10:06:46 +05:00
parent e51ff4f502
commit f55a3a50ed
54 changed files with 2502 additions and 643 deletions

View File

@@ -1,9 +1,41 @@
/**
* @format
*/
import notifee, { AndroidImportance } from '@notifee/react-native';
import messaging from '@react-native-firebase/messaging';
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
// 📌 Background/Killed xabarlarni ushlash
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log('Background message:', remoteMessage);
const channelId = await notifee.createChannel({
id: 'default',
name: 'Umumiy bildirishnomalar',
sound: 'default',
importance: AndroidImportance.HIGH,
});
await notifee.displayNotification({
title:
remoteMessage.notification?.title ||
remoteMessage.data?.title ||
'Yangi xabar',
body:
remoteMessage.notification?.body ||
remoteMessage.data?.body ||
'Matn yoq',
android: {
channelId,
smallIcon: 'ic_launcher',
sound: 'default',
pressAction: {
id: 'default',
},
},
});
});
AppRegistry.registerComponent(appName, () => App);