import { WebViewProps, WebView } from 'react-native-webview'; import { LegacyRef } from 'react'; import { UseFrameAppReturn, UseFrameAppOptions } from '../use-frame-app.js'; import { HostEndpointEmitter } from './types.js'; import 'frames.js/frame-parsers'; import '@farcaster/frame-host'; import 'ox/Provider'; import 'ox/RpcSchema'; type UseFrameAppReturnSuccess = Extract; type UseFrameAppInWebViewReturn = Exclude | (Omit & { emitter: HostEndpointEmitter; webViewProps: { source: WebViewProps["source"]; onMessage: NonNullable; ref: LegacyRef; }; }); /** * useFrameApp() hook for react-native-webview handling * * On unmount it automatically unregisters the endpoint listener. * * @example * ``` * import { useFrameAppInWebView } from '@frames.js/render/frame-app/web-view'; * import { useWagmiProvider } from '@frames.js/render/frame-app/provider/wagmi'; * import { useFarcasterSigner } from '@frames.js/render/identity/farcaster'; * * function MyAppDialog() { * const provider = useWagmiProvider(); * const farcasterSigner = useFarcasterSigner({ * // ... * }); * const frameApp = useFrameAppInWebView({ * provider, * farcasterSigner, * // frame returned by useFrame() hook * frame: frameState.frame, * // ... handlers for frame app actions * }); * * if (frameApp.status !== 'success') { * // render loading or error * return null; * } * * return ; * } * ``` */ declare function useFrameAppInWebView(options: UseFrameAppOptions): UseFrameAppInWebViewReturn; export { type UseFrameAppInWebViewReturn, useFrameAppInWebView };