import type { ReactElement } from 'react';
import { useLocalSearchParams } from 'expo-router';
import { ChatScreen } from '@/features/messaging';

export default function ChatRoute(): ReactElement | null {
  const params = useLocalSearchParams<{ id: string }>();
  const id = typeof params.id === 'string' ? params.id : null;
  if (id === null) {
    return null;
  }
  return <ChatScreen conversationId={id} />;
}
