import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; import { ShouldStartLoadRequest } from 'react-native-webview/lib/WebViewTypes'; import { CoinflowIFrameProps, IFrameMessageHandlers } from './common'; export type WithStyles = { style?: StyleProp; }; export type WithOnLoad = { onLoad?: () => void; /** * Override the onShouldStartLoadWithRequest with your own function * * Function that allows custom handling of any web view requests. Return true from the function to continue loading the request and false to stop loading. */ onShouldStartLoadWithRequest?: (request: ShouldStartLoadRequest) => boolean; }; /** * How Venmo checkouts hand off to a browser. The two variants encode the two * valid host/presentation pairings — they are not independently mixable: * - 'venmo-app': system Safari + popup presentation. The customer switches * into the native Venmo app; the continue page shows a return-to-app link. * Works with no extra dependencies (default). * - 'in-app-browser': merchant-supplied in-app browser (SFSafariViewController * / Custom Tabs) + modal presentation. The whole checkout stays in the * sheet; provide closeBrowser so the SDK can dismiss it automatically when * the payment completes. */ export type VenmoFlow = { type: 'venmo-app'; } | { type: 'in-app-browser'; openBrowser: (url: string) => Promise; closeBrowser?: () => void; }; export type WithVenmoFlow = { venmoFlow?: VenmoFlow; }; export type WithBrowserRedirect = { /** * Called when the checkout needs to hand off to the system browser (e.g. * Venmo checkouts, which cannot complete inside an embedded webview). * * Defaults to `Linking.openURL` (full browser app). Provide this to open * the URL in an in-app browser instead, e.g. SFSafariViewController via * expo-web-browser's `openBrowserAsync` or * react-native-inappbrowser-reborn. */ handleBrowserRedirect?: (url: string) => void | Promise; }; export type CoinflowWebViewProps = Omit & WithOnLoad & WithBrowserRedirect & WithVenmoFlow & { /** * If set, the webview will only render the content after the webview sends a "loaded" message */ waitForWebviewLoadedMessage?: boolean; }; export declare function useRandomHandleHeightChangeId(): string; export declare function CoinflowWebView(props: CoinflowWebViewProps & WithStyles & IFrameMessageHandlers): React.JSX.Element;