import type { HostComponent, ViewProps } from 'react-native'; import type { DirectEventHandler, Int32, } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type { CardFormView } from '../types'; import type { UnsafeMixed } from './utils'; interface FormCompleteEvent { card: UnsafeMixed; } export interface FocusChangeEvent { focusedField: 'CardNumber' | 'Cvc' | 'ExpiryDate' | 'PostalCode' | null; } export interface NativeProps extends ViewProps { autofocus: boolean; cardStyle: UnsafeMixed; dangerouslyGetFullCardDetails: boolean; defaultValues: UnsafeMixed; disabled: boolean; onFocusChange?: DirectEventHandler; onFormComplete?: DirectEventHandler; placeholders: UnsafeMixed; postalCodeEnabled: boolean; preferredNetworks?: Int32[]; } type ComponentType = HostComponent; interface NativeCommands { blur: (viewRef: React.ElementRef) => void; focus: (viewRef: React.ElementRef) => void; } export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['blur', 'focus'], }); export default codegenNativeComponent('CardForm') as ComponentType;