import React, { FC } from 'react'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { IconXDoubt1 } from '../../icons'; import { UploaderTitleProps } from './interface'; import { useLocale } from '../Locale/locale'; import createStyle from './style'; import { useTheme } from '../Theme/Theme'; import ShouldRender from '../ShouldRender/ShouldRender'; import { renderTextLikeJSX } from '../../core/helpers'; import { Fill } from '../Button/enum'; import Button from '../Button'; interface TitleProps extends UploaderTitleProps { /** * 点击预览示例的回调 */ onShowDemo?: () => void; } const UploaderTitle: FC = ({ required, title, titleContainerStyle, titleStyle, showIcon, labelRight, onShowDemo, onClickIcon, }) => { const local = useLocale(); const token = useTheme(); const styles = createStyle(token); return title ? ( {renderTextLikeJSX( title, StyleSheet.flatten([styles.title, titleStyle]) )} {local.Field.optional} {showIcon && ( )} {(onShowDemo || labelRight) && ( {labelRight ?? ( )} )} ) : null; }; export default UploaderTitle;