import type { SharePayload } from './NitroShareIntent.nitro'; type ShareListener = (payload: SharePayload) => void; type ErrorListener = (message: string) => void; /** * A lightweight, in-memory mock of the native `NitroShareIntent` module, * intended for Jest tests (or Storybook/simulators) so consumer apps can * exercise their share-handling code without a real device or the native * module being available. * * It intentionally mirrors the shape of the native module * (`onIntentListener`/`onErrorListener`/`removeListener`/`getInitialShare`/ * `clearShareIntent`) so it can be used as a drop-in replacement when * mocking `react-native-nitro-share-intent` in tests, e.g.: * * ```ts * import { MockShareIntentModule } from 'react-native-nitro-share-intent/mock'; * * const mockModule = new MockShareIntentModule(); * * jest.mock('react-native-nitro-share-intent', () => { * const actual = jest.requireActual('react-native-nitro-share-intent'); * return { * ...actual, * useShareIntent: (onShare, onError) => { * // wire `mockModule` into a test-only hook implementation, or use * // `mockModule.simulateShare(...)` directly against your own * // listener/callback in a unit test. * }, * }; * }); * * mockModule.simulateShare({ type: 'text', text: 'Hello from a test' }); * ``` */ export declare class MockShareIntentModule { private shareListeners; private errorListeners; private nextListenerId; private pendingShare; getInitialShare(): Promise; onIntentListener(listener: ShareListener): number; onErrorListener(listener: ErrorListener): number; removeListener(id: number): void; clearShareIntent(): void; /** Test helper: simulate an incoming share intent being delivered. */ simulateShare(payload: SharePayload): void; /** Test helper: simulate a native error being reported. */ simulateError(message: string): void; } export declare const createMockShareIntentModule: () => MockShareIntentModule; export {}; //# sourceMappingURL=mock.d.ts.map