import type { HostComponent, ViewProps } from 'react-native'; import type { DirectEventHandler, Double, Int32, } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; export interface InternalFlowConfig { showPayButton: boolean; paymentButtonAction: string; } interface NativeComponentDimensions { width: Double; height: Double; } interface NativeProps extends ViewProps { config: InternalFlowConfig; onDimensionsChanged: DirectEventHandler | null; } type FlowComponentType = HostComponent; interface FlowNativeCommands { submit: (viewRef: React.ElementRef) => void; tokenize: (viewRef: React.ElementRef) => void; update: ( viewRef: React.ElementRef, amount: Int32, currency?: string ) => void; } export const Commands: FlowNativeCommands = codegenNativeCommands({ supportedCommands: ['submit', 'tokenize', 'update'], }); export default codegenNativeComponent('Flow') as FlowComponentType;