mediasfu-reactnative
Version:
MediaSFU Prebuilt React Native SDK
75 lines (74 loc) • 2.37 kB
TypeScript
import React from 'react';
import { StyleProp, ViewStyle, ImageStyle } from 'react-native';
/**
* Interface defining the props for the MiniCard component.
*/
export interface MiniCardOptions {
/**
* The initials to display if no image is provided.
*/
initials?: string;
/**
* The font size for the initials.
* @default 14
*/
fontSize?: number;
/**
* Custom styles to apply to the card.
*/
customStyle?: StyleProp<ViewStyle>;
/**
* The source URI of the image to display.
*/
imageSource?: string;
/**
* Whether the image should have rounded corners.
* @default true
*/
roundedImage?: boolean;
/**
* Custom styles to apply to the image.
*/
imageStyle?: StyleProp<ImageStyle>;
}
export type MiniCardType = (options: MiniCardOptions) => JSX.Element;
/**
* MiniCard component displays a small card with either an image or initials, providing flexible styling options.
*
* This component renders either an image or initials based on the provided props, supporting customizable
* font size, border radius, and additional styling for the card and image.
*
* @component
* @param {MiniCardOptions} props - Configuration options for the MiniCard component.
* @param {string} [props.initials] - Initials to display if no image is provided.
* @param {number} [props.fontSize=14] - Font size for the initials.
* @param {StyleProp<ViewStyle>} [props.customStyle] - Custom styles for the card container.
* @param {string} [props.imageSource] - URI of the image to display.
* @param {boolean} [props.roundedImage=true] - Determines if the image should have rounded corners.
* @param {StyleProp<ImageStyle>} [props.imageStyle] - Custom styles for the image.
*
* @returns {JSX.Element} The MiniCard component.
*
* @example
* ```tsx
* import React from 'react';
* import { MiniCard } from 'mediasfu-reactnative';
*
* function App() {
* return (
* <MiniCard
* initials="AB"
* fontSize={18}
* customStyle={{ backgroundColor: '#f0f0f0', borderRadius: 10 }}
* imageSource="https://example.com/image.jpg"
* roundedImage={true}
* imageStyle={{ width: 50, height: 50 }}
* />
* );
* }
*
* export default App;
* ```
*/
declare const MiniCard: React.FC<MiniCardOptions>;
export default MiniCard;