react-native-credit-cards
Version:
A customizable credit card form component for React Native with card flip animation and validation
28 lines (27 loc) • 1.24 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlipCard = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const react_native_1 = require("react-native");
// Try to import react-native-flip-card, fallback to a simple view
let FlipCardComponent;
try {
FlipCardComponent = require('react-native-flip-card').default;
}
catch (error) {
// Fallback implementation for when react-native-flip-card is not available
FlipCardComponent = ({ children, style, flip, friction, perspective, flipHorizontal, flipVertical, alignHeight, ...props }) => {
const childrenArray = react_1.default.Children.toArray(children);
const frontComponent = childrenArray[0];
const backComponent = childrenArray[1];
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: style, ...props, children: flip ? backComponent : frontComponent }));
};
}
const FlipCard = (props) => {
return (0, jsx_runtime_1.jsx)(FlipCardComponent, { ...props });
};
exports.FlipCard = FlipCard;