UNPKG

@nostr-dev-kit/ndk-mobile

Version:

NDK Mobile

61 lines 2.07 kB
/** * A React Native component that renders Nostr event content with rich formatting support. * Handles rendering of mentions, hashtags, URLs, emojis, and images within event content. * * Features: * - Renders nostr: mentions with optional custom mention component * - Formats hashtags with optional press handling * - Renders URLs and images with press handling * - Supports custom emoji rendering from event tags * - Special handling for reaction events (❤️, 👎) * * @package @nostr-dev-kit/ndk-mobile */ import { type NDKEvent } from "@nostr-dev-kit/ndk-hooks"; import React from "react"; import { type TextProps } from "react-native"; /** * Props for the EventContent component */ export interface EventContentProps extends TextProps { /** The NDKEvent to render content from */ event?: NDKEvent; /** Optional content override. If not provided, uses event.content */ content?: string; /** Callback when a user mention is pressed */ onUserPress?: (pubkey: string) => void; /** Callback when a hashtag is pressed */ onHashtagPress?: (hashtag: string) => void; /** Callback when a URL is pressed */ onUrlPress?: (url: string) => void; /** Optional custom component to render user mentions */ MentionComponent?: React.ComponentType<{ pubkey: string; }>; } /** * Main component for rendering Nostr event content with rich formatting * * @example * ```tsx * // Basic usage * <EventContent event={ndkEvent} /> * * // With custom handlers * <EventContent * event={ndkEvent} * onUserPress={(pubkey) => console.log('User pressed:', pubkey)} * onHashtagPress={(hashtag) => console.log('Hashtag pressed:', hashtag)} * onUrlPress={(url) => console.log('URL pressed:', url)} * /> * * // With custom mention component * <EventContent * event={ndkEvent} * MentionComponent={({ pubkey }) => <UserName pubkey={pubkey} />} * /> * ``` */ declare const EventContent: React.FC<EventContentProps>; export default EventContent; //# sourceMappingURL=content.d.ts.map