UNPKG

pay-sdk-react

Version:

A cross-platform payment SDK for React, supporting Alipay, WeChat Pay, PayPal, Stripe, Payssion, and Airwallex, compatible with H5, PC, and App environments.

20 lines (19 loc) 678 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShouldRender = void 0; exports.useShouldRender = useShouldRender; var _useInitialized = require("../hooks/use-initialized"); const ShouldRender = props => { const shouldRender = useShouldRender(props.active, props.forceRender, props.destroyOnClose); return shouldRender ? props.children : null; }; exports.ShouldRender = ShouldRender; function useShouldRender(active, forceRender, destroyOnClose) { const initialized = (0, _useInitialized.useInitialized)(active); if (forceRender) return true; if (active) return true; if (!initialized) return false; return !destroyOnClose; }