correct issues
This commit is contained in:
@@ -18,14 +18,11 @@ const NotificationRedirection: React.FC = () => {
|
||||
// This effect runs once when the component mounts
|
||||
if (data) {
|
||||
console.log('🔄 Processing notification data:', data);
|
||||
|
||||
// --- Your Redirection Logic Goes Here ---
|
||||
// Use the 'data' object to decide where to go.
|
||||
// For this example, we'll navigate based on 'msgType'.
|
||||
|
||||
let destination: keyof RootStackParamList = 'Home'; // Default destination
|
||||
let params: object | undefined = undefined;
|
||||
|
||||
switch (data.msgType) {
|
||||
case 'JOIN_REQUEST':
|
||||
destination = 'Home';
|
||||
@@ -62,10 +59,9 @@ const NotificationRedirection: React.FC = () => {
|
||||
// Keep the default destination as 'Home'
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(`➡ Redirecting to ${destination} with params:`, params);
|
||||
// Use replace to prevent the user from navigating back to this loading screen
|
||||
navigation.replace(destination, params);
|
||||
|
||||
} else {
|
||||
// If no data is passed for some reason, just go to the home screen
|
||||
console.warn('⚠ No data found in notification, redirecting to Home.');
|
||||
|
||||
Reference in New Issue
Block a user