react-native-confirmation-code-field
Version:
A react-native component to input confirmation code for both Android and IOS
31 lines (30 loc) • 1.08 kB
TypeScript
import type { StyleProp, TextStyle, ViewProps } from 'react-native';
import { TextInput } from 'react-native';
import { ComponentPropsWithRef, ComponentType, ElementType, ReactNode } from 'react';
import React from 'react';
export interface RenderCellOptions {
symbol: string;
index: number;
isFocused: boolean;
}
type OmitStyle<T extends {
style?: any;
}> = Omit<T, 'style'>;
interface BaseProps {
renderCell: (options: RenderCellOptions) => ReactNode;
RootProps?: ViewProps;
RootComponent?: ComponentType<ViewProps>;
rootStyle?: ViewProps['style'];
textInputStyle?: StyleProp<TextStyle>;
cellCount?: number;
}
export interface Props extends BaseProps, OmitStyle<ComponentPropsWithRef<typeof TextInput>> {
}
export interface CodeFieldOverridableComponent {
<TInput extends ElementType>(props: {
InputComponent: TInput;
} & OmitStyle<ComponentPropsWithRef<TInput>> & BaseProps): React.JSX.Element | null;
(props: Props): React.JSX.Element | null;
}
export declare const CodeField: CodeFieldOverridableComponent;
export {};