UNPKG

zips-react-native-sdk-test

Version:

Lightweight ZIPS Payment Gateway SDK for React Native - Complete payment solution with ZApp wallet payments and Access Bank integration

33 lines (32 loc) 1.02 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { createContext, useContext, useState } from 'react'; const cardContext = createContext(undefined); export const useCardContext = () => { const context = useContext(cardContext); if (!context) { throw new Error('useCardContext must be used within a CardProvider'); } return context; }; export const CardProvider = ({ children }) => { const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const [data, setData] = useState(null); const [cardInformation, setCardInformation] = useState({ cardNumber: '', expiryMonth: '', expiryYear: '', cvv: '', cardholderName: '', }); return (_jsx(cardContext.Provider, { value: { isLoading, setIsLoading, error, setError, data, setData, cardInformation, setCardInformation, }, children: children })); };