import React from 'react'; import { ViewProps } from 'react-native'; import { AdaptyFlow } from '../types'; import { CreateFlowViewParamsInput, FlowEventHandlers } from './types'; /** * Props for the {@link AdaptyFlowView} component. * @public */ export type AdaptyFlowViewProps = ViewProps & { /** * Flow (paywall) object to render. * * @remarks * Encoded and serialized to JSON (`flowJson`) before it is handed to the * native view. Keep the reference stable across renders (e.g. memoized or * held in state) — a new object identity re-runs the coder and * `JSON.stringify` on every render. */ flow: AdaptyFlow; /** * Optional parameters for the flow view. * * @remarks * Merged with defaults, then encoded and serialized into `flowJson` * alongside `flow`. */ params?: CreateFlowViewParamsInput; onCloseButtonPress?: FlowEventHandlers['onCloseButtonPress']; onProductSelected?: FlowEventHandlers['onProductSelected']; onPurchaseStarted?: FlowEventHandlers['onPurchaseStarted']; onPurchaseCompleted?: FlowEventHandlers['onPurchaseCompleted']; onPurchaseFailed?: FlowEventHandlers['onPurchaseFailed']; onRestoreStarted?: FlowEventHandlers['onRestoreStarted']; onAppeared?: FlowEventHandlers['onAppeared']; onWebPaymentNavigationFinished?: FlowEventHandlers['onWebPaymentNavigationFinished']; onRestoreCompleted?: FlowEventHandlers['onRestoreCompleted']; onRestoreFailed?: FlowEventHandlers['onRestoreFailed']; onError?: FlowEventHandlers['onError']; onLoadingProductsFailed?: FlowEventHandlers['onLoadingProductsFailed']; onCustomAction?: FlowEventHandlers['onCustomAction']; onUrlPress?: FlowEventHandlers['onUrlPress']; onRequestAppReview?: FlowEventHandlers['onRequestAppReview']; onAnalytics?: FlowEventHandlers['onAnalytics']; onRequestPermission?: FlowEventHandlers['onRequestPermission']; onObserverPurchaseInitiated?: FlowEventHandlers['onObserverPurchaseInitiated']; onObserverRestoreInitiated?: FlowEventHandlers['onObserverRestoreInitiated']; }; /** * React component that renders a native flow view. * * @remarks * Accepts a flow object and optional event handler props. * Under the hood, it creates a native view and subscribes to flow events. * * The view is embedded in your React tree, so its lifecycle is controlled by * your app — not by the SDK. Event handlers still run (and their side effects * apply), but the boolean they return does NOT dismiss the embedded view: that * "close" flag only applies to the imperative view created via * {@link createFlowView}. To dismiss the embedded view, stop rendering it * (e.g. flip state in `onCloseButtonPress`): * * ```tsx * const [visible, setVisible] = useState(true); * const onCloseButtonPress = useCallback(() => { * setVisible(false); // unmount to dismiss; return value is ignored here * }, []); * return visible ? ( * * ) : null; * ``` * * To learn which localization the view was actually rendered with, read * `view.locale` in `onAppeared`. It is the localization the view was actually * built with, which may differ from the one requested through `params.locale` * if it is not available in the flow: * * ```tsx * setUiLocale(view.locale)} * /> * ``` * * @see {@link AdaptyFlowViewProps} for available props * @public */ export declare const AdaptyFlowView: React.NamedExoticComponent; //# sourceMappingURL=AdaptyFlowView.d.ts.map