import React from 'react'; import { Icon, IconName, SemanticColor, Typo } from '../../foundation'; import { FABContainer, FABCommonProps } from './FABContainer'; import { StyleSheet, TouchableHighlight, View } from 'react-native'; import { useThrottledPressHandler } from '../../internal/utils/useThrottledPressHandler'; type Props = FABCommonProps & { onPress: () => void; icon: IconName; label: string }; /** * ## Floating Action Button - With Label 컴포넌트 * * ## Props * * ### `icon` (필수) * - 아이콘 이름 * * ### `label` (필수) * - 버튼 라벨 * * ### `onPress` (필수) * - 버튼 press 핸들러 * * ### `layoutStyle` * - 컴포넌트를 배치하는데 필요한 ViewStyle 모음 * * ### `throttle` * - 버튼 throttle 옵션 (사용 방법은 타입정의 문서 참고) * * * ## 사용 예시 * @example * ```tsx * // 다른 뷰로 감싸 사용하는 예시 * * * * * // 단독으로 사용하는 예시 * * ``` */ export function FloatingActionButtonWithLabel(props: Props): React.JSX.Element { const throttledPressHandler = useThrottledPressHandler(props.onPress, props.throttle); return ( {props.label} ); } const styles = StyleSheet.create({ button: { height: 44, paddingLeft: 16, paddingRight: 20, justifyContent: 'center', borderRadius: Number.MAX_SAFE_INTEGER, backgroundColor: SemanticColor.bg_enabled, }, content: { gap: 8, flexDirection: 'row', alignItems: 'center', }, });