import React, { FC } from 'react'; import { View, Text, TextProps, StyleProp, TextStyle, ViewProps, ViewStyle, StyleSheet, } from 'react-native'; import { DEFAULT_HEIGHT } from './constants'; export interface SwipeButtonTextProps { /** * The text that will be displayed in the container */ title: string; /** * Additional props for the title text */ titleExtraTextProps?: TextProps; /** * Additional styling for the title text */ titleStyle?: StyleProp; /** * Additional props for the title container */ titleContainerExtraViewProps?: ViewProps; /** * Additional styling for the title container */ titleContainerStyle?: StyleProp; /** * Height of the title container */ height?: number; /** * An JSX element you can define to replace the title default component. Using this will omit the others title props */ titleElement?: JSX.Element; } const SwipeButtonText: FC = ({ title, titleStyle, titleContainerExtraViewProps, titleContainerStyle, titleExtraTextProps, titleElement, height = DEFAULT_HEIGHT, }) => { return ( titleElement || ( {title} ) ); }; export default SwipeButtonText; const styles = StyleSheet.create({ titleContainer: { justifyContent: 'center', alignItems: 'center', }, title: { color: 'black', fontSize: 16, maxWidth: '50%', textAlign: 'center', }, });