@olo/pay-react-native
Version:
Olo Pay React Native SDK
34 lines (32 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = usePaymentCardDetailsFormManager;
var _react = require("react");
// Copyright © 2022 Olo Inc. All rights reserved.
// This software is made available under the Olo Pay SDK License (See LICENSE.md file)
// Load commands for Fabric
const Commands = require('../components/specs/PaymentCardDetailsFormNativeComponent').Commands;
function usePaymentCardDetailsFormManager() {
const blur = (0, _react.useCallback)(ref => {
Commands.blur(ref.current);
}, []);
const focus = (0, _react.useCallback)((ref, field) => {
Commands.focus(ref.current, field);
}, []);
const clear = (0, _react.useCallback)(ref => {
Commands.clear(ref.current);
}, []);
const createPaymentMethod = (0, _react.useCallback)(ref => {
// Result comes via onPaymentMethodResult event
Commands.createPaymentMethod(ref.current);
}, []);
return {
blur,
clear,
focus,
createPaymentMethod
};
}
//# sourceMappingURL=usePaymentCardDetailsFormManager.js.map